frontend: drop the queued-badge label lookup, show the raw kind
mara, PR #3026 review: "drop queuedLabelFor - just show what the backend sends". `queuedLabelFor` translated the rebuild-queue entry's `kind` field through a curated English-phrase table ("meta_update" -> "meta-update queued", "graceful_stop" -> "stop queued", etc.) for the one fallback case where no transient exists for an agent. Removed the lookup entirely -- `queuedOpsByAgent()` now returns the raw `kind` string directly, and the render loop uses it as-is, the same opaque-string treatment a transient's own `kind` already got (never run through a lookup, per docs/web-ui/dashboard.md's existing "treat it as an opaque display string" note). The queued-vs-running visual distinction still comes entirely from the row's CSS classes (no ring/tint for queued, amber ring + tint for running) -- the text was never carrying that signal on its own, so nothing is lost by not reformatting it. Updated docs/web-ui/dashboard.md's Container-row section to match. npm run build clean, standalone verification re-run (17/17 checks, one updated for the new raw-string expectation).
This commit is contained in:
parent
d1f82e725e
commit
e269af7882
2 changed files with 21 additions and 26 deletions
|
|
@ -919,7 +919,10 @@ fetch entirely.
|
|||
consulted; the fallback exists purely for the **`Pending`
|
||||
(queued, not yet started)** case, which `running_transients()`'s
|
||||
Running-only test cannot represent. `queuedOpsByAgent()` (swarm.js)
|
||||
reflects this: it only ever looks at `Pending`-state queue nodes.
|
||||
reflects this: it only ever looks at `Pending`-state queue nodes,
|
||||
and (mara, on review) the badge shows the queue entry's raw `kind`
|
||||
string as-is — no English-phrase lookup translating it first, same
|
||||
opaque-string treatment a transient's own label already gets.
|
||||
`opRunning` (driving the `pending-running` row class + spinner) is
|
||||
simply "does this agent have at least one transient" — a queued-only
|
||||
entry (no transient yet) leaves it false.
|
||||
|
|
|
|||
|
|
@ -68,14 +68,20 @@ export function applyRebuildQueueChanged(ev) {
|
|||
// See docs/web-ui.md::Container row for the badge taxonomy.
|
||||
renderContainersFromState();
|
||||
}
|
||||
// Map from agent name -> the queued op ({ kind }) backing the SW4RM
|
||||
// card's "<kind> queued" badge. Pending only — every *running* node
|
||||
// naming an agent already lights a transient pill (any running node,
|
||||
// not just a curated "worth it" subset — see docs/web-ui.md::Container
|
||||
// row), so a Running entry here would always be redundant with
|
||||
// `transientsState` by the time this is consulted. Queued (not yet
|
||||
// started) work is the one state transients can't represent, since
|
||||
// `running_transients()` on the backend is a Running-only test.
|
||||
// Map from agent name -> the queued op's raw `kind` string, backing
|
||||
// the SW4RM card's fallback pending badge. Pending only — every
|
||||
// *running* node naming an agent already lights a transient pill (any
|
||||
// running node, not just a curated "worth it" subset — see
|
||||
// docs/web-ui.md::Container row), so a Running entry here would
|
||||
// always be redundant with `transientsState` by the time this is
|
||||
// consulted. Queued (not yet started) work is the one state
|
||||
// transients can't represent, since `running_transients()` on the
|
||||
// backend is a Running-only test.
|
||||
//
|
||||
// The returned `kind` is displayed as-is (mara, on review: "drop
|
||||
// queuedLabelFor - just show what the backend sends") — same opaque-
|
||||
// string treatment `pending`'s transient half already gets, no
|
||||
// English-phrase lookup table translating it first.
|
||||
//
|
||||
// Agent is per-node, not per-DAG (a DAG can span agents — e.g. the
|
||||
// startup sweep's MetaLock cascade, or a hive-wide restart), so this
|
||||
|
|
@ -95,25 +101,11 @@ function queuedOpsByAgent() {
|
|||
if (!n.agent || n.state !== 'Pending') continue;
|
||||
// First entry found wins — with only one state to consider
|
||||
// (Pending), there's no priority to resolve between DAGs.
|
||||
if (!out.has(n.agent)) out.set(n.agent, { kind: e.kind });
|
||||
if (!out.has(n.agent)) out.set(n.agent, e.kind);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
// "<kind> queued" text for the queuedOpsByAgent fallback badge. Only
|
||||
// ever applies to this fallback — a transient's own kind is an opaque
|
||||
// wire tag (docs/web-ui.md::Container row) displayed as-is, never
|
||||
// run through a lookup like this one.
|
||||
function queuedLabelFor(kind) {
|
||||
return kind === 'meta_update' ? 'meta-update queued'
|
||||
: kind === 'destroy' ? 'destroy queued'
|
||||
: kind === 'restart' ? 'restart queued'
|
||||
: kind === 'start' ? 'start queued'
|
||||
: kind === 'stop' ? 'stop queued'
|
||||
: kind === 'graceful_stop' ? 'stop queued'
|
||||
: kind === 'reconcile' ? 'reconcile queued'
|
||||
: 'rebuild queued';
|
||||
}
|
||||
|
||||
// ─── transients ─────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
@ -706,10 +698,10 @@ export function renderContainers(s) {
|
|||
// order is insertion order, which shifts as pills clear/re-add.
|
||||
const transientKinds = transientKindsMap
|
||||
? Array.from(transientKindsMap.keys()).sort() : [];
|
||||
const queuedOp = transientKinds.length === 0 ? queuedOps.get(c.name) : null;
|
||||
const queuedKind = transientKinds.length === 0 ? queuedOps.get(c.name) : null;
|
||||
const pending = transientKinds.length > 0
|
||||
? transientKinds
|
||||
: (queuedOp ? [queuedLabelFor(queuedOp.kind)] : []);
|
||||
: (queuedKind ? [queuedKind] : []);
|
||||
const opRunning = transientKinds.length > 0;
|
||||
const selected = selectionState.has(c.name);
|
||||
// Pending questions where this agent is the asker (awaiting an
|
||||
|
|
|
|||
Loading…
Reference in a new issue