Files
archie/ui/src/workflows/labels.ts
T
sam 0dc5bf9a9b
deploy / gate (push) Successful in 4m54s
Quality / check (push) Successful in 6m44s
deploy / archied-image (push) Successful in 3m44s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
fix(ui): times honour the Appearance zone, one duration formatter everywhere (#1761)
lib/format.ts gains shortTime(value, zone) and becomes the home of the
single duration() formatter (moved from timeline-event.ts, which
re-exports it so the stage rail and duration.test.ts are unchanged).
LogTable's time column, audit's From/To chips and chat session titles now
format in the zone chosen under Appearance instead of the browser's.
StepNode, schedule runDuration, labels formatMs and ChatToolCall all
delegate to duration(), removing the "12ms" vs "12 ms" vs "under 1 s"
split.
2026-11-06 22:21:45 +11:00

34 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** Naming and numbers shared by the workflow tables. */
import { duration } from "../lib/format.ts";
const WORKFLOW_LABELS: Record<string, string> = {
implement: "Implement",
tdd: "TDD",
feasibility: "Feasibility check",
};
/** A workflow's display name. An unknown one is still shown, not hidden: a new
* workflow on the server should be visible before the UI knows its proper
* name. */
export function workflowLabel(name: string | undefined | null): string {
if (name && WORKFLOW_LABELS[name]) return WORKFLOW_LABELS[name];
if (!name) return "Unknown";
return name.charAt(0).toUpperCase() + name.slice(1).replace(/_/g, " ");
}
/** A percentage, or 0 when there is no whole to divide by. Accepts the absent
* case because the stats endpoint omits a field it has no data for. */
export function pct(
part: number | undefined | null,
whole: number | undefined | null,
): number {
if (!whole || !part) return 0;
return Math.round((part / whole) * 100);
}
export function formatMs(ms: number | undefined | null): string {
if (!ms) return "–";
return duration(ms);
}