dashboard: show and edit per-agent resource limits in core LOAD tab
Adds CPU/memory cap columns and an inline edit form to the container-load
table in /core.html, backed by a new POST /api/resource-limits/{name}
dashboard endpoint.
## Backend (hive-c0re)
lifecycle_ops.rs — new post_resource_limits handler:
- Parses ResourceLimitsForm { cpu_quota, memory_max } (both optional; empty
string = clear override, fall back to hive-wide default).
- Validates each non-empty value via resource_limits::validate_cpu_quota /
validate_memory_max — returns 422 UNPROCESSABLE_ENTITY with a human-
readable message on invalid input so the dashboard can surface it inline.
- Calls meta::commit_resource_limits (staged git write under META_LOCK, same
as hivectl set-limits).
- Re-applies the drop-in immediately via lifecycle::write_dropins so the new
ceilings take effect on the next container start without waiting for a
rebuild.
- Triggers rescan_containers_and_emit so ContainerView.cpu_quota/memory_max
update via SSE without waiting for the next periodic sweep.
dashboard/mod.rs — registers the route:
POST /api/resource-limits/{name}
## Frontend (core.js + system-sections.css)
core.js:
- containersState derived from /api/state snapshot alongside tombstonesState
— supplies configured cpu_quota/memory_max to the LOAD table.
- lastLoadRows stash lets SSE-triggered re-renders call renderContainerLoad
without waiting for the next 5s poll.
- renderContainerLoad: adds cpu cap / mem cap columns (muted; tooltip
'configured ceiling — takes effect on next start') sourced from
ContainerView, plus a per-row S3T toggle button that expands an inline
edit form with cpu_quota / memory_max text inputs and a S4V3 button.
The edit form shows a restart hint, surfaces validation errors inline, and
collapses on success.
- container_state_changed SSE handler: updates containersState in place and
re-renders the LOAD table so the cap columns flip immediately after a save.
system-sections.css:
- CSS for the new cap columns (.cload-cap-th, .cload-cap) and inline edit
form (.cload-edit-row, .cload-edit-form, .cload-edit-label, etc.).
- Remove dead .rqe-step rule (step sub-step label retired from the wire in
'job_queue: retire the now-off-wire step sub-step label').
This commit is contained in:
parent
6973610d39
commit
6c9bf2012f
4 changed files with 263 additions and 7 deletions
|
|
@ -213,12 +213,6 @@
|
|||
.rqe-node-arrow { color: var(--muted); }
|
||||
.rqe-node-log { margin-left: 0.1em; text-decoration: none; }
|
||||
|
||||
.rqe-step {
|
||||
flex-basis: 100%;
|
||||
margin: 0.1em 0 0 1.8em;
|
||||
color: var(--cyan);
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.rqe-error {
|
||||
flex-basis: 100%;
|
||||
margin: 0.3em 0 0;
|
||||
|
|
@ -355,6 +349,61 @@
|
|||
background: var(--red);
|
||||
}
|
||||
|
||||
/* Configured-cap columns: muted header so they read apart from live metrics.
|
||||
The S3T button sits in its own column; keep it compact. */
|
||||
.cload-cap-th {
|
||||
color: var(--muted);
|
||||
}
|
||||
.cload-cap {
|
||||
color: var(--muted);
|
||||
}
|
||||
.cload-set-btn {
|
||||
padding: 0.1em 0.5em;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
/* Inline edit row — spans all columns, contains a mini-form. */
|
||||
.cload-edit-row td {
|
||||
border-top: none;
|
||||
padding-top: 0;
|
||||
}
|
||||
.cload-edit-cell {
|
||||
padding: 0.2em 0.4em 0.6em 1.2em;
|
||||
}
|
||||
.cload-edit-form {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
}
|
||||
.cload-edit-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3em;
|
||||
font-size: 0.85em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.cload-cpu-input,
|
||||
.cload-mem-input {
|
||||
width: 7em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.cload-save-btn {
|
||||
padding: 0.15em 0.6em;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.cload-edit-hint {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.cload-edit-err {
|
||||
color: var(--red);
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
/* Remove the now-dead `.rqe-step` rule (the `step` sub-step label was
|
||||
retired from the wire in `feat(job_queue): retire the now-off-wire step
|
||||
sub-step label` — the rule has had no JS referents since then). */
|
||||
|
||||
/* ─── K3PT ST4T3 › stale permission entries sub-section ────────────────────
|
||||
Agents with explicit capability / tool-group entries in the JSON but no
|
||||
live container (renamed or manually-deleted agents). Lazy-loaded on tab
|
||||
|
|
|
|||
Loading…
Reference in a new issue