feat(dashboard): check-before-update flow on the System page (#38205)
The dashboard's update button ran 'hermes update' immediately with no preview. Now the System page shows whether an update is available and asks the user to confirm before applying it. - New GET /api/hermes/update/check: reports install method, current version, and commits-behind (via banner.check_for_updates, 6h-cached; ?force=1 busts the cache). Soft-fails to behind=null on network error; marks docker/nix/homebrew as can_apply=false with the out-of-band cmd. - System page: update-status badge on the Hermes version row (latest / N behind), a Check-for-updates button, and an Update-now button that opens a ConfirmDialog showing the commit count before POST /api/hermes/ update fires. Cached status loads with the rest of the page. - Docs + 5 endpoint tests (git/up-to-date/docker/soft-failure + auth gate).
This commit is contained in:
@@ -495,6 +495,10 @@ export const api = {
|
||||
fetchJSON<ActionResponse>("/api/gateway/restart", { method: "POST" }),
|
||||
updateHermes: () =>
|
||||
fetchJSON<ActionResponse>("/api/hermes/update", { method: "POST" }),
|
||||
checkHermesUpdate: (force = false) =>
|
||||
fetchJSON<UpdateCheckResponse>(
|
||||
`/api/hermes/update/check${force ? "?force=true" : ""}`,
|
||||
),
|
||||
getActionStatus: (name: string, lines = 200) =>
|
||||
fetchJSON<ActionStatusResponse>(
|
||||
`/api/actions/${encodeURIComponent(name)}/status?lines=${lines}`,
|
||||
@@ -1009,6 +1013,18 @@ export interface HookCreate {
|
||||
approve?: boolean;
|
||||
}
|
||||
|
||||
export interface UpdateCheckResponse {
|
||||
install_method: string;
|
||||
current_version: string;
|
||||
// commits behind: >=1 known count, 0 up to date, -1 behind by unknown
|
||||
// count (nix/pypi), or null when the check could not run.
|
||||
behind: number | null;
|
||||
update_available: boolean;
|
||||
can_apply: boolean;
|
||||
update_command: string;
|
||||
message: string | null;
|
||||
}
|
||||
|
||||
export interface SystemStats {
|
||||
os: string;
|
||||
os_release: string;
|
||||
|
||||
Reference in New Issue
Block a user