Skip to content

Release 3.36.0 - #414

Merged
adrianq merged 4 commits into
masterfrom
development
Aug 5, 2026
Merged

Release 3.36.0#414
adrianq merged 4 commits into
masterfrom
development

Conversation

@adrianq

@adrianq adrianq commented Aug 5, 2026

Copy link
Copy Markdown
Member

📌 References

  • Issue: Closes #
  • d2-api: Requires #
  • d2-ui-components: Requires #

📝 Implementation

🔥 Notes for the reviewer

📹 Screenshots/Screen capture

📑 Others

gqcorneby and others added 4 commits July 28, 2026 13:59
* feat(templates): add includeMetadataCodes flag for Code column

Per-template flag (default false) that adds a "Code" column after
"Metadata version" in the generated Metadata sheet, populated with
item.code. Additive: existing Metadata columns and the =_<id> defined
names are unchanged when off. Enables looking up option codes by name
from the Metadata sheet (e.g. for building composite identifiers).

Mirrors the generateMetadata wiring: entity -> TemplateWebRepository ->
DownloadTemplateUseCase -> SheetBuilder. Adds the first SheetBuilder
unit test covering the column on/off behaviour.

* feat(templates): include org unit code in metadata sheet

* test(templates): simplify sheetBuilder metadata specs
#409)

* feat(templates): add includeMetadataCodes flag for Code column

Per-template flag (default false) that adds a "Code" column after
"Metadata version" in the generated Metadata sheet, populated with
item.code. Additive: existing Metadata columns and the =_<id> defined
names are unchanged when off. Enables looking up option codes by name
from the Metadata sheet (e.g. for building composite identifiers).

Mirrors the generateMetadata wiring: entity -> TemplateWebRepository ->
DownloadTemplateUseCase -> SheetBuilder. Adds the first SheetBuilder
unit test covering the column on/off behaviour.

* feat(templates): include org unit code in metadata sheet

* test(templates): simplify sheetBuilder metadata specs

* feat(templates): add regenerate-metadata use case and CLI script

Regenerate only the Metadata sheet of a custom template from fresh DHIS2
metadata (with the Code column), leaving every other sheet — custom form,
dropdowns, VBA — untouched, so it can be refreshed without rebuilding the
whole template.

- SheetBuilder.generateMetadataOnly(): loads the input workbook, clears the
  Metadata sheet IN PLACE (not delete, so its codeName/VBA binding survives)
  and refills it via fillMetadataSheet with includeMetadataCodes on.
- Workbook.clear() and a cross-environment base64 loader/writer
  (fromBase64Data / writeToBase64) that work in both Node and the browser.
- RegenerateTemplateMetadataUseCase wired in CompositionRoot; reusable from
  the web app.
- src/scripts/regenerate-metadata.ts CLI (cmd-ts), same pattern as
  import-multiple-files.ts.
- Unit test covering the refresh + preservation of other sheets.

* chore(scripts): add yarn regenerate-metadata alias

Bakes in the ts-node --transpile-only --project src/scripts/tsconfig.json flags so the script runs with: yarn regenerate-metadata --dhis2-url ... --input ... --output ... --form-id ...

* chore(deps): bump @eyeseetea/d2-api to 1.21.0

* refactor(templates): dedupe metadata code-column writes

* feat(scripts): make metadata generation flags configurable

Expose the three SheetBuilder flags that affect Metadata-sheet output as
CLI flags on regenerate-metadata, instead of hardcoding them in the use
case: --include-codes (Code column), --use-codes (codes instead of names),
--org-unit-short-name (short vs regular OU name). All default off.
Other SheetBuilder params only affect full generate(), not metadata-only.

* docs(scripts): document regenerate-metadata CLI in README

* refactor(scripts): type form-type with oneOf instead of a cast

Use cmd-ts oneOf(dataFormTypes) so --form-type is validated at parse
time and the DataFormType cast at the call site disappears.

Also document why the use case imports Settings and SheetBuilder from
webapp/logic; fixing the layering needs a wider refactor.

* test(templates): cover Code column for org units

The Code column is written for org units too, but the fixture passed an
empty organisationUnits list so that branch was never exercised.

Addresses review feedback on #408.

* fix(utils): decode base64 without Buffer in getBlobFromBase64

Buffer does not exist in the browser bundle, so the helper threw
"Buffer is not defined" for any caller outside Node. It had no callers
until now, which is why this went unnoticed.

* refactor(utils): extract cleanFormula to utils/string

Shared by more than one use case now, so keep a single definition.

* refactor(webapp): extract shared TemplateDropzone component

The import page's drop area is now a component, so other screens can
reuse it instead of copying the render prop and its styles.

* feat(templates): resolve a template from an uploaded file

Identifies the template and its data form from the file alone, so a
caller does not have to ask the user which template it is.

AnalyzeTemplateUseCase resolves the same way but then reads every data
value, which is unnecessary when only the template is wanted.

* feat(settings): regenerate template metadata from the UI

Adds a Regenerate template metadata row to the Maintenance list. The
dropped file identifies the template, the generation flags are editable,
and the regenerated workbook is downloaded; nothing is persisted.

Until now this was only possible through the regenerate-metadata CLI,
which needs a checkout and DHIS2 credentials on the command line.

The Maintenance section moves out of SettingsFields into its own
component to host the new row.

* style(webapp): format import page mime type list

* refactor(templates): extract shared template resolution helpers

AnalyzeTemplateUseCase and ResolveTemplateFromFileUseCase opened with
the same load-template and resolve-data-form steps.

Kept as two helpers rather than one so the resolve use case can wrap
only the lookup in its friendly error, leaving the data form errors
distinct. Neither helper handles errors, so both use cases surface the
same messages as before.

Addresses review feedback on #409.

* refactor(webapp): move regenerate dialog logic to a hook

The dialog is now render-only; the drop handling, flags, regeneration
and dismissal guard live in useRegenerateMetadata, following the shape
of useMaintenanceCleanup.

Addresses review feedback on #409.

* chore(i18n): update catalogs after the hook and helper extraction

Moving strings between files reorders the extraction; msgmerge also
re-fuzzed one entry onto an unrelated translation, cleared here so it
falls back to English.
_.chunk was called without importing lodash, throwing ReferenceError
after the Vite migration when downloading the MSF custom template.
…-import

fix: add missing lodash import in MSF module metadata repo
@adrianq
adrianq merged commit 4daa648 into master Aug 5, 2026
19 checks passed
@bundlemon

bundlemon Bot commented Aug 5, 2026

Copy link
Copy Markdown

BundleMon

No change in files bundle size

Groups updated (1)
Status Path Size Limits
Build Folder
./**/*
1.74MB (+2.58KB +0.14%) +20%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

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.

2 participants