Skip to content

[MPDX-9693] - Add bulk actions menu to MPD Goal Admin table - #1980

Open
wjames111 wants to merge 9 commits into
mainfrom
MPDX-9693-bulk-actions
Open

[MPDX-9693] - Add bulk actions menu to MPD Goal Admin table#1980
wjames111 wants to merge 9 commits into
mainfrom
MPDX-9693-bulk-actions

Conversation

@wjames111

@wjames111 wjames111 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

  • Enables the previously-disabled More Actions button on the Active Goals admin table. It is always visible and disabled until at least one row is checked; opening it shows three items:
    • Print All — still inert (disabled) until printing is wired up in MPDX-9702; moved here from the toolbar.
    • Run & Send Selected — opens the existing run-and-send confirmation modal (with its skip-incomplete-goals handling) for the checked rows.
    • Assign Coach — opens the Assign Coach modal for the whole selection and applies the chosen coach to every checked row, shows a "Coach assigned successfully." toast, and clears the selection. The modal title shows the staff member's name for a single selection and "N Selected Staff" for multiple.
  • Run and Send All remains a standalone button; the toolbar no longer swaps buttons based on selection.
  • Runs on mock data, like the rest of the admin table: adds an assignCoach helper to MpdGoalAdminContext and a mockCoaches list. Real mutation wiring is MPDX-9914 (assignCoach) and MPDX-9912 (Run & Send).
  • Per the updated ticket scope (2026-07-14), there is no bulk Assign Coordinator — coordinators are read-only, derived from OneApp (MPDX-9688).

Related: MPDX-9693

Testing

  • Go to HR Tools → MPD Goal Admin (Active Goals tab)
  • Check that More Actions is visible but disabled while nothing is selected
  • Check one or more rows in the goals table
  • Click More Actions and choose Assign Coach; pick a coach and save
  • Check that the Coach column updates for every checked row, a success toast appears, and the selection clears
  • Check some rows again, choose Run & Send Selected from the menu, and confirm the existing run-and-send modal flow still works

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels (Add the label "Preview" to automatically create a preview environment)
  • I have run the Claude Code /quality:agent-review command locally and fixed any relevant suggestions
  • I have requested a review from another person on the project
  • I have tested my changes in preview or in staging
  • I have cleaned up my commit history

🤖 Generated with Claude Code

wjames111 and others added 2 commits August 12, 2026 13:55
Enables the More Actions menu when rows are selected, with Run & Send
Selected and Assign Coach (one coach applied to every checked row) on
mock data. Real mutation wiring lands in MPDX-9914/MPDX-9912.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
More Actions is now always visible and disabled until a row is checked,
with Print All (still inert until MPDX-9702), Run & Send Selected, and
Assign Coach as its items. Run and Send All stays a standalone button.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Bundle sizes [mpdx-react]

Compared against 5f0edc3

No significant changes found

@wjames111 wjames111 changed the title MPDX-9693 Add bulk actions menu to MPD Goal Admin table [MPDX-9693] - Add bulk actions menu to MPD Goal Admin table Aug 12, 2026
@wjames111 wjames111 self-assigned this Aug 12, 2026

@wjames111 wjames111 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Multi-Agent Code Review

Verdict: APPROVED WITH SUGGESTIONS — no blockers. 5 medium-priority improvements posted as line comments; lower-severity suggestions listed below. Risk LOW (blast radius 1, complexity 1, sensitivity 1, recoverability 0). Dependency analysis found no breaking changes — all fan-in stays inside the MpdGoalAdmin module.

5 specialized agents (Architecture, Testing, UX, Standards, Financial Reporting) reviewed the diff, then cross-examined each other's findings with a rebuttal round. Jest (51/51), eslint, and tsc were verified green on this checkout.

