add graceful checkbox to restart confirm dialog
Restart now offers the same graceful-vs-hard choice stop already has: single-agent menu item and the bulk-select action bar both grow a 'restart gracefully' checkbox that routes through the existing submit::graceful_restart DAG (signal -> drain -> stop -> reconcile) instead of a hard restart. Backend gains a ?graceful=true query param on POST /api/restart/<name>, mirroring post_kill's shape (renamed KillParams -> GracefulParams since it's now shared).
This commit is contained in:
parent
207b66e35d
commit
d8567fc546
2 changed files with 27 additions and 8 deletions
|
|
@ -244,7 +244,7 @@ function buildAgentMenu(c, forgeBase) {
|
|||
danger: true,
|
||||
confirmLabel: opts.confirmLabel || 'confirm',
|
||||
checkboxes: opts.graceful
|
||||
? [{ name: 'graceful', label: 'stop gracefully — let the agent finish its turn and flush state before the container stops' }]
|
||||
? [{ name: 'graceful', label: opts.gracefulLabel || 'stop gracefully — let the agent finish its turn and flush state before the container stops' }]
|
||||
: [],
|
||||
});
|
||||
if (!r) return;
|
||||
|
|
@ -277,7 +277,12 @@ function buildAgentMenu(c, forgeBase) {
|
|||
// Show only actions that are applicable in the current state.
|
||||
if (c.running) {
|
||||
dropdown.append(
|
||||
menuItem('↺ R3ST4RT', { action: '/api/restart/', confirm: `restart ${c.name}?` }),
|
||||
menuItem('↺ R3ST4RT', {
|
||||
action: '/api/restart/',
|
||||
confirm: `restart ${c.name}?`,
|
||||
graceful: true,
|
||||
gracefulLabel: 'restart gracefully — let the agent finish its turn and flush state before the container restarts',
|
||||
}),
|
||||
menuItem('■ ST0P', { action: '/api/kill/', confirm: `stop ${c.name}?`, confirmLabel: '■ stop', graceful: true }),
|
||||
);
|
||||
} else {
|
||||
|
|
@ -929,6 +934,8 @@ export function renderSelectionBar(containers) {
|
|||
addBulkButton(actions, 'btn-restart', '↺ R3ST4RT', allRunning, selected, {
|
||||
action: '/api/restart/',
|
||||
confirm: (names) => `restart ${names.length} agent${names.length === 1 ? '' : 's'} (${names.join(', ')})?`,
|
||||
graceful: true,
|
||||
gracefulLabel: 'restart gracefully — let each agent finish its turn and flush state before the container restarts',
|
||||
disabledTitle: why('↺ R3ST4RT', stoppedNames.map((n) => `\`${n}\` is stopped`)),
|
||||
});
|
||||
addBulkButton(actions, 'btn-stop', '■ ST0P', allRunning, selected, {
|
||||
|
|
@ -1106,7 +1113,7 @@ function addBulkButton(parent, btnClass, label, enabled, selected, opts) {
|
|||
danger: true,
|
||||
confirmLabel: opts.confirmLabel || 'confirm',
|
||||
checkboxes: opts.graceful
|
||||
? [{ name: 'graceful', label: 'stop gracefully — let each agent finish its turn and flush state before the container stops' }]
|
||||
? [{ name: 'graceful', label: opts.gracefulLabel || 'stop gracefully — let each agent finish its turn and flush state before the container stops' }]
|
||||
: [],
|
||||
});
|
||||
if (!r) return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue