fix(webui): distinguish refused vs broken task actions, handle 401 (#753)

Failed task actions in the dashboard rendered the same generic message
regardless of cause. ApiError already carried the HTTP status, but nothing
read it: a refused mutation (400/403/409 - bad input, CSRF, conflicting
state) looked identical to a broken one (5xx, network drop, timeout), and
an expired session (401, whether archied's own token cookie or an upstream
forward-auth proxy) showed a generic failure instead of prompting
re-authentication.

Add classifyActionError() in api.jsx to map a caught error to a refused /
broken / session-expired kind, and use it in tasks.jsx to render each with
distinct framing and coloring (reusing the existing warn/danger tokens
pill.css already establishes) - refused actions get "you can't do that",
broken ones get "try again, or check the daemon", and an expired session
gets a reload prompt.

Refs archie-core-h3lg.
This commit is contained in:
sam authored and GitHub committed 2026-09-06 02:34:34 +10:00
1 parent 268283eb16
commit 9e608dee5f
5 files changed
+192 -6

No files matched your search

+17 -2
View File
@@ -96,12 +96,27 @@
}
.task-action-error {
max-width: 180px;
color: var(--danger);
max-width: 220px;
font-size: var(--text-xs);
white-space: normal;
}
.task-action-error-refused {
color: var(--warn);
}
.task-action-error-broken {
color: var(--danger);
}
.task-action-error-session {
color: var(--warn);
display: inline-flex;
align-items: center;
gap: var(--sp-1);
flex-wrap: wrap;
}
.task-decision {
margin-bottom: var(--sp-4);
padding: var(--sp-3);