Skip to content

Add dkan_datastore_preview datastore submodule - #4784

Draft
dcgoodwin2112 wants to merge 2 commits into
4.xfrom
dkan-datastore-preview-submodule
Draft

Add dkan_datastore_preview datastore submodule#4784
dcgoodwin2112 wants to merge 2 commits into
4.xfrom
dkan-datastore-preview-submodule

Conversation

@dcgoodwin2112

@dcgoodwin2112 dcgoodwin2112 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes [issue#]

Describe your changes

Adds dkan_datastore_preview, a submodule of dkan_datastore that renders a paginated, sortable HTML table of datastore data for each CSV/TSV distribution on the server-rendered dataset page (/node/{nid}). MVP scope from the ticket: find the datastore table and display it in the dkan_metastore twig template; the block and a configurable data-source plugin system are follow-ups.

  • DataSourceInterface + DatabaseDataSource (seam for a future plugin system), DataPreviewBuilder, dkan_datastore_preview render element, ImportStatusMessage
  • Server-rendered only: sort links and page-size form use per-table prefixed query params (dp0_order, dp1_page_size, …) so multiple previews on one page don't share state; no JavaScript
  • Shows a status message instead of nothing when a resource isn't imported yet; distribution cache tags flip it to the table after import without a cache rebuild
  • node--data.html.twig prints {{ content.data_preview }} (empty when the module is disabled; dkan_metastore gains no dependency on dkan_datastore)
  • ddev dkan-site-install enables the module

QA Steps

Prerequisite: a dataset with one imported CSV distribution (drush dkan:datastore:list shows done), enough rows to page (more than 25).

  • drush en dkan_datastore_preview, then open the dataset's node page (/node/{nid}, not the React /dataset/{uuid} page). A captioned preview table renders below Downloads with "Showing 1-25 of N results".
  • Click a column header. URL gains dp0_order/dp0_sort, the header gets aria-sort, rows re-sort. Click again to reverse.
  • Set page size 10 and Apply. "Showing 1-10 of N", a pager appears, and pager links keep dp0_page_size=10.
  • Open a dataset whose distributions are not CSV/TSV (or has none). No preview section, no errors in drush watchdog:show.
  • drush dkan:datastore:drop <identifier> (identifier from drush dkan:datastore:list), drush cr, reload: "Data preview is not yet available…" message instead of the table.
  • drush dkan:datastore:import <identifier> && drush queue:run datastore_import, reload without drush cr: the table is back.
  • drush pmu dkan_datastore_preview, reload: page renders normally with no preview and no errors.

Checklist before requesting review

If any of these are left unchecked, please provide an explanation

  • I have updated or added tests to cover my code
  • I have updated or added documentation — no module README yet; will add with the block/plugin follow-up unless reviewers want it here

Co-authored by: Github Copilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant