Skip to content

feat(console): lock the remaining role-gated actions instead of hiding them - #197

Merged
Bugs5382 merged 2 commits into
mainfrom
feat/196-more-role-gate-locks
Oct 15, 2026
Merged

Bugs5382 merged 2 commits into
mainfrom
feat/196-more-role-gate-locks

Conversation

@Bugs5382

Copy link
Copy Markdown
Contributor

What and why

Extends #194's lock pattern to the actions #196 lists that #183/#194 didn't cover:

  • components/profile-form.tsx: the edit form's Save (was a "Read-only -- editing profiles
    requires admin level" note).
  • components/node-chain-validate.tsx: Validate (was a "Read-only -- your operator level cannot
    validate a certificate chain" note).
  • components/node-image-lifecycle.tsx: Stage, Activate and Roll back (were hidden entirely for
    a non-admin).
  • pages/operators.tsx: Request credential, Record certificate, Deny, Complete and Cancel (all
    hidden entirely for a non-admin).
  • pages/adopt.tsx: the whole wizard used to be replaced by a one-line "requires admin level"
    notice; it now renders the real page with the endpoint field disabled and Preview locked, since
    nothing past Preview is reachable without it.
  • pages/root-detail.tsx: Rename (was hidden entirely for a non-admin).
  • components/node-detail-panel.tsx: Rename, Export key, Import key, Decommission and Reboot
    (all five were hidden entirely for a non-admin).
  • components/node-scep-challenges.tsx, components/node-scep-enrollments.tsx: mint/revoke and
    approve/reject (all hidden entirely for a viewer).

Every one of these now uses the kit's Button lockedReason prop, except operators.tsx's Deny,
Complete and Cancel, which are plain table-row buttons rather than the kit's Button -- those use
RoleGate instead, per #196's note. RoleGate needed a TooltipProvider the console had never
wired up (nothing in apps/console used Tooltip before this), so this adds one locally around
the Operators page, plus the ResizeObserver stub its Radix Tooltip content needs under jsdom,
mirroring the one the UI kit's own test setup already has for the same reason.

No route, permission check or server-side behaviour changes; this is presentation only, same as
#183 and #194.

Refs #196

Verification

  • Lint clean
  • Tests pass
  • Build succeeds
  • Documentation updated (if behavior or API changed)

How this was verified

  • npm run lint (eslint + prettier --check): clean.
  • npm run test across all workspaces: 788 console + 3 api-client + 247 ui tests pass, including
    the axe check on every page and component touched here.
  • npm run build across all workspaces: tsc + vite build succeed for console, tsc succeeds for ui.
  • node --test scripts/*.test.mjs and node scripts/check-release-bundle.mjs apps/console/dist:
    release bundle clean, no dev-only markers.
  • No behavior or API changed outside the presentation layer this issue covers, so there is no
    docs page to update beyond the kit's existing Button/RoleGate doc comments.

Before merging: add a closing comment summarizing what was actually done in this PR
(not just the checked boxes).

…g them

Extends #194's lock pattern to the actions it didn't cover: profile-form's
Save, node-chain-validate's Validate, node-image-lifecycle's Stage/Activate/
Roll back, operators' request/record/complete/cancel/deny, adopt's Preview
(the wizard's one entry point), root-detail's Rename, node-detail-panel's
Rename/Export key/Import key/Decommission/Reboot, and the SCEP challenge and
enrolment mint/revoke/approve/reject actions.

Every one of these was either hidden entirely for a role that lacks it, or
replaced by a disabled control or a "read-only"/"requires X level" note.
They now show the kit's Button lockedReason, or RoleGate for the few that
are plain table-row buttons rather than the kit's Button (operators' Deny,
Complete and Cancel) -- RoleGate needed a TooltipProvider the console had
never wired up for this purpose, so this adds one locally around the
Operators page, plus the ResizeObserver stub its Radix Tooltip content needs
under jsdom, mirroring the one the UI kit's own test setup already has.

Adopt's admin gate used to replace the whole page with a one-line notice;
it now renders the real wizard with its endpoint field disabled and its
Preview button locked, since nothing past Preview is reachable without it
anyway -- the same "no route or server behaviour changes" rule as the rest
of this pass.

Every test that asserted a hidden or disabled control for one of these now
asserts the locked aria-disabled/lockedReason state instead, named in each
with a short comment on why it moved, same as #194.

No route, permission check or server-side behaviour changes here either;
this is presentation only.

Refs #196

Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
@Bugs5382
Bugs5382 marked this pull request as ready for review October 15, 2026 20:58
@github-actions github-actions Bot added the enhancement New feature (feat). Minor version bump. label Oct 15, 2026
@Bugs5382
Bugs5382 enabled auto-merge (squash) October 15, 2026 23:35
@Bugs5382
Bugs5382 merged commit d2dbb82 into main Oct 15, 2026
9 checks passed
@Bugs5382
Bugs5382 deleted the feat/196-more-role-gate-locks branch October 15, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature (feat). Minor version bump.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant