Skip to content

[MSF-OCBA] Hide greyed columns, "Fill with zeros", plugin "app" mode#4

Open
adrianq wants to merge 30 commits into
deploy/ocbafrom
develop-ocba
Open

[MSF-OCBA] Hide greyed columns, "Fill with zeros", plugin "app" mode#4
adrianq wants to merge 30 commits into
deploy/ocbafrom
develop-ocba

Conversation

@adrianq
Copy link
Copy Markdown
Member

@adrianq adrianq commented Mar 2, 2026

Closes https://app.clickup.com/t/869chqpuc

Summary

OCBA customizations on top of the latest stable.

Bundles three changes previously merged via internal PRs #2 and #3, plus additional refinements and a new plugin mode that lets a host app embed this one as a plugin with configurable UI:

  • Hide greyed columns (ClickUp 869c2p9q2): when every cell in a category option combo column is marked as a greyed field, the column is hidden from the section table. Hidden cells are still included in row totals and column totals sums.
  • "Fill with zeros" button (ClickUp 869c2p9q2): adds a per-section button that bulk-fills empty numeric cells with 0. Respects greyed fields, closed org units, and locked periods.
  • Error handling on dataValue save: surfaces a user-facing error ("Error occurred while saving dataValues") when the bulk update fails, and avoids restoring old values for non-numeric data elements.
  • Plugin "app" mode: the existing legacy-custom-forms plugin entry now dispatches on a mode prop. mode: "custom-form" (default) behaves exactly as before; mode: "app" renders the entire Data Entry app as a plugin, wrapped in a new PluginOptionsContext so the host can pass flags to hide specific UI:
    • hideDataSetSelector
    • hideTabSectionSelector
    • hideClearSelectionsButton
    • hideFilterField

Also includes:

  • .nvmrc pinning Node 20
  • Version bump to UPSTREAM-VERSION-ocba-1

Test plan

  • Open a section with a category combo where all cells in one column are greyed — column should be hidden, and its greyed values should still be summed into row/column totals.
  • Open a section with all columns greyed — no input cells should render.
  • Click "Fill with zeros" on a numeric section; empty cells become 0; greyed cells and non-numeric data elements are left untouched.
  • "Fill with zeros" is disabled / no-ops on closed org units or locked periods.
  • Simulate a failing bulk save (e.g. network error) and confirm the error message is shown to the user.
  • yarn test passes (new tests under category-combo-table-body/ and section-form/).
  • Load plugin.html without props — falls through to legacy custom-forms flow (non-breaking default).
  • Load plugin.html with mode=app from a host app; confirm app mounts and each hide* flag hides the corresponding UI (data set selector, section tabs, clear selections button, filter field).

@tokland
Copy link
Copy Markdown

tokland commented Mar 25, 2026

While testing for vacci-app v42, I noticed that it works as expected when there are data elements with different disaggregation, only that it shows a bunch of narrow greyed columns on some rows. Nothing serious, but just to keep in the radar.

image

@tokland tokland changed the title Develop ocba [MSF-OCBA] ... Apr 21, 2026
@tokland tokland changed the title [MSF-OCBA] ... [MSF-OCBA] Hide greyed columns, "Fill with zeros" button, dataValues error handling Apr 21, 2026
@tokland tokland changed the title [MSF-OCBA] Hide greyed columns, "Fill with zeros" button, dataValues error handling [MSF-OCBA] Hide greyed columns + "Fill with zeros" button Apr 21, 2026
@tokland tokland changed the base branch from 101.1.6 to deploy/ocba April 21, 2026 12:00
Introduces a new plugin mode so hosts can embed the whole app as a
plugin (not just legacy custom forms) and toggle visibility of
selected UI via host-passed props (hideDataSetSelector,
hideTabSectionSelector, hideClearSelectionsButton, hideFilterField).

- main.jsx: plugin entry dispatching on `mode` to either the original
  LegacyCustomFormPlugin (default) or the new AppPlugin
- app-plugin.jsx: mounts AppWrapper inside PluginOptionsContext.Provider
- shared/plugin-options: context + hook for consumers
- Consumers gate rendering on the corresponding flag

index.jsx (LegacyCustomFormPlugin) is left pristine for upstream parity.
@tokland tokland changed the title [MSF-OCBA] Hide greyed columns + "Fill with zeros" button [MSF-OCBA] Hide greyed columns, "Fill with zeros", plugin "app" mode Apr 22, 2026
@tokland
Copy link
Copy Markdown

tokland commented May 20, 2026

https://app.clickup.com/t/869cc53p4?comment=90120217168958

Tomàs: I am testing the vacci app in 42, so far it works well. I want to inform you that they have released a new version of data entry app v102.0.4 that fixes this bug IssueJira Issue. It would be nice have the data entry custom app in this version.

The latest stable 102.0.6 has some additional fixes ("use gregorian calendar for iso to handle chrome bug" + "dedupe dhis2-ui"), let's always go to latest stable unless some specific problem is detected.

  • Reproduce the bug in our 102.0.2-ocba-1
  • Merge v102.0.6
  • Check that the bug is not present
  • Check that our features work

…ptions

- Hide periods not listed in dataSet.dataInputPeriods (when the list is non-empty)
- Hide periods where any category in the categoryCombo has no selectable option for the selected orgUnit and period date range
@tokland
Copy link
Copy Markdown

tokland commented May 20, 2026

Period selector filtering

The period selector now filters out periods that would result in a blocked form:

  1. dataInputPeriods filter — if the dataset defines a non-empty dataInputPeriods list, only those specific periods are shown. All others are hidden.

  2. Category options filter — for datasets with a non-default categoryCombo, a period is only shown if every category has at least one selectable option for the selected org unit and that period's date range (reuses the existing getCategoriesWithOptionsWithinPeriodWithOrgUnit selector). If no org unit is selected yet, this filter is skipped.

Both filters are applied in sequence in the period dropdown — no changes to any other part of the app.

When a dataset is selected, only show org units assigned to it (plus
their parent chain) in the tree selector. Text search is intersected
with the dataset filter when both are active.
@tokland
Copy link
Copy Markdown

tokland commented May 21, 2026

Filter org unit tree by dataset-assigned org units

When a dataset is selected, the org unit selector now only shows org units assigned to that dataset, plus their full parent chain (so the tree remains navigable from the root). Previously, all org units were shown regardless of dataset assignment.

  • Added useDataSetOrgUnitPaths to fetch the dataset's assigned org unit paths
  • Added useTreeFilterPaths hook (same file) that computes the effective tree filter: dataset paths only, search-result paths only, or their intersection when both are active
  • Loading and error states from the dataset paths fetch are now surfaced in the selector UI

tokland added 4 commits May 21, 2026 10:21
Exposes the dataset org unit filtering as an opt-in plugin option.
When set, the org unit tree only shows org units assigned to the
selected dataset (plus their parent chain).
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.

8 participants