Files
archie/ui/src/tasks/tasks.css
T
sam 3f78066f22 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.
2026-09-06 02:34:34 +10:00

338 lines
5.6 KiB
CSS

/* Tasks-only styles. */
.task-summary {
margin-bottom: var(--sp-5);
}
.task-filters {
display: flex;
gap: var(--sp-2);
align-items: center;
flex-wrap: wrap;
}
.task-search,
.task-filter {
font: inherit;
font-size: var(--text-sm);
color: var(--fg);
background: var(--surface);
border: 1px solid var(--border-strong);
border-radius: var(--radius-sm);
padding: var(--sp-2) var(--sp-3);
}
.task-search {
width: 220px;
}
.task-search:focus,
.task-filter:focus {
outline: 2px solid var(--accent-soft);
outline-offset: 1px;
}
.task-row {
cursor: pointer;
}
.task-expand {
width: 1.5rem;
height: 1.5rem;
margin-right: var(--sp-2);
padding: 0;
color: var(--fg-muted);
background: transparent;
border: 1px solid var(--border);
border-radius: 50%;
font: inherit;
line-height: 1;
cursor: pointer;
}
.task-expand:hover,
.task-expand:focus-visible {
color: var(--fg);
border-color: var(--accent);
}
.activity-row {
cursor: pointer;
}
.activity-row:hover td,
.activity-row:focus td {
background: var(--surface-hover);
}
.activity-row:focus {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
.task-source-link {
color: var(--accent);
text-decoration: none;
}
.task-source-link:hover {
text-decoration: underline;
}
.task-actions {
display: flex;
gap: var(--sp-1);
white-space: nowrap;
flex-wrap: wrap;
}
.btn-small {
padding: var(--sp-1) var(--sp-2);
font-size: var(--text-xs);
}
.btn-quiet {
color: var(--fg-muted);
}
.task-action-error {
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);
border-left: 3px solid var(--accent);
background: var(--surface);
}
.task-detail-actions {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--sp-3);
margin-bottom: var(--sp-4);
padding-bottom: var(--sp-3);
border-bottom: 1px solid var(--hairline);
}
.task-decision-title {
color: var(--fg);
font-weight: 600;
}
.task-decision-plan {
margin-top: var(--sp-2);
color: var(--fg-muted);
white-space: pre-wrap;
}
.task-logs-section {
margin-top: var(--sp-4);
}
.task-logs-section .task-decision-title {
display: flex;
align-items: center;
justify-content: space-between;
}
.task-log-list {
max-height: 40vh;
overflow-y: auto;
font-family: var(--font-mono);
font-size: var(--text-xs);
border-top: 1px solid var(--border);
margin-top: var(--sp-2);
}
.task-log-loading,
.task-log-error {
padding: var(--sp-3) 0;
color: var(--fg-muted);
}
/* On phones the filter controls take their own row and full width instead of
crowding the card title. */
@media (max-width: 700px) {
.task-filters {
width: 100%;
}
.task-search {
width: 100%;
}
.task-filter {
flex: 1 1 100%;
}
/* The task table becomes stacked cards instead of forcing the action
column off-screen. It remains a semantic table for assistive technology;
only its visual layout changes. */
.table-scroll:has(.task-row) {
overflow: visible;
}
.table:has(.task-row),
.table:has(.task-row) tbody {
display: block;
}
.table-scroll > .table:has(.task-row) {
width: 100%;
min-width: 0;
}
.table:has(.task-row) thead {
display: none;
}
.task-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--sp-2) var(--sp-4);
margin-bottom: var(--sp-3);
padding: var(--sp-3);
border: 1px solid var(--hairline);
border-radius: var(--radius-lg);
background: var(--surface-glass);
}
.task-row td {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--sp-2);
padding: var(--sp-1) 0;
border: 0;
text-align: right;
}
.task-row td::before {
content: attr(data-label);
color: var(--fg-subtle);
font-size: var(--text-xs);
font-weight: 500;
text-align: left;
}
.task-row td:nth-child(3),
.task-row td:last-child {
grid-column: 1 / -1;
}
.task-row td:last-child {
align-items: flex-start;
}
.task-timeline-row,
.task-timeline-row td {
display: block;
width: 100%;
}
.task-timeline-row td {
margin: calc(var(--sp-2) * -1) 0 var(--sp-4);
border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.task-detail-actions {
align-items: flex-start;
flex-direction: column;
}
}
@media (max-width: 480px) {
.task-row {
grid-template-columns: 1fr;
}
.task-row td:nth-child(3),
.task-row td:last-child {
grid-column: auto;
}
}
.task-timeline-row td {
background: var(--bg-raised);
padding: var(--sp-4);
}
.task-timeline-loading {
color: var(--fg-muted);
font-size: var(--text-sm);
}
.task-timeline-error {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: var(--sp-2);
}
.task-timeline-error .task-timeline-title {
font-weight: 500;
color: var(--fg);
}
.task-timeline {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: var(--sp-3);
}
.task-timeline-entry {
display: flex;
gap: var(--sp-3);
align-items: flex-start;
}
.task-timeline-dot {
width: 8px;
height: 8px;
margin-top: 5px;
flex: none;
border-radius: 50%;
background: var(--accent);
}
.task-timeline-kind {
font-size: var(--text-sm);
font-weight: 500;
color: var(--fg);
}
.task-timeline-detail {
font-size: var(--text-xs);
color: var(--fg-muted);
margin-top: 2px;
}
.task-timeline-when {
font-size: var(--text-xs);
color: var(--fg-subtle);
margin-top: 2px;
}