Skip to content

Commit

Permalink
Fix the GUI to add data nodes. (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmizzell authored Dec 3, 2019
1 parent e75ac71 commit f7f1432
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion modules/custom/dkan_data/dkan_data.module
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ function dkan_data_entity_presave(EntityInterface $entity) {
return;
}

if (empty($entity->get('field_data_type')->value)) {
$entity->set('field_data_type', "dataset");
}

if ($entity->get('field_data_type')->value != 'dataset') {
return;
}
Expand All @@ -88,7 +92,7 @@ function dkan_data_entity_presave(EntityInterface $entity) {
if (!isset($metadata->identifier)) {
$metadata->identifier = $entity->uuid();
}
// If one exists in the uui it should be the same in the table.
// If one exists in the uuid it should be the same in the table.
else {
$entity->set('uuid', $metadata->identifier);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ public function validate($items, Constraint $constraint) {
*/
protected function isProper($value) {
// @codeCoverageIgnoreStart
return \Drupal::service("dkan_api.controller")->getEngine()->validate($value);
/* @var $saeFactory SaeFactory */
$saeFactory = \Drupal::service("dkan_metastore.sae_factory");

/* @var $engine Sae */
$engine = $saeFactory->getInstance('dataset');

return $engine->validate($value);
// @codeCoverageIgnoreEnd
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class WebServiceApiDocsTest extends TestCase {
public function testGetDatasetSpecific() {
$mockChain = $this->getCommonMockChain();

// Test against ./docs/dkan_api_openapi_spec.yml
// Test against ./docs/dkan_api_openapi_spec.yml.
$endpointsToKeep = [
// Target paths.
'/api/1/metastore/schemas/dataset/items/{identifier}' => ['get'],
Expand Down

0 comments on commit f7f1432

Please sign in to comment.