feat(admin): power controls — stop everything & power off, restart everything
Settings gains a second service button next to restart: stop every managed local model server and exit the gateway process (nothing is respawned; in Docker the restart policy decides). The SPA replaces itself with a static "gateway is off" screen since the API is gone. The restart button is relabeled "Restart everything" to say what it always did — the gateway re-execs itself and managed servers come back with it. Translated in all seven languages.
This commit is contained in:
Vendored
+27
-1
@@ -559,6 +559,31 @@ export async function renderSettings() {
|
||||
}
|
||||
});
|
||||
|
||||
const stopBtn = h("button", { class: "btn danger" }, "\u23fb " + t("settings.shutdown"));
|
||||
stopBtn.addEventListener("click", async () => {
|
||||
if (!(await confirmDialog(t("settings.shutdownConfirm")))) return;
|
||||
stopBtn.disabled = true;
|
||||
restartBtn.disabled = true;
|
||||
try {
|
||||
await api.shutdown();
|
||||
// the server is gone in ~300ms — replace the app with a static farewell
|
||||
document.body.innerHTML = "";
|
||||
document.body.appendChild(
|
||||
h(
|
||||
"div",
|
||||
{ class: "shutdown-screen" },
|
||||
h("div", { class: "shutdown-icon" }, "\u23fb"),
|
||||
h("h2", {}, t("settings.shutdownDone")),
|
||||
h("p", { class: "hint" }, t("settings.shutdownHint"))
|
||||
)
|
||||
);
|
||||
} catch (e) {
|
||||
toast(String(e.message || e), "bad");
|
||||
stopBtn.disabled = false;
|
||||
restartBtn.disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
mount(
|
||||
root,
|
||||
h(
|
||||
@@ -682,7 +707,8 @@ export async function renderSettings() {
|
||||
h("button", { class: "btn", onClick: () => fileIn.click() }, t("settings.import")),
|
||||
fileIn,
|
||||
h("div", { class: "grow" }),
|
||||
restartBtn
|
||||
restartBtn,
|
||||
stopBtn
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user