hive dashboard: bulk pause + resume in the selection bar
Mechanical addition to the existing bulk-action framework (renderSelectionBar/addBulkButton, swarm.js) -- two per-agent actions already exist (POST /api/pause/, /api/resume/, see hive-agent-menu.js), this just gives the selection bar the same all-or-nothing enablement rule the other six bulk buttons already use (pause enabled only when none of the selection is already paused, and vice versa for resume). .btn-pause reuses .badge-paused's yellow so the trigger and the resulting state pill read as one colour; .btn-resume is green like .btn-start (both are "go" actions). Docs updated to list both in the Selection bar reference.
This commit is contained in:
parent
46d1271603
commit
4af890f01d
3 changed files with 36 additions and 7 deletions
|
|
@ -783,9 +783,19 @@ export function renderSelectionBar(containers) {
|
|||
actions.replaceChildren();
|
||||
const allRunning = selected.every((c) => c.running);
|
||||
const allStopped = selected.every((c) => !c.running);
|
||||
// Pause/resume is orthogonal to running (see hive-agent-menu.js's own
|
||||
// comment on the per-agent version of these two actions) — a paused
|
||||
// stopped agent boots paused, a paused running agent keeps its
|
||||
// container but drives no turns. Same all-or-nothing enablement rule
|
||||
// as every other bulk action here: mixed pause state disables the
|
||||
// button rather than silently no-op'ing on part of the selection.
|
||||
const allUnpaused = selected.every((c) => !c.paused);
|
||||
const allPaused = selected.every((c) => c.paused);
|
||||
|
||||
const stoppedNames = selected.filter((c) => !c.running).map((c) => c.name);
|
||||
const runningNames = selected.filter((c) => c.running).map((c) => c.name);
|
||||
const pausedNames = selected.filter((c) => c.paused).map((c) => c.name);
|
||||
const unpausedNames = selected.filter((c) => !c.paused).map((c) => c.name);
|
||||
|
||||
function why(label, blockers) {
|
||||
if (!blockers.length) return null;
|
||||
|
|
@ -811,6 +821,16 @@ export function renderSelectionBar(containers) {
|
|||
confirm: (names) => `start ${names.length} agent${names.length === 1 ? '' : 's'} (${names.join(', ')})?`,
|
||||
disabledTitle: why('▶ ST4RT', runningNames.map((n) => `\`${n}\` is already running`)),
|
||||
});
|
||||
addBulkButton(actions, 'btn-pause', '⏸ P4US3', allUnpaused, selected, {
|
||||
action: '/api/pause/',
|
||||
confirm: (names) => `pause ${names.length} agent${names.length === 1 ? '' : 's'} (${names.join(', ')})? parks the turn loop — inbox messages queue unacked.`,
|
||||
disabledTitle: why('⏸ P4US3', pausedNames.map((n) => `\`${n}\` is already paused`)),
|
||||
});
|
||||
addBulkButton(actions, 'btn-resume', '▶ R3SUM3', allPaused, selected, {
|
||||
action: '/api/resume/',
|
||||
confirm: (names) => `resume ${names.length} agent${names.length === 1 ? '' : 's'} (${names.join(', ')})? the turn loop restarts and drains queued messages.`,
|
||||
disabledTitle: why('▶ R3SUM3', unpausedNames.map((n) => `\`${n}\` is not paused`)),
|
||||
});
|
||||
addBulkButton(actions, 'btn-rebuild', '↻ R3BU1LD', true, selected, {
|
||||
action: '/api/rebuild/',
|
||||
confirm: (names) => `rebuild ${names.length} agent${names.length === 1 ? '' : 's'} (${names.join(', ')})? hot-reloads each container.`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue