dashboard: single save-all button for the permissions page
Replace the per-row save buttons on the P3RM1SS10NS tab with one
page-level "save all (N agents)" button covering both the capabilities
and tool-groups matrices.
Toggling cells stages edits in the DOM; each checkbox carries its
render-time baseline (data-baseline). On save we diff against the
baseline and POST only the perm-types that actually changed per agent
to the new combined endpoint:
POST /api/permissions { changes: [ { agent, tool_groups?, capabilities? } ] }
An omitted field leaves that perm-type untouched (no commit, no diff);
an included array fully replaces it. The backend coalesces caps + groups
for one agent into a single rebuild — no more double-rebuild when an
operator changes both for the same agent. The batch is atomic: on a
clean 200 the bar shows queued -> rebuilding and re-fetches (resetting
baselines); on any validation error nothing is applied and an error note
is shown.
Live capabilities_changed / tool_groups_changed re-renders are skipped
while the section has unsaved edits so a half-finished edit set is not
clobbered; the tab-activation and post-save re-fetches are the recovery
paths.
Pairs with the hive-c0re combined-PermPayload half (damocles).
This commit is contained in:
parent
df96c21b0c
commit
4297436d94
4 changed files with 208 additions and 91 deletions
|
|
@ -153,22 +153,36 @@
|
|||
role="tabpanel" aria-labelledby="tab-permissions">
|
||||
<h2>◆ C4P4B1L1T13S ◆</h2>
|
||||
<div class="divider">══════════════════════════════════════════════════════════════</div>
|
||||
<p class="meta">per-agent capability grants. capabilities unlock gated MCP tools and system access. saving queues a rebuild for the affected agent.</p>
|
||||
<p class="meta">per-agent capability grants. capabilities unlock gated MCP tools and system access. toggle any cells across both tables, then hit "save all" at the bottom — each changed agent rebuilds exactly once.</p>
|
||||
<div id="capabilities-section">
|
||||
<p class="meta">loading…</p>
|
||||
</div>
|
||||
|
||||
<!-- T00L GR0UPS: per-agent tool-group permission matrix. Rows = agents,
|
||||
cols = tool groups fetched from GET /api/tool-groups.
|
||||
Checking / unchecking and saving POSTs to
|
||||
/api/tool-groups/{agent}; a rebuild is queued automatically.
|
||||
Checking / unchecking is staged in the UI; the single page-level
|
||||
"save all" button POSTs every changed agent to
|
||||
/api/permissions in one atomic batch, coalescing caps + groups
|
||||
per agent into one rebuild each.
|
||||
Absent agents default to the role default (shown in parens). -->
|
||||
<h2>◆ T00L GR0UPS ◆</h2>
|
||||
<div class="divider">══════════════════════════════════════════════════════════════</div>
|
||||
<p class="meta">per-agent tool-group permissions. columns are filled from the backend — adding a new group requires no UI change. agents without an explicit entry use the role default (agents: messaging, meta, inbox, execution; manager: all). saving queues a rebuild.</p>
|
||||
<p class="meta">per-agent tool-group permissions. columns are filled from the backend — adding a new group requires no UI change. agents without an explicit entry use the role default (agents: messaging, meta, inbox, execution).</p>
|
||||
<div id="tool-groups-section">
|
||||
<p class="meta">loading…</p>
|
||||
</div>
|
||||
|
||||
<!-- Page-level save bar (save-all issue): one button for the whole
|
||||
permissions page. Staged checkbox edits across BOTH matrices are
|
||||
diffed against their render-time baselines and POSTed together to
|
||||
/api/permissions; caps + groups for one agent coalesce into a
|
||||
single rebuild. Disabled until something is dirty. The atomic
|
||||
batch either fully lands (queued ✓ → rebuilding) or fully fails
|
||||
(error note, nothing applied). -->
|
||||
<div class="perm-save-bar">
|
||||
<button type="button" id="perm-save-all" class="btn btn-approve" disabled>save all</button>
|
||||
<span id="perm-save-note" class="meta"></span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- SCH3DUL3S: scheduled prompts. Creation + edit are folded
|
||||
|
|
|
|||
Loading…
Reference in a new issue