Repository navigation
feat: visualization titles and filter line - #390
Merged
HendrikThePendric merged 36 commits intoOct 9, 2026
Merged
Conversation
Contributor
|
🚀 Deployed on https://pr-390.event-visualizer.netlify.dhis2.org |
HendrikThePendric
force-pushed
the
feat/visualization-title-and-filter-line
branch
from
October 1, 2026 13:48
f26be52 to
7097dc0
Compare
…known Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hook spec now runs against the real condition logic instead of mocking each helper, since calls inside one module can't be intercepted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…missing name Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… back The spec defines no generic fallback for tracked entity titles, and the metadata store guarantees a name for any type it holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also drops the name and dimensionId fallbacks in toLayoutDimension, which the metadata store already guarantees. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only a git dependency's install left test files in the store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the items-or-conditions choice out of the chip tooltip into a pure getDimensionValueTexts, and adds a pure getSuffixContext and getDimensionLabel. The tooltip and the line list headers now use them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deriving layout, items and conditions with getVisualizationUiConfig applies the enrollment org unit rename, so enrollment org unit filters are named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Legacy visualizations infer it from the subtitle on load, alongside hideTitle, and this app now saves it as hidden whenever the subtitle is empty, since there is no generated subtitle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HendrikThePendric
force-pushed
the
feat/visualization-title-and-filter-line
branch
from
October 6, 2026 12:50
df23b32 to
333fa46
Compare
edoardo
previously approved these changes
Oct 8, 2026
…title-and-filter-line # Conflicts: # src/hooks/__tests__/use-conditions-texts.spec.ts # src/hooks/use-conditions-texts.ts
|
edoardo
approved these changes
Oct 9, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Implements DHIS2-22147
Description
Implements the IDV title and filter line spec:
Title
Replaces the plain title input with Auto generated / None / Custom.
These three modes are derived from the
titleandhideTitlefields on the visualization object:hideTitle: trueis Nonetitleis CustomhideTitle: falsewith an empty/missingtitleis AutoThe Auto title follows the spec's label precedence: a plural custom label as-is, else a singular one as "{label} count" (PT) or "{label} list" (LL), else "Events"/"Enrollments". Tracked entities use the type's plural label, else its name. On a PT a custom value replaces this with
itemName · aggregationDisplayName. The plural labels weren't fetched before, sogetProgramFieldsandgetTrackedEntityTypeFieldsnow request them. Changing the visualization type resets the title to Auto.The new
Titlecomponent in the options modal keeps the custom text in component state, even when the mode switches to auto/none. This lets a typed title survive toggling between modes while the Style tab is open and be discarded when it closes.The spec asks for existing visualizations with no title to keep showing none rather than suddenly gaining a generated one. We cannot rely on
hideTitlefor this, since on these visualizations it is alwaysfalse. The old apps did not use generated titles and completely ignored thehideTitlefield both when reading and writing. In DHIS2 Core it is a primitive boolean, so a visualization that never set it comes back withfalse. These old visualizations are marked aslegacyas they are received, so we already have a good way to identify them. For these we infer the correct value ofhideTitle:titleis missing/empty thenhideTitleshould betruetitleis populated thenhideTitleshould befalseSubtitle
Even though there was technically no need to make any changes to how we work with subtitle, I decided to align this with title:
hideSubtitlefield value fromsubtitle, same as we do for titlehideSubtitlefield. Ifsubtitleis empty/missing it getstrue, if populated, it getsfalseThe outcome is that we can now make a very clear and simple distinction:
hideTitleandhideSubtitleFilter line
First some context to explain how I landed on the current approach:
Based on the observations above, I decided the optimal solution should:
filterTextprop to thePivotTablethat can be used instead of the internally generated one, which this replaces for IDV PTs (added in@dhis2/analytics29.8.0).To allow code sharing between the chips/tooltips and the filter-text, the existing code needed to be restructured significantly. The problem was that it lived inside React hooks, and those hooks read their input from the Redux store, which the dashboard plugin isn't allowed to use. So reusing it took two steps:
visUiConfigandgetVisualizationUiConfigalready derives that exact shape from a visualization. So the filter line calls it and from there works with the same data the layout panel has. In both, names come from the metadata store.Details of this restructuring
getConditionsMetadataIdsandgetConditionsTextsin@modules/conditions, out ofuseConditionsTexts@modules/dimension/item-names.ts, out ofuseTooltipContentData@modules/dimension/layout-dimension.ts— the metadata item →LayoutDimensionmapping, out ofuseDimensionsWithSuffixesisItemBasedDimensionTypein@modules/dimension/dimension-type.ts— the rule for whether a dimension is described by its items or its conditions, out of the tooltip component@modules/dimension/value-texts.ts— applies that rule and calls the helpers above; this is what both the tooltip and the filter line callgetSuffixContextandgetDimensionLabelin@modules/dimension/suffix.ts, now shared by the line list headers and the filter lineQuality checklist
Screenshots
The title control, with Custom selected

A generated title and a filter line on a line list

🤖 Generated with Claude Code | Edited (heavily) by @HendrikThePendric