fix(webui): stop the UI contradicting itself, and clear the AA failures
Four P1 findings from the audit. Workflows claimed "No workflow runs yet" directly above stage tables listing those runs (archie-core-rcbf). The rows were built from the definition list alone, so a workflow with statistics but no definition produced no row at all. workflow-rows.js now merges both sides: a run is evidence the workflow exists. The producer is also at fault -- /api/workflows returns definitions: [] from the archie-ui composition while the daemon logs a registry of seven -- which also means "Start work" never renders there. Filed as archie-core-3tij. The logs page said "Durable history unavailable" twice and promised live logs from a stream that had stopped (archie-core-c5bz). EventSource fires onerror both for a retry and for a give-up; readyState tells them apart, so a dead stream now reports "unavailable" in red instead of "reconnecting" in amber forever. The toolbar says "Live only" and the empty state carries the explanation, each once. An unconfigured update check (501) now says so on Configuration rather than rendering nothing at all. Contrast (archie-core-umdn). --fg-subtle was 3.37:1 dark and 2.72:1 light, used for every KPI caption and column header; both move to values clearing 4.5:1 on every surface they actually land on, down to surface-hover at 4.51. White on the dark accent was 3.2:1 on the active nav item and every primary button: --accent-fg becomes near-black at 5.96:1 and the accent itself is untouched, since it is also the link colour and reads correctly on the canvas. Swept four routes in both themes: no remaining failures outside elements painted on a gradient, which a compositing check cannot judge and which are white on blue-purple anyway. The HEALTH cards take their own height again (archie-core-1786637500926-421-7c63bcd3). Equalising them was right when both held a checklist; once setup completes, that card is a title and one line while Gate pulse carries a gauge and four rows, so matching heights left a ~400px empty box in the first screen.
This commit is contained in:
1 parent
3dfc5394bd
commit
da0116f0ba
14 files changed
+240
-43
No files matched your search
+4
-1
@@ -5,6 +5,7 @@
|
||||
// fetch() call appears here, and it fails if any method omits a header the
|
||||
// server requires.
|
||||
import { randomUUID } from "./uuid.jsx";
|
||||
import { streamStateFor } from "./stream-state.js";
|
||||
|
||||
// DEFAULT_TIMEOUT_MS bounds a request so a daemon that accepts the connection
|
||||
// but never answers cannot leave the UI in a loading state with no way back.
|
||||
@@ -186,7 +187,9 @@ export function subscribeEvents(onEvent, onStateChange) {
|
||||
export function subscribeLogs(onEntry, onStateChange) {
|
||||
const src = new EventSource("/api/logs/stream");
|
||||
src.onopen = () => onStateChange?.("live");
|
||||
src.onerror = () => onStateChange?.("reconnecting");
|
||||
// onerror fires both for a drop the browser will retry and for one it has
|
||||
// given up on; readyState is what tells them apart.
|
||||
src.onerror = () => onStateChange?.(streamStateFor(src.readyState));
|
||||
src.onmessage = (event) => {
|
||||
try { onEntry(JSON.parse(event.data)); } catch { /* malformed log frame */ }
|
||||
};
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// What an EventSource error actually means.
|
||||
//
|
||||
// In base/ rather than logs/ because this is EventSource semantics, not a
|
||||
// logs concept, and base must not import a feature folder.
|
||||
//
|
||||
// EventSource fires onerror both for a dropped connection it will retry and
|
||||
// for one it has given up on. Reporting "reconnecting" for both left the logs
|
||||
// page showing a permanent amber "reconnecting" pill against a stream that had
|
||||
// stopped for good, next to text claiming live logs were still arriving
|
||||
// (archie-core-c5bz).
|
||||
//
|
||||
// readyState is the difference: CONNECTING means a retry is scheduled, CLOSED
|
||||
// means the browser will not try again.
|
||||
|
||||
/**
|
||||
* streamStateFor maps an EventSource readyState to the state the UI reports:
|
||||
* "live", "reconnecting", or "unavailable".
|
||||
*/
|
||||
export function streamStateFor(readyState) {
|
||||
// Numeric literals rather than EventSource.* so this is testable without one.
|
||||
if (readyState === 0) return "reconnecting";
|
||||
if (readyState === 1) return "live";
|
||||
return "unavailable";
|
||||
}
|
||||
@@ -52,10 +52,13 @@
|
||||
|
||||
--fg: #e8edf4;
|
||||
--fg-muted: #8b97a8;
|
||||
--fg-subtle: #5d6878;
|
||||
--fg-subtle: #7d8b9e;
|
||||
|
||||
--accent: #4c8dff;
|
||||
--accent-fg: #ffffff;
|
||||
/* Near-black, not white: white on this blue is 3.2:1 and fails AA on the
|
||||
active nav item and every primary button. The accent stays as-is because
|
||||
it is also the link colour, where it reads correctly on the dark canvas. */
|
||||
--accent-fg: #0d1014;
|
||||
--accent-soft: rgba(76, 141, 255, 0.14);
|
||||
|
||||
/* Status. Used for task state, gate results and trend direction alike, so
|
||||
@@ -101,7 +104,7 @@
|
||||
|
||||
--fg: #16202e;
|
||||
--fg-muted: #5a6779;
|
||||
--fg-subtle: #8c99ab;
|
||||
--fg-subtle: #636f82;
|
||||
|
||||
--accent: #2563eb;
|
||||
--accent-fg: #ffffff;
|
||||
|
||||
@@ -197,19 +197,14 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* The grid row stretches each column wrapper to the taller card's height by
|
||||
default, but a block-level .card child doesn't fill that stretched height
|
||||
on its own -- it shrinks to its own content, leaving the shorter card
|
||||
(typically Gate pulse's empty state) sitting flush at the top with dead
|
||||
space below it instead of matching its sibling. Flexing the wrapper and
|
||||
growing the card to fill it makes both HEALTH cards the same height while
|
||||
each card's own content still flows from the top. */
|
||||
.dash-top > div {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.dash-top > div > .card {
|
||||
flex: 1;
|
||||
/* Each HEALTH card takes its own content height. Equalising them (the earlier
|
||||
fix for this row) was right when both held a checklist, but once setup is
|
||||
complete that card is a title and one line while Gate pulse carries a gauge
|
||||
and four rows, so matching heights left a ~400px empty box taking a quarter
|
||||
of the first screen. A ragged bottom edge is the lesser cost.
|
||||
(archie-core-1786637500926-421-7c63bcd3) */
|
||||
.dash-top {
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
/* No setup panel to show: the gate pulse spans the whole row instead of
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// What the logs list says when it has nothing to show.
|
||||
//
|
||||
// Three different situations produced one message, which is how the page ended
|
||||
// up promising that "live daemon logs will appear here" while the stream that
|
||||
// would deliver them had already given up (archie-core-c5bz).
|
||||
|
||||
/**
|
||||
* logsEmptyTitle names the situation: a dead stream, a deployment with no
|
||||
* durable history, or filters that match nothing.
|
||||
*/
|
||||
export function logsEmptyTitle(durableUnavailable, streamState) {
|
||||
if (streamState === "unavailable") return "Log stream unavailable";
|
||||
if (durableUnavailable) return "No logs yet";
|
||||
return "Nothing matches";
|
||||
}
|
||||
|
||||
/**
|
||||
* logsEmptyDetail says what to expect next, and never promises live logs from
|
||||
* a stream that has stopped.
|
||||
*/
|
||||
export function logsEmptyDetail(durableUnavailable, streamState) {
|
||||
if (streamState === "unavailable") {
|
||||
return "The daemon is not serving /api/logs/stream. Reload once it is reachable.";
|
||||
}
|
||||
if (durableUnavailable) {
|
||||
return "This deployment keeps no durable history. Live daemon logs appear here while the page is open.";
|
||||
}
|
||||
return "Try a wider level or clear the search.";
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import "./logs.css";
|
||||
import { api, subscribeLogs } from "../base/api.jsx";
|
||||
import { LOG_LEVELS, LogRow } from "../base/log-row.jsx";
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
import { logsEmptyTitle, logsEmptyDetail } from "./logs-empty.js";
|
||||
|
||||
function Empty({ title, detail }) {
|
||||
return (
|
||||
@@ -48,7 +49,7 @@ function LogsApp() {
|
||||
});
|
||||
setDurableUnavailable(!!res.disabled);
|
||||
|
||||
const newMeta = res.disabled ? "Durable history unavailable; live daemon logs continue." : res.truncated
|
||||
const newMeta = res.disabled ? "Live only" : res.truncated
|
||||
? `showing the most recent matches from ${res.file}`
|
||||
: res.file || "";
|
||||
setMeta(newMeta);
|
||||
@@ -170,7 +171,10 @@ function LogsApp() {
|
||||
</div>
|
||||
<div className="log-status">
|
||||
<span className="log-meta">{meta}</span>
|
||||
<Pill text={streamState} kind={streamState === "live" ? "ok" : "warn"} />
|
||||
<Pill
|
||||
text={streamState}
|
||||
kind={streamState === "live" ? "ok" : streamState === "unavailable" ? "danger" : "warn"}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -178,9 +182,9 @@ function LogsApp() {
|
||||
{meta === "Cannot read logs" ? (
|
||||
<Empty title="Cannot read logs" />
|
||||
) : !entriesToRender.length ? (
|
||||
<Empty
|
||||
title={durableUnavailable ? "Durable history unavailable" : "Nothing matches"}
|
||||
detail={durableUnavailable ? "Live daemon logs will appear here while this page is open." : "Try a wider level or clear the search."}
|
||||
<Empty
|
||||
title={logsEmptyTitle(durableUnavailable, streamState)}
|
||||
detail={logsEmptyDetail(durableUnavailable, streamState)}
|
||||
/>
|
||||
) : (
|
||||
entriesToRender.map(entry => <LogRow key={entryKey(entry)} entry={entry} />)
|
||||
|
||||
@@ -399,13 +399,23 @@ function SettingsApp() {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{!versionMissing && (
|
||||
versionError ? (
|
||||
<div className="card"><Empty title="Update status unavailable" detail={versionError} /></div>
|
||||
) : versionData ? (
|
||||
<UpdateStatusCard components={versionData} />
|
||||
) : null
|
||||
)}
|
||||
{/* A 501 is a deployment that did not wire update checking, which is a
|
||||
legitimate state and a different thing from a broken one. Saying so
|
||||
once here covers the absent UpdateActionsCard below too. */}
|
||||
{versionMissing ? (
|
||||
<div className="card cfg-section">
|
||||
<div className="card-head">
|
||||
<div>
|
||||
<h2 className="card-title">Update status</h2>
|
||||
<p className="card-sub">Not configured on this deployment, so there is nothing to check against.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : versionError ? (
|
||||
<div className="card"><Empty title="Update status unavailable" detail={versionError} /></div>
|
||||
) : versionData ? (
|
||||
<UpdateStatusCard components={versionData} />
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{updateData && (
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// Merging workflow definitions with their run statistics.
|
||||
//
|
||||
// The rows used to come from the definition list alone, so a workflow that had
|
||||
// run but was no longer in that list (or a definitions fetch that came back
|
||||
// empty while the stats fetch succeeded) produced no rows at all. The page then
|
||||
// showed "No workflow runs yet" directly above the stage tables listing those
|
||||
// very runs (archie-core-rcbf).
|
||||
//
|
||||
// A run is evidence the workflow exists. Anything with either a definition or
|
||||
// statistics gets a row.
|
||||
|
||||
/**
|
||||
* workflowRows returns one row per known workflow, definitions first and in
|
||||
* their declared order, then any workflow seen only in the statistics.
|
||||
*/
|
||||
export function workflowRows(workflows, definitions) {
|
||||
const stats = new Map((workflows || []).map((w) => [w.workflow, w]));
|
||||
const rows = [];
|
||||
const claimed = new Set();
|
||||
|
||||
for (const definition of definitions || []) {
|
||||
claimed.add(definition.id);
|
||||
rows.push({
|
||||
...definition,
|
||||
...(stats.get(definition.id) || { workflow: definition.id, runs: 0, merged: 0 }),
|
||||
});
|
||||
}
|
||||
|
||||
for (const workflow of workflows || []) {
|
||||
if (claimed.has(workflow.workflow)) continue;
|
||||
// No definition to describe it, so the id is the only name it has.
|
||||
rows.push({ id: workflow.workflow, name: workflow.workflow, ...workflow });
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { h, Fragment } from "preact";
|
||||
import { useState, useEffect } from "preact/hooks";
|
||||
import "./workflows.css";
|
||||
import { api } from "../base/api.jsx";
|
||||
import { workflowRows } from "./workflow-rows.js";
|
||||
|
||||
const WORKFLOW_LABELS = {
|
||||
bootstrap: "Bootstrap",
|
||||
@@ -162,11 +163,7 @@ function StartWork({ definitions }) {
|
||||
}
|
||||
|
||||
function Workflows({ workflows, definitions }) {
|
||||
const byID = new Map(workflows.map((workflow) => [workflow.workflow, workflow]));
|
||||
const rows = definitions.map((definition) => ({
|
||||
...definition,
|
||||
...(byID.get(definition.id) || { workflow: definition.id, runs: 0, merged: 0 }),
|
||||
}));
|
||||
const rows = workflowRows(workflows, definitions);
|
||||
|
||||
if (!rows.length) {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user