* fix(ui/topbar): replace Jump to with a command palette, drop filler chrome Jump to opens a shadcn-vue Command dialog that finds pages, tasks and workflows by name. The connection indicator shows only when the stream is lost, the dead documentation link is gone, and the profile menu label has no stray whitespace. * fix(ui): trim stray whitespace from template text and drop em dashes from copy Element text that started or ended with a line break rendered with leading and trailing spaces. Also removes the unused 'soon' nav state and the nav group components no route reaches. * fix(ui): drop the space a hidden spinner left before button text * fix(ui/status): one dense Status page, full-width settings, problems-only apply status Status drops its tabs and the duplicate health card; services list only what is wrong. Settings pages use the full width, the resizable sidebar handle is gone, and apply status shows only processes that have not applied a change. PageHeader puts the title and actions on one line. * refactor(ui): use shadcn ToggleGroup and Badge, drop SegmentedControl and StatusPill Status badges show only when a state needs attention: no Running, Enabled, Active, Listening or live pills next to healthy rows. Removes the unused pagination, radio-group and scroll-area components. * fix(ui/history): use the shadcn Table with fixed columns so nothing is clipped * fix(ui/workflows): apply ?workflow= only once the workflow is listed Selecting it before the definitions loaded opened an empty canvas. * refactor(ui/workflows): use shadcn Input, NativeSelect, Checkbox and Button in editors Replaces hand-rolled inputs, selects, the repository mode switch and icon buttons in the workflow editor, bind dialog, harness page, sources panel and review gate. Adds the upstream shadcn-vue NativeSelect. * style(ui): rounded-rectangle controls instead of pills Halves the radius scale so inputs, selects and buttons stop reading as pills, and badges and chips lose their full rounding. * fix(ui/alerts): centre the bell's failed state and stop it contradicting Needs you * fix(ui/tasks): one header line, aligned columns, no placeholder issue numbers Tasks puts its filters beside the title and drops the stat tiles the dashboard already shows. Sort headers align with their cells, chat tasks no longer show their synthetic issue number, and Logs and the task not-found page use the shared header. * fix(ui/dashboard): shared header and cards, empty cards stay silent Needs you uses the shadcn Card and drops its duplicate Open button; quality gates and token outlook render only when there is something to show; the throughput strip moves into the dashboard, its only user. * refactor(ui/stores): one Pinia store per feature Splits the site-wide control-plane store and the module-level refs into settings, workflows, tasks, events, org and session stores. Identity requests move into lib/api. Drops store fields nothing read: per-resource stream state, the states map and loadApplyStatus. * fix(ui/org): one header for the org area, sections drop their repeated titles The org name is the page title with the admin's org switcher and New org beside it; Members and Workspaces tables sit in cards like other pages. * fix(ui/events): shadcn Tabs for the capture, map and bind steps Replaces the numbered step strip with line tabs that carry each step's count; the Listening pill is gone and Capture off shows only when it is. * fix(ui/workflows): confirm a workflow delete in an AlertDialog, not window.confirm * style(ui/settings): denser setting rows
149 lines
5.3 KiB
TypeScript
149 lines
5.3 KiB
TypeScript
// Central lifecycle vocabulary for the dashboard. The backend is the source of
|
|
// truth: /api/task-meta returns the statuses (label, pill severity, "needs you"
|
|
// grouping) and operator actions (label, button variant, confirm prompt). This
|
|
// module fetches that catalog and exposes the accessors the rest of the UI
|
|
// reads, so no surface keeps a hand-synced copy of the vocabulary.
|
|
//
|
|
// The defaults below are a freeze-dried snapshot that render immediately and
|
|
// keep working when archied is unreachable; loadTaskMeta() replaces them with
|
|
// the live catalog as soon as it arrives. They must match the backend catalog
|
|
// so drawing the page never flashes a stale label.
|
|
//
|
|
// loadTaskMeta() is called once at boot by main.ts. The catalog is held in
|
|
// refs, so a late-arriving catalog re-renders whatever already read it; there
|
|
// is no separate "re-render the mounted route" step the way the Preact shell
|
|
// needed one.
|
|
//
|
|
// The dashboard draws a line here between two kinds of vocabulary. Anything
|
|
// that is *presentation* -- a status's label, pill severity and "needs you"
|
|
// grouping, or a control's label and confirm prompt -- is served, because the
|
|
// server owns the words as well as the ids.
|
|
import { computed, shallowRef } from "vue";
|
|
|
|
import { api } from "./api";
|
|
import type { StatusKind } from "./status";
|
|
|
|
import {
|
|
type ActionMeta,
|
|
type ChangeStatusMeta,
|
|
DEFAULT_ACTIONS,
|
|
DEFAULT_CHANGE_STATUSES,
|
|
DEFAULT_CONFIG_SCHEMA,
|
|
DEFAULT_RETRY_MODES,
|
|
DEFAULT_STATUSES,
|
|
type RetryModeMeta,
|
|
type StatusMeta,
|
|
} from "./task-meta-snapshot";
|
|
|
|
export type { ActionMeta, ChangeStatusMeta, RetryModeMeta, StatusMeta };
|
|
|
|
const statuses = shallowRef<StatusMeta[]>([...DEFAULT_STATUSES]);
|
|
const actions = shallowRef<ActionMeta[]>([...DEFAULT_ACTIONS]);
|
|
const retryModesRef = shallowRef<RetryModeMeta[]>([...DEFAULT_RETRY_MODES]);
|
|
const changeStatuses = shallowRef<ChangeStatusMeta[]>([
|
|
...DEFAULT_CHANGE_STATUSES,
|
|
]);
|
|
const configSchemaRef = shallowRef<string>(DEFAULT_CONFIG_SCHEMA);
|
|
|
|
const statusById = computed(
|
|
() => new Map(statuses.value.map((s) => [s.id, s])),
|
|
);
|
|
const actionById = computed(() => new Map(actions.value.map((a) => [a.id, a])));
|
|
const changeStatusById = computed(
|
|
() => new Map(changeStatuses.value.map((c) => [c.id, c])),
|
|
);
|
|
const retryModeById = computed(
|
|
() => new Map(retryModesRef.value.map((m) => [m.id, m])),
|
|
);
|
|
|
|
// loadTaskMeta upgrades the dashboard from the server catalog. It never throws:
|
|
// a failed fetch keeps the defaults so the UI still renders.
|
|
export async function loadTaskMeta(): Promise<void> {
|
|
try {
|
|
const data = await api.taskMeta<{
|
|
statuses?: StatusMeta[];
|
|
actions?: ActionMeta[];
|
|
retry_modes?: RetryModeMeta[];
|
|
change_statuses?: ChangeStatusMeta[];
|
|
config_schema?: string;
|
|
} | null>();
|
|
if (Array.isArray(data?.statuses)) statuses.value = data.statuses;
|
|
if (Array.isArray(data?.actions)) actions.value = data.actions;
|
|
if (Array.isArray(data?.retry_modes)) retryModesRef.value = data.retry_modes;
|
|
if (Array.isArray(data?.change_statuses))
|
|
changeStatuses.value = data.change_statuses;
|
|
if (data?.config_schema) configSchemaRef.value = data.config_schema;
|
|
} catch {
|
|
// archied unreachable or not yet serving this route; keep the defaults.
|
|
}
|
|
}
|
|
|
|
/** statusLabel is the human-readable name for a lifecycle status. */
|
|
export function statusLabel(id: string): string {
|
|
return statusById.value.get(id)?.label || id || "Unknown";
|
|
}
|
|
|
|
/** statusKind is the pill severity token (idle, info, ok, warn, danger). */
|
|
export function statusKind(id: string): StatusKind {
|
|
return (statusById.value.get(id)?.kind || "idle") as StatusKind;
|
|
}
|
|
|
|
/** statusList returns every known lifecycle status in display order. */
|
|
export function statusList(): StatusMeta[] {
|
|
return statuses.value;
|
|
}
|
|
|
|
/** statusIds returns every known lifecycle status id, in display order. */
|
|
export function statusIds(): string[] {
|
|
return statuses.value.map((s) => s.id);
|
|
}
|
|
|
|
/**
|
|
* attentionStatusIds is the set of statuses that count toward the "Needs you"
|
|
* filter (work that is waiting on a human).
|
|
*/
|
|
export function attentionStatusIds(): Set<string> {
|
|
return new Set(statuses.value.filter((s) => s.needs_you).map((s) => s.id));
|
|
}
|
|
|
|
/**
|
|
* actionFor returns the presentation metadata for an operator control, or null
|
|
* if the backend has never seen it.
|
|
*/
|
|
export function actionFor(id: string): ActionMeta | null {
|
|
return actionById.value.get(id) || null;
|
|
}
|
|
|
|
/**
|
|
* retryModes returns the server's retry worktree modes in display order. The
|
|
* retry dialog renders these and falls back to the frozen snapshot before the
|
|
* catalog arrives.
|
|
*/
|
|
export function retryModes(): RetryModeMeta[] {
|
|
return retryModesRef.value;
|
|
}
|
|
|
|
/**
|
|
* retryModeFor returns one retry mode's metadata, or null if the server has
|
|
* never described it.
|
|
*/
|
|
export function retryModeFor(
|
|
id: string | null | undefined,
|
|
): RetryModeMeta | null {
|
|
if (!id) return null;
|
|
return retryModeById.value.get(id) || null;
|
|
}
|
|
|
|
/**
|
|
* changeStatusLabel names a changes_captured file status. An id the catalog
|
|
* does not know renders as itself rather than breaking the row.
|
|
*/
|
|
export function changeStatusLabel(id: string | undefined): string {
|
|
return (id && changeStatusById.value.get(id)?.label) || id || "unknown";
|
|
}
|
|
|
|
/** configSchema is the schema stamp a recognised config_captured payload carries. */
|
|
export function configSchema(): string {
|
|
return configSchemaRef.value;
|
|
}
|