Optional intermediate approval step gating the final Approve#12
Open
Ramon-Jimenez wants to merge 1 commit intomasterfrom
Open
Optional intermediate approval step gating the final Approve#12Ramon-Jimenez wants to merge 1 commit intomasterfrom
Ramon-Jimenez wants to merge 1 commit intomasterfrom
Conversation
Datasets can now require an intermediate approval before the final Approve action becomes available. The new step is fully opt-in per dataset configuration and leaves existing workflows unchanged when the flag is off. Configuration (per dataset): - New "Intermediate approval required" checkbox on the dataset config form. - New "Intermediate Approve DataElement" selector, disabled until the flag is on. Must point at a Yes/No data element in the approval (APVD) dataset; its value is written with the default COC per orgUnit/period by the new actions. - New "Intermediate Approve" permission group, listing the users and user groups that can run the new actions (super-admins bypass as with every other action). List column: - New "Intermediate approval status" column, hidden by default — can be shown via the gear icon. Renders "Approved", "Not approved", or "N/A" when the flag is off for that dataset. - The displayed status is *derivational*: effective = stored Yes AND modificationCount == 0. If the source data is edited after an intermediate approval, the column automatically flips back to "Not approved" and the final Approve action is gated off — without any side-effect writes to the stored data element. Contextual actions: - "Intermediate Approve" and "Intermediate Unapprove" appear on rows where the flag is on and the user has permission. Both support multi-select. - The existing "Approve" action is hidden when any selected row has effective intermediate status != approved. This covers the single-row case (hidden) and the multi-select-with-partial case (hidden entirely). - "Revoke" on a dataset with intermediate approval also writes "false" to the intermediate data element, so the approval chain must be replayed from scratch after a revoke. Data layer: - New setIntermediateApproval / getIntermediateApproval repository methods. Reads are joined in GetMalDataSetsUseCase per item via /dataValueSets (same shape as the existing per-item diff query); writes go through UpdateMalApprovalStatusUseCase with two new actions (intermediateApprove, intermediateUnapprove). - DataSetConfiguration gains intermediateApprovalRequired and intermediateApproveCode attrs and a new "intermediateApprove" action in dataSetConfigurationActions. A withDefaults helper keeps older stored configs backward-compatible by falling back to empty permissions and an unset flag. Docs: - New docs/data-approval-user-guide.md covering the full app and the intermediate-approval feature (list column, gating, permission group, configuration, Revoke cascade). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Add an opt-in intermediate approval step per dataset. When enabled, a dataset requires an "Intermediate Approve" action to land before the existing final Approve action becomes available. When the flag is off, nothing changes — all existing workflows behave exactly as before.
Recorded decisions (all confirmed with the requester before implementation):
intermediateApprovalRequired: booleanandintermediateApproveCode: stringfields onDataSetConfiguration. The code points at a Yes/No data element in the approval (APVD) dataset. The new actions write"true"/"false"to that data element with the default COC per (orgUnit, period), matching the existing Submit flow./dataValueSetscall per item is joined in GetMalDataSetsUseCase (SQL views untouched, per the option (b) we agreed on).effective = stored Yes AND modificationCount == 0. If the source data is edited after an intermediate approval, the list automatically shows Not approved and gates the final Approve action — no side-effect writes to the server.What's in the PR
Configuration (DataSetConfigForm.tsx, DataSetConfiguration.ts)
List column (useDataApprovalListColumns.tsx)
View model derivation (DataApprovalViewModel.ts)
Row actions (useActiveDataApprovalActions.tsx, useDataApprovalActions.tsx, DataApprovalList.tsx)
Data layer (MalDataApprovalRepository.ts, MalDataApprovalDefaultRepository.ts, UpdateMalApprovalStatusUseCase.ts, GetMalDataSetsUseCase.ts)
Docs (docs/data-approval-user-guide.md)
Test plan
Known limitations
🤖 Generated with Claude Code