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
|
|
@ -15,11 +15,12 @@ use axum::{
|
|||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
/// Query params for `post_kill`. `?graceful=1` routes to the graceful-stop
|
||||
/// orchestration (quiesce the harness, flush `/state`, then container stop)
|
||||
/// instead of an immediate hard stop. Defaults false → today's hard kill.
|
||||
/// Query params for `post_kill` / `post_restart`. `?graceful=1` routes to
|
||||
/// the graceful-stop/-restart orchestration (quiesce the harness, flush
|
||||
/// `/state`, then container stop/restart) instead of an immediate hard
|
||||
/// action. Defaults false → today's hard kill/restart.
|
||||
#[derive(Deserialize)]
|
||||
pub(super) struct KillParams {
|
||||
pub(super) struct GracefulParams {
|
||||
#[serde(default)]
|
||||
graceful: bool,
|
||||
}
|
||||
|
|
@ -48,7 +49,7 @@ pub(super) async fn post_rebuild(
|
|||
pub(super) async fn post_kill(
|
||||
State(state): State<AppState>,
|
||||
AxumPath(name): AxumPath<String>,
|
||||
Query(params): Query<KillParams>,
|
||||
Query(params): Query<GracefulParams>,
|
||||
) -> Response {
|
||||
let logical = strip_container_prefix(&name);
|
||||
if let Some(reject) = guard_agent_name(&state, &logical).await {
|
||||
|
|
@ -92,11 +93,22 @@ pub(super) async fn post_kill(
|
|||
pub(super) async fn post_restart(
|
||||
State(state): State<AppState>,
|
||||
AxumPath(name): AxumPath<String>,
|
||||
Query(params): Query<GracefulParams>,
|
||||
) -> Response {
|
||||
let logical = strip_container_prefix(&name);
|
||||
if let Some(reject) = guard_agent_name(&state, &logical).await {
|
||||
return reject;
|
||||
}
|
||||
if params.graceful {
|
||||
submit::graceful_restart(
|
||||
&state.coord,
|
||||
&logical,
|
||||
Source::Manual,
|
||||
"manual via dashboard graceful restart".to_owned(),
|
||||
)
|
||||
.await;
|
||||
return (StatusCode::OK, "ok").into_response();
|
||||
}
|
||||
submit::restart(
|
||||
&state.coord,
|
||||
&logical,
|
||||
|
|
|
|||
Loading…
Reference in a new issue