Suggestions (severity < 5.0 — informational, no /dismiss needed)

  • Nested t() composition (4.5)t('{{count}} Selected Staff') is interpolated into the modal's t('Assign Coach for {{name}}') (GoalsTableToolbar.tsx:165-169). Translators get two fragments they can't reorder/inflect. Consider a title override prop with one full sentence per case.
  • Missing cancel-path test (4.5) — nothing pins that closing AssignCoachModal leaves the selection and coaches untouched.
  • State naming (4.0) — with three modal-ish states in the file, modalOpen/modalTarget would read better as runAndSendOpen/runAndSendTarget.
  • JSDoc overpromise (4.0)assignCoach says "across all cohorts" but the selection model makes cross-cohort ids impossible (selection clears on cohort switch); soften the comment.
  • DynamicAssignCoachModal follow-up (3.5) — the written lazy-modal rule applies, but converting only this PR's import splits zero bytes because GoalsTable.tsx:25 (pre-existing, MPDX-9699) also statically imports the modal. A follow-up converting both call sites would actually split Formik+Yup out of the page chunk (template: sibling DynamicEditTrainingCostsModal.tsx).
  • Snapshot the assign target (3.5, latent)handleAssignCoach reads live selectedRows while the run-and-send path deliberately snapshots into modalTarget (see its comment). Harmless today (the dialog is focus-trapped), but becomes reachable once MPDX-9914 makes selection async. Apply the same snapshot idiom.
  • Silent !coach guard (3.5)GoalsTableToolbar.tsx:63-66 no-ops with no feedback; unreachable today (options and lookup share mockCoaches) but becomes a real silent-failure path when coaches come from a query.
  • Type placement (3.5)mockData.ts imports AssignCoachOption from a component; the feature's shared types live in mpdGoalAdminHelpers.ts.
  • Save-click guard (3.0) — the bulk-assign test clicks Save without the waitFor(() => expect(saveButton).toBeEnabled()) guard its sibling AssignCoachModal.test.tsx uses. Deterministic-green today (verified 5 consecutive runs); robustness nit.
  • Menu a11y polish (2.5) — optional: useId()-derived id + aria-controls + MenuListProps aria-labelledby, per CsvExportMenu.tsx. No written rule requires it and MassActionsDropdown ships without it.
  • Misc (3.0-3.5)aria-live="polite" on the {{count}} selected text; flexWrap: 'wrap' on the actions Box for xs viewports.

Debate notes (findings raised then withdrawn/refuted)

  • Translation key placement — withdrawn after empirical verification: the hand-placed keys match the catalog's actual sort (base-key localeCompare, plural suffixes grouped); this PR adds zero new sort inversions.
  • Success snackbar — withdrawn: every bulk action in the repo toasts on success, and with pagination the toast is the only feedback for off-page rows. The toast is correct here.
  • Print All gating — reduced to a labeling/scope question for MPDX-9702 (the item is inert in every selection state; repo mass-action precedent hides bulk menus entirely without a selection).

Findings on Related Files (Not in This PR)

These are informational — they do not count toward the verdict.

[Pre-existing] src/components/HrTools/MpdGoalAdmin/GoalsTable/GoalsTable.tsx:49assignableCoaches: AssignCoachOption[] = [] + no-op handler make the per-row Assign Coach modal impossible to complete (see the mockData.ts line comment for the full finding — the fix belongs there or in MPDX-9699/9914).

[Pre-existing] public/locales translation catalog'Assign Coach for {{name}}' and 'Select a coach' (from MPDX-9699 / #1897) were never added to translation.json, so the modal title renders untranslated in all locales.

[Pre-existing] GoalsTable.tsx:160,172 — "disabled until wired up (MPDX-9696)" cites the completed scaffolding ticket; these two controls (View/Edit link, row actions button) need forward-looking ticket refs like the ones this PR added.

[Pre-existing] RunAndSendModal usage — always-mounted with open={modalOpen} (GoalsTableToolbar.tsx:156-162), against the lazy-modal rule's "mount only while open" guidance; predates this PR.

Comment thread src/components/HrTools/MpdGoalAdmin/mockData.ts
Comment thread src/components/HrTools/MpdGoalAdmin/MpdGoalAdminContext.test.tsx Outdated
wjames111 and others added 7 commits August 12, 2026 15:57
…ckData.ts:6

Wire GoalsTable per-row Assign Coach to mockCoaches and the context assignCoach so the modal is completable

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…alsTableToolbar/GoalsTableToolbar.tsx:148

Demote 'Run and Send All' to outlined while rows are selected so only one contained CTA is on screen

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…alsTableToolbar/GoalsTableToolbar.test.tsx:81

Add test proving Run and Send All targets all filtered rows, not the selection

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…alsTableToolbar/GoalsTableToolbar.test.tsx:106

Add an overwrite warning to AssignCoachModal listing staff whose existing coach will be replaced, wired from the toolbar's bulk assign

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…dGoalAdminContext.test.tsx:86

Assert row-3's coach as the literal 'Nelson Jones' instead of comparing against the shared mockCohorts fixture, which the provider mutates by reference

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
user-event v13 calls are synchronous, and the repo rule is to never
await them; only the PR's files are touched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant