Commit 3796e9d
authored
improvement(access-control): edit group details, filter by status, and colocate chat deploy auth (#5902)
* improvement(access-control): editable group details, status filters, block tooltips, chat auth colocation
- General tab gains editable Name and Description fields wired into the
existing dirty buffer, so the header Save/Discard chips and the
unsaved-changes guard cover them. Save only sends changed fields and
surfaces the route's duplicate-name 409.
- Blocks, Model Providers, and Platform tabs gain an All/Enabled/Disabled
filter beside their search field, evaluated against the editing buffer.
- Every block row carries an Info badge with the block's description. The
badge sits outside the label/expand button so it never toggles the row.
- The chat deploy toggle moves out of Deploy Tabs into the Chat section
alongside its allowed-auth-modes dropdown, mirroring the Files section.
* improvement(access-control): polish group detail filters, tooltips, and details fields
Follows the cleanup review:
- reconcile the post-save baseline from the server response instead of
local values, matching the scope/default writes
- pin the status-filter dropdown width so the search field stops resizing
- restore flex-1 on the block-name button and move the row hover surface
to the wrapper so Info badges align in a column
- add empty states for filter-empty lists and neutralize Select All there
- surface a 'Name is required' message next to the disabled Save
- align hint text on the field-hint tokens and drop a redundant TSDoc
* refactor(access-control): keep chat and files toggles in the platform registry
The first pass pulled hideDeployChatbot out of the declarative platformFeatures
array and hand-rolled a Chat section beside the existing bespoke Files one. That
forfeited search, status filtering, Select All, category grouping and the Info
hint, and the replacement platformSectionVisible re-implemented two of those
with different semantics — searching 'deploy' or 'deployment' hid the very
control named Deployment, and Select All silently skipped both toggles.
Both toggles are now ordinary registry entries under their own Chat and Files
categories, with an id-keyed featureExtras map supplying the nested auth-mode
dropdown. Search, filtering, Select All, hints and the empty state are correct
by construction, and the parallel filter pipeline is gone.
Also from the review:
- index the allow-lists into Sets so per-row membership checks are O(1)
- split the search and status passes so the common 'all' filter returns the
searched list by reference and a checkbox toggle no longer re-sorts ~180 rows
- extract StatusFilterChip and AuthModeField instead of stamping out the
dropdowns three and two times
- derive nameChanged/descriptionChanged once instead of repeating the
comparisons in the save payload
- lock the config key-order invariant the dirty check depends on with a test
* polish(access-control): apply the second cleanup round
- indent the nested auth-mode field so it lines up under its toggle's label
instead of reading as a sibling row, and label the dropdown for screen readers
- order Chat right after Deploy Tabs so the three deploy targets stay adjacent
- flush the trailing Select All chips on the providers and platform rows
- drop the doubled margin on the name error (SettingRow already gaps it)
- hoist PLATFORM_FEATURES and PLATFORM_CATEGORY_ORDER to module scope
- drop the useCallback on the two save/discard handlers; nothing observes their
identity and their deps changed on every keystroke anyway
- fix a comment that still pointed at a 'Hide Chat' toggle that no longer exists
* fix(access-control): keep the block disclosure chevron inside its toggle button
Splitting the chevron out so the Info badge could sit beside the name left the
chevron with no click handler — the visible expansion affordance did nothing.
It goes back inside the button; Info stays outside it, since an Info trigger is
itself a button and cannot nest.
* chore(access-control): use structuredClone in the config key-order test
check:utils bans JSON.parse(JSON.stringify(...)). The clone only needs to hand
the schema a distinct object; structuredClone preserves key order the same way.
* fix(access-control): trim descriptions so a padded value can't wedge the form
descriptionChanged compared a trimmed draft against the raw saved description,
so a group whose stored description carried padding opened dirty and could
never be cleared — Discard restored the same padded string, and the
unsaved-changes guard then blocked navigation until a save rewrote it.
The contract now trims description on create and update, matching what name
already did, and the dirty check trims both sides so existing padded rows
behave too.
* improvement(access-control): seed the description buffer trimmed
Keeps the editing buffer and the dirty baseline normalized the same way, so a
legacy row with padding no longer shows stray whitespace in the input and the
buffer never round-trips padding a save would strip anyway.
* fix(emcn): forward aria-label/aria-labelledby from ChipDropdown to its trigger
ChipDropdown destructures only its known props, so an aria-labelledby passed by
a consumer never reached the trigger button — AuthModeField's wiring to its
visible label was silently dropped and the control had no accessible name.
Both attributes are now explicit, typed props forwarded to the trigger. Kept as
two named props rather than a rest spread so the component still owns its
chrome and consumers can't smuggle arbitrary attributes onto the button.
* fix(access-control): correct the nested field indent, platform row hover, and aria name
- aria-labelledby REPLACES the content-derived name, so naming the auth-mode
dropdown with its caption alone dropped the selected value from the accessible
name — worse than no attribute. It now references caption + trigger, which
needed ChipDropdown to forward id as well.
- The nested field's pl-[30px] assumed a 14px checkbox; the default is 16px, so
the caption sat 2px left of the label it hangs under while the dropdown (not
flush, so mx-0.5) sat at 32. Both are pl-8 + flush now.
- Platform feature rows kept their hover surface on the label, so the highlight
stopped 20px short of the row edge while the Blocks tab ran flush. Moved to
the wrapper, matching the core-blocks cell.
- Split the platform search and status passes like the provider and block lists,
so a toggle no longer recomputes three chained memos.
- Dropped an unreachable allLabel and a comment that would go stale on merge.
* fix(access-control): trim the name comparison the same way as description
nameChanged compared a trimmed buffer against an untrimmed baseline — the exact
asymmetry already fixed for description. A group stored before the name schema
gained .trim() opens permanently dirty: Save/Discard visible and the
unsaved-changes modal firing on back, until a save rewrites it.
Both buffers now seed trimmed and compare trimmed on both sides. Also dims the
Info badge along with the row it belongs to when the block is disallowed.1 parent 6f90d89 commit 3796e9d
4 files changed
Lines changed: 563 additions & 290 deletions
File tree
- apps/sim
- ee/access-control/components
- lib/api/contracts
- packages/emcn/src/components/chip-dropdown
0 commit comments