From fca612c23af04d8809ddf77eccedfe3591bfff13 Mon Sep 17 00:00:00 2001 From: Steve Wirt Date: Fri, 13 Feb 2026 01:35:28 -0500 Subject: [PATCH 1/5] #4655 Add link to node/123 to dataset import status table. --- modules/datastore/datastore.module | 2 ++ modules/datastore/src/Form/DashboardForm.php | 3 +++ .../templates/datastore-dashboard-dataset-cell.html.twig | 9 ++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/datastore/datastore.module b/modules/datastore/datastore.module index 33c4064ff1..7eb843932f 100644 --- a/modules/datastore/datastore.module +++ b/modules/datastore/datastore.module @@ -15,6 +15,8 @@ function datastore_theme($existing, $type, $theme, $path) { 'uuid' => NULL, 'title' => NULL, 'url' => NULL, + 'node_url' => NULL, + 'node_id' => NULL, ], ], 'datastore_dashboard_revision_cell' => [ diff --git a/modules/datastore/src/Form/DashboardForm.php b/modules/datastore/src/Form/DashboardForm.php index 61d3e279df..17f6123bfd 100644 --- a/modules/datastore/src/Form/DashboardForm.php +++ b/modules/datastore/src/Form/DashboardForm.php @@ -502,6 +502,7 @@ protected function buildRevisionRow(array $rev, int $resourceCount, string $harv if ($moderation_class == 'hidden') { $moderation_class = 'published-hidden'; } +$play = Url::fromRoute('entity.node.canonical', ['node' => $rev['node_id']], ['absolute' => TRUE]); return [ [ 'rowspan' => $resourceCount, @@ -510,6 +511,8 @@ protected function buildRevisionRow(array $rev, int $resourceCount, string $harv '#uuid' => $rev['uuid'], '#title' => $rev['title'], '#url' => Url::fromUri("internal:/dataset/$rev[uuid]"), + '#node_url' => Url::fromRoute('entity.node.canonical', ['node' => $rev['node_id']], ['absolute' => TRUE])->toString(), + '#node_id' => $rev['node_id'], ], ], [ diff --git a/modules/datastore/templates/datastore-dashboard-dataset-cell.html.twig b/modules/datastore/templates/datastore-dashboard-dataset-cell.html.twig index 466214284e..61be1cdd56 100644 --- a/modules/datastore/templates/datastore-dashboard-dataset-cell.html.twig +++ b/modules/datastore/templates/datastore-dashboard-dataset-cell.html.twig @@ -1,2 +1,9 @@
{{ uuid }}
- \ No newline at end of file + From facb0ff2e2894032f3ac613d61308f5b56c49ae4 Mon Sep 17 00:00:00 2001 From: Steve Wirt Date: Fri, 13 Feb 2026 01:59:54 -0500 Subject: [PATCH 2/5] adjust the tests. --- modules/datastore/src/Form/DashboardForm.php | 2 +- .../datastore/tests/src/Unit/Form/DashboardFormTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/datastore/src/Form/DashboardForm.php b/modules/datastore/src/Form/DashboardForm.php index 17f6123bfd..44df5a505a 100644 --- a/modules/datastore/src/Form/DashboardForm.php +++ b/modules/datastore/src/Form/DashboardForm.php @@ -502,7 +502,7 @@ protected function buildRevisionRow(array $rev, int $resourceCount, string $harv if ($moderation_class == 'hidden') { $moderation_class = 'published-hidden'; } -$play = Url::fromRoute('entity.node.canonical', ['node' => $rev['node_id']], ['absolute' => TRUE]); + return [ [ 'rowspan' => $resourceCount, diff --git a/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php b/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php index b1e434f107..5326e9d65b 100644 --- a/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php +++ b/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php @@ -110,6 +110,7 @@ public function testBuildTableRowsWithHarvestIdFilter() { 'moderation_state' => 'published', 'modified_date_metadata' => '2020-01-15', 'modified_date_dkan' => '2021-02-11', + 'node_id' => 1, ]; $distribution = [ 'distribution_uuid' => 'dist-1', @@ -167,6 +168,7 @@ public function testBuildTableRowsWithDatasetTitleFilter() { 'moderation_state' => 'published', 'modified_date_metadata' => '2020-01-15', 'modified_date_dkan' => '2021-02-11', + 'node_id' => 2, ]; $distribution = [ 'distribution_uuid' => 'dist-1', @@ -235,6 +237,7 @@ public function testBuildTableRowsWithUuidFilter() { 'moderation_state' => 'published', 'modified_date_metadata' => '2020-01-15', 'modified_date_dkan' => '2021-02-11', + 'node_id' => 3, ]; $distribution = [ 'distribution_uuid' => 'dist-1', @@ -295,6 +298,7 @@ public function testBuildTableRowsWithAllDatasets() { 'title' => 'Dataset 1', 'modified_date_metadata' => '2019-08-12', 'modified_date_dkan' => '2021-07-08', + 'node_id' => 3, 'distributions' => [ [ 'distribution_uuid' => 'dist-1', @@ -395,6 +399,7 @@ public function testBuildTableRowsDatasetWithNoDistribution() { 'modified_date_metadata' => '2019-08-12', 'modified_date_dkan' => '2021-07-08', 'distributions' => ['Not found'], + 'node_id' => 1, ], ]; @@ -421,6 +426,7 @@ public function testBuildTableRowsWithUnsupportedResourceTypes() { 'title' => 'Dataset 1', 'modified_date_metadata' => '2019-08-12', 'modified_date_dkan' => '2021-07-08', + 'node_id' => 5, 'distributions' => [ [ 'distribution_uuid' => 'dist-1', @@ -524,6 +530,7 @@ public function testBuildTableRowsDatasetMultipleDistribution() { 'title' => 'Dataset 1', 'modified_date_metadata' => '2019-08-12', 'modified_date_dkan' => '2021-07-08', + 'node_id' => 7, 'distributions' => [ [ 'distribution_uuid' => 'dist-1', From 02cc8a5f2da49a88ca6b56634b70d8f22c7090fc Mon Sep 17 00:00:00 2001 From: Steve Wirt Date: Fri, 13 Feb 2026 01:59:54 -0500 Subject: [PATCH 3/5] adjust the tests. --- .../tests/src/Unit/Form/DashboardFormTest.php | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php b/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php index 5326e9d65b..996f4f1816 100644 --- a/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php +++ b/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php @@ -2,36 +2,37 @@ namespace Drupal\Tests\datastore\Unit\Form; +use Drupal\common\DataResource; +use Drupal\common\DatasetInfo; +use Drupal\Core\Database\Connection; use Drupal\Core\Datetime\DateFormatter; use Drupal\Core\DependencyInjection\Container; +use Drupal\Core\Entity\EntityStorageInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\Entity\Query\QueryInterface; use Drupal\Core\Form\FormState; use Drupal\Core\Pager\Pager; use Drupal\Core\Pager\PagerManagerInterface; use Drupal\Core\Path\PathValidator; +use Drupal\Core\Routing\UrlGenerator; use Drupal\Core\StreamWrapper\PublicStream; use Drupal\Core\StreamWrapper\StreamWrapperManager; use Drupal\Core\StringTranslation\TranslationManager; -use Drupal\Tests\metastore\Unit\MetastoreServiceTest; -use Drupal\common\DatasetInfo; -use Drupal\Core\Database\Connection; use Drupal\datastore\Form\DashboardForm; +use Drupal\datastore\PostImportResult; +use Drupal\datastore\PostImportResultFactory; use Drupal\datastore\Service\PostImport; use Drupal\harvest\Entity\HarvestRunRepository; use Drupal\harvest\HarvestService; use Drupal\metastore\MetastoreService; +use Drupal\metastore\ResourceMapper; +use Drupal\node\NodeInterface; +use Drupal\Tests\metastore\Unit\MetastoreServiceTest; use MockChain\Chain; use MockChain\Options; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; -use Drupal\metastore\ResourceMapper; -use Drupal\datastore\PostImportResult; -use Drupal\datastore\PostImportResultFactory; -use Drupal\common\DataResource; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Entity\Query\QueryInterface; -use Drupal\node\NodeInterface; /** * @group dkan @@ -145,6 +146,7 @@ public function testBuildTableRowsWithHarvestIdFilter() { ->add(RequestStack::class, 'getCurrentRequest', new Request(['harvest_id' => 'dataset-1'])) ->add(DatasetInfo::class, 'gather', ['latest_revision' => $info + ['distributions' => [$distribution]]]) ->add(PostImportResultFactory::class, 'initializeFromDistribution', $postImportResultMock) + ->add(UrlGenerator::class, 'generateFromRoute', 'http://example.com/node/1') ->getMock(); \Drupal::setContainer($container); $form = DashboardForm::create($container)->buildForm([], new FormState()); From 5104f28d0cff80569fd3a263ac655481351c1a94 Mon Sep 17 00:00:00 2001 From: Steve Wirt Date: Fri, 13 Feb 2026 12:53:58 -0500 Subject: [PATCH 4/5] Rework the output for admin and view --- modules/datastore/datastore.module | 1 - modules/datastore/src/Form/DashboardForm.php | 1 - ...datastore-dashboard-dataset-cell.html.twig | 17 ++++++------- .../tests/src/Unit/Form/DashboardFormTest.php | 25 +++++++++---------- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/modules/datastore/datastore.module b/modules/datastore/datastore.module index 7eb843932f..0b78c16bc4 100644 --- a/modules/datastore/datastore.module +++ b/modules/datastore/datastore.module @@ -15,7 +15,6 @@ function datastore_theme($existing, $type, $theme, $path) { 'uuid' => NULL, 'title' => NULL, 'url' => NULL, - 'node_url' => NULL, 'node_id' => NULL, ], ], diff --git a/modules/datastore/src/Form/DashboardForm.php b/modules/datastore/src/Form/DashboardForm.php index 44df5a505a..cdf905dd9a 100644 --- a/modules/datastore/src/Form/DashboardForm.php +++ b/modules/datastore/src/Form/DashboardForm.php @@ -511,7 +511,6 @@ protected function buildRevisionRow(array $rev, int $resourceCount, string $harv '#uuid' => $rev['uuid'], '#title' => $rev['title'], '#url' => Url::fromUri("internal:/dataset/$rev[uuid]"), - '#node_url' => Url::fromRoute('entity.node.canonical', ['node' => $rev['node_id']], ['absolute' => TRUE])->toString(), '#node_id' => $rev['node_id'], ], ], diff --git a/modules/datastore/templates/datastore-dashboard-dataset-cell.html.twig b/modules/datastore/templates/datastore-dashboard-dataset-cell.html.twig index 61be1cdd56..1b0912791d 100644 --- a/modules/datastore/templates/datastore-dashboard-dataset-cell.html.twig +++ b/modules/datastore/templates/datastore-dashboard-dataset-cell.html.twig @@ -1,9 +1,8 @@ -
{{ uuid }}
-
    -
  • - -
  • -
  • - -
  • -
+ +
{{ uuid }}
diff --git a/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php b/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php index 996f4f1816..3022db8e5d 100644 --- a/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php +++ b/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php @@ -2,37 +2,36 @@ namespace Drupal\Tests\datastore\Unit\Form; -use Drupal\common\DataResource; -use Drupal\common\DatasetInfo; -use Drupal\Core\Database\Connection; use Drupal\Core\Datetime\DateFormatter; use Drupal\Core\DependencyInjection\Container; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Entity\Query\QueryInterface; use Drupal\Core\Form\FormState; use Drupal\Core\Pager\Pager; use Drupal\Core\Pager\PagerManagerInterface; use Drupal\Core\Path\PathValidator; -use Drupal\Core\Routing\UrlGenerator; use Drupal\Core\StreamWrapper\PublicStream; use Drupal\Core\StreamWrapper\StreamWrapperManager; use Drupal\Core\StringTranslation\TranslationManager; +use Drupal\Tests\metastore\Unit\MetastoreServiceTest; +use Drupal\common\DatasetInfo; +use Drupal\Core\Database\Connection; use Drupal\datastore\Form\DashboardForm; -use Drupal\datastore\PostImportResult; -use Drupal\datastore\PostImportResultFactory; use Drupal\datastore\Service\PostImport; use Drupal\harvest\Entity\HarvestRunRepository; use Drupal\harvest\HarvestService; use Drupal\metastore\MetastoreService; -use Drupal\metastore\ResourceMapper; -use Drupal\node\NodeInterface; -use Drupal\Tests\metastore\Unit\MetastoreServiceTest; use MockChain\Chain; use MockChain\Options; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; +use Drupal\metastore\ResourceMapper; +use Drupal\datastore\PostImportResult; +use Drupal\datastore\PostImportResultFactory; +use Drupal\common\DataResource; +use Drupal\Core\Entity\EntityStorageInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\Entity\Query\QueryInterface; +use Drupal\node\NodeInterface; /** * @group dkan @@ -146,7 +145,6 @@ public function testBuildTableRowsWithHarvestIdFilter() { ->add(RequestStack::class, 'getCurrentRequest', new Request(['harvest_id' => 'dataset-1'])) ->add(DatasetInfo::class, 'gather', ['latest_revision' => $info + ['distributions' => [$distribution]]]) ->add(PostImportResultFactory::class, 'initializeFromDistribution', $postImportResultMock) - ->add(UrlGenerator::class, 'generateFromRoute', 'http://example.com/node/1') ->getMock(); \Drupal::setContainer($container); $form = DashboardForm::create($container)->buildForm([], new FormState()); @@ -326,6 +324,7 @@ public function testBuildTableRowsWithAllDatasets() { 'title' => 'Non-Harvest Dataset', 'modified_date_metadata' => '2019-08-12', 'modified_date_dkan' => '2021-07-08', + 'node_id' => 3, 'distributions' => [ [ 'distribution_uuid' => 'dist-2', From ecfc0a1c6fa2a5a14ff25869d26a4fd449b9570c Mon Sep 17 00:00:00 2001 From: Steve Wirt Date: Wed, 18 Feb 2026 16:34:19 -0500 Subject: [PATCH 5/5] Add assertions of node_id to tests. --- modules/datastore/tests/src/Unit/Form/DashboardFormTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php b/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php index 3022db8e5d..523b6a9b81 100644 --- a/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php +++ b/modules/datastore/tests/src/Unit/Form/DashboardFormTest.php @@ -155,6 +155,7 @@ public function testBuildTableRowsWithHarvestIdFilter() { $this->assertEquals('NEW', $form['table']['#rows'][0][2]['data']); $this->assertEquals('done', $form['table']['#rows'][0][6]['data']['#status']); $this->assertEquals(NULL, $form['table']['#rows'][0][6]['data']['#error']); + $this->assertEquals(1, $form['table']['#rows'][0][0]['data']['#node_id']); } /** @@ -224,6 +225,7 @@ public function testBuildTableRowsWithDatasetTitleFilter() { $this->assertEquals('NEW', $form['table']['#rows'][0][2]['data']); $this->assertEquals('done', $form['table']['#rows'][0][6]['data']['#status']); $this->assertEquals(NULL, $form['table']['#rows'][0][6]['data']['#error']); + $this->assertEquals(2, $form['table']['#rows'][0][0]['data']['#node_id']); } /** @@ -517,6 +519,7 @@ public function testBuildTableRowsWithUnsupportedResourceTypes() { $this->assertEquals('done', $form["table"]["#rows"][1][3]["data"]["#status"]); // The second row post import class is correct. $this->assertEquals('done', $form["table"]["#rows"][1][3]["class"]); + $this->assertEquals(5, $form['table']['#rows'][0][0]['data']['#node_id']); } /**