Skip to content

feat: add drill-down filters for data table date and org unit columns [PR6] - #3736

Open
BRaimbault wants to merge 17 commits into
feat/datatable-pr5-more-layer-typesfrom
feat/datatable-pr6-new-filters
Open

BRaimbault wants to merge 17 commits into
feat/datatable-pr5-more-layer-typesfrom
feat/datatable-pr6-new-filters

Conversation

@BRaimbault

@BRaimbault BRaimbault commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Part of DHIS2-21456

Diff size note: this PR adds ~4,100 lines: ~1,800 are runtime code / ~2,300 (56%) are tests.

Description

Replaces the flat value-list filter with a hierarchical drill-down popover for date/time and org unit data table columns:

  • Date/time columns: filter by year → quarter/month → day → hour in an expandable tree, or type free text to match rows directly, same as before. "Any value"/"No value" pinned options carry over.
  • Org unit columns: same drill-down experience, but through the org unit hierarchy (country → region → district → facility). Ancestor names for the tree are resolved via a new useOrgUnitAncestorNames hook.
  • Both filters share a common useGroupFilterInput hook and GroupFilterPopover presentational component (extracted mid-PR from two near-duplicate implementations), plus a generic prefixTree.js utility for building/flattening/search-matching the tree.
  • Org-unit-rendered columns that stay on the plain (non-tree) filter dropdown now resolve to their breadcrumb/own-name label instead of the raw id/path, and free-text search against them is name-aware.
  • Sorting an org-unit-rendered column now sorts by the displayed name/breadcrumb rather than the raw path/id.

Also included, found while reworking org unit columns:

  • Org unit id/name/level/path columns unified into a consistent shape across layer types (previously per-layer-type field names like parentName/ouname).
  • Boolean-valued fields now render as Yes/No instead of raw true/false.
  • Tracked entity layers: option-set-coded attribute values now resolve to their display name (previously showed the raw code); createdAt/updatedAt exposed as columns.

Quality checklist

Add N/A to items that are not applicable.

  • Dashboard tested N/A (tests will be carried out on the entier PR stack)
  • Jest tests added/updated (Cypress tests will be added at the end)
  • Docs added N/A
  • d2-ci dependencies replaced N/A
  • Tester approved N/A (tests will be carried out on the entier PR stack)

Screenshots

supporting images

@BRaimbault BRaimbault changed the title Feat/datatable pr6 new filters feat: new filters [PR6] Jul 24, 2026
@dhis2-bot

Copy link
Copy Markdown
Contributor

🚀 Deployed on https://pr-3736.maps.netlify.dhis2.org

@dhis2-bot
dhis2-bot temporarily deployed to netlify July 24, 2026 18:37 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 25, 2026 12:58 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 25, 2026 13:16 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 25, 2026 13:32 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 25, 2026 14:51 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 25, 2026 19:32 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 27, 2026 08:52 Inactive
@BRaimbault
BRaimbault force-pushed the feat/datatable-pr6-new-filters branch from 5ad158e to ea5c6d8 Compare July 27, 2026 15:00
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 27, 2026 15:01 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 27, 2026 16:08 Inactive
@BRaimbault BRaimbault changed the title feat: new filters [PR6] feat: hierarchical drill-down filters for date/time and org unit columns [PR6] Jul 27, 2026
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 27, 2026 18:22 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 27, 2026 19:03 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify July 27, 2026 19:37 Inactive
@BRaimbault BRaimbault changed the title feat: hierarchical drill-down filters for date/time and org unit columns [PR6] feat: add drill-down filters for data table date and org unit columns [PR6] Jul 28, 2026
@BRaimbault
BRaimbault marked this pull request as ready for review August 4, 2026 15:22
@edoardo
edoardo force-pushed the feat/datatable-pr6-new-filters branch from 8c95a68 to 3f068fc Compare August 24, 2026 09:55
@dhis2-bot
dhis2-bot temporarily deployed to netlify August 24, 2026 09:57 Inactive

@HendrikThePendric HendrikThePendric left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some fundamental issues with the org-unit fetch side of this PR. Normally a path has the unit's own ID in it, but this PR seems to assume it stops at the parent.

Comment thread src/hooks/useOrgUnitAncestorNames.js
Comment thread src/util/map.js
@BRaimbault
BRaimbault force-pushed the feat/datatable-pr6-new-filters branch from 3f068fc to 5586866 Compare September 1, 2026 10:27
@dhis2-bot
dhis2-bot temporarily deployed to netlify September 1, 2026 10:29 Inactive
@BRaimbault
BRaimbault force-pushed the feat/datatable-pr6-new-filters branch from 5586866 to f225f4b Compare September 7, 2026 10:23
@dhis2-bot
dhis2-bot temporarily deployed to netlify September 7, 2026 10:27 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify September 7, 2026 13:27 Inactive
@BRaimbault

BRaimbault commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for your review @HendrikThePendric, I addressed your specific comments and marked them as resolved. The map.js one turned out to be a geoFeatures API quirk rather than a bug, explained in the thread. The useOrgUnitAncestorNames.js one was a real inefficiency, fixed by reusing buildKnownOrgUnitNames from PR7 (#3648).

@BRaimbault
BRaimbault removed this pull request from stack #3735 September 9, 2026 08:34
@BRaimbault
BRaimbault added this pull request to stack #3765 September 9, 2026 08:34
@BRaimbault
BRaimbault force-pushed the feat/datatable-pr6-new-filters branch from 67dc16f to 74c21ee Compare September 9, 2026 08:36
@dhis2-bot
dhis2-bot temporarily deployed to netlify September 9, 2026 08:38 Inactive
Same drift as prior rebases: the merge driver's timestamp-only
resolutions left message entries stale relative to the merged source.
Re-run the extraction to bring it back in sync.
useOrgUnitAncestorNames flattened every ancestor id out of every org
unit path and fetched a name for all of them, including a row's own
org unit (already have its name) and its immediate parent (already
have parentName) - for a facility layer, that's the vast majority of
the distinct-id set, since self+immediate-parent dominate a typical
many-leaves/few-ancestors hierarchy.

Seed idToName from data already in memory via buildKnownOrgUnitNames,
and only fetch what's still missing. Also add a module-level session
cache so a name fetched once is never re-fetched for the rest of the
session, even across unrelated table views.

Safe for event/tracked-entity layers without any special-casing:
attachOrgUnitPaths never sets name/parentName on those rows, and an
event/entity's own id never collides with an org-unit id actually
being looked up, so buildKnownOrgUnitNames naturally contributes
nothing for them - confirmed by its own test coverage.
@BRaimbault
BRaimbault force-pushed the feat/datatable-pr6-new-filters branch from 74c21ee to 589879e Compare September 10, 2026 12:49
@sonarqubecloud

Copy link
Copy Markdown

@dhis2-bot
dhis2-bot temporarily deployed to netlify September 10, 2026 12:52 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants