feat(webui): port the dashboard (Phases 3-5)
Every page from the deleted Preact dashboard, rebuilt in Vue 3 + shadcn-vue.
The navigation restructure landed earlier on this branch; this is the surfaces
behind it, and the two are now one app.
Dashboard, Tasks (list and detail), Configuration split six ways, Logs,
Inspector, Mappings, Bindings, Workflows, Skills, Curators, Channels, chat.
Components, not files: docs/prds/dashboard-port-brief.md requires one
component, one job, one file, with shared state in a module beside it. So a
page file composes and holds nothing, and a shape repeated across panes becomes
its own component (LogRow, PageHeader, PanelLoading, WorkflowBar).
Behaviour that had to survive, because each was a fix:
- Live activity's detail is clamped to one line with the payload on the title.
Unclamped, one row made the dashboard 7,481px tall.
- Each health card takes its own height. Equalising left a mostly-empty box
taking a quarter of the first screen once setup was done.
- Tasks: `tab`/`attempt` live in the query string and are written with
router.replace, so a tab click adds no history entry and does not remount.
The list's deep-link reveal honours prefers-reduced-motion.
- LOG_LEVELS is a wire contract (the server matches that CSV server-side), used
unchanged by both log panes.
- The chat panel's Phase 5 list: a FAB that is the only toggle, a morph whose
scale, radius and position interpolate together, no scrim, no close button,
Escape returning focus to the launcher, Stop only while streaming.
- Unconfigured is not broken. A 501 on /api/version or the log stream renders
what is true ("Not configured on this deployment") rather than blank, and a
read-only Configuration says so instead of offering controls that cannot work.
Three things the port decided rather than carried:
- Button gains an `attention` variant and Badge the five status tones, in the
project's own cva. The pill's dot did not come across: the Badge's shape is
the affordance, and the same tone now covers a trend indicator.
- The icon module is not ported. Its name-to-glyph lookup is the pattern
shadcn-vue's rules call out as wrong, so icons come from @lucide/vue at the
call site. The five bespoke glyphs have no consumer yet and become components
if a page draws them.
- The theme control left the topbar for /system/appearance, per the approved
navigation design. ThemeToggle.vue and Placeholder.vue are deleted rather
than orphaned: every route now resolves to a real page.
Also fixes the bundle freshness check failing on the first build after every
change. ui/dist is committed, so nothing ignores it and Tailwind's content
detection scanned it, making each build an input to the next.
This commit is contained in:
1 parent
5fe25045d1
commit
b9daa01b4b
276 files changed
+12888
-563
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { formatMs, pct, workflowLabel } from "./labels";
|
||||
import { maxStageMs, slowestStages, type StageStats } from "./stages";
|
||||
import WorkflowBar from "./WorkflowBar.vue";
|
||||
|
||||
/** Which stage is eating the time. */
|
||||
const props = defineProps<{ stages: StageStats[] }>();
|
||||
|
||||
const rows = computed(() => slowestStages(props.stages));
|
||||
const maxMs = computed(() => maxStageMs(props.stages));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Slowest stages</CardTitle>
|
||||
<CardDescription>Average duration, this workflow's stages</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Workflow</TableHead>
|
||||
<TableHead>Stage</TableHead>
|
||||
<TableHead>Runs</TableHead>
|
||||
<TableHead>Avg duration</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="(s, idx) in rows" :key="idx">
|
||||
<TableCell>{{ workflowLabel(s.workflow) }}</TableCell>
|
||||
<TableCell class="font-medium">{{ s.stage }}</TableCell>
|
||||
<TableCell>{{ s.runs }}</TableCell>
|
||||
<TableCell>
|
||||
<div class="text-sm">{{ formatMs(s.avg_ms) }}</div>
|
||||
<WorkflowBar :fraction="pct(s.avg_ms || 0, maxMs)" kind="info" />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -0,0 +1,51 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { pct, workflowLabel } from "./labels";
|
||||
import { failingStages, type StageStats } from "./stages";
|
||||
import WorkflowBar from "./WorkflowBar.vue";
|
||||
|
||||
/** Which stage is failing, over how many runs. */
|
||||
const props = defineProps<{ stages: StageStats[] }>();
|
||||
|
||||
const rows = computed(() => failingStages(props.stages));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Most failures</CardTitle>
|
||||
<CardDescription>Stages that error out, over their runs</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Empty v-if="!rows.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No failures recorded</EmptyTitle>
|
||||
<EmptyDescription>Every stage has completed cleanly so far.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<Table v-else>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Workflow</TableHead>
|
||||
<TableHead>Stage</TableHead>
|
||||
<TableHead>Failures</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="(s, idx) in rows" :key="idx">
|
||||
<TableCell>{{ workflowLabel(s.workflow) }}</TableCell>
|
||||
<TableCell class="font-medium">{{ s.stage }}</TableCell>
|
||||
<TableCell>
|
||||
<div class="text-sm">{{ s.errors }} of {{ s.runs }}</div>
|
||||
<WorkflowBar :fraction="pct(s.errors, s.runs)" kind="danger" />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -0,0 +1,36 @@
|
||||
<script setup lang="ts">
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import SlowestStagesCard from "./SlowestStagesCard.vue";
|
||||
import StageFailuresCard from "./StageFailuresCard.vue";
|
||||
import type { StageStats } from "./stages";
|
||||
|
||||
/**
|
||||
* The stage half of the page. With no stage data this is one card saying so,
|
||||
* rather than two empty tables filtered down to nothing.
|
||||
*/
|
||||
const props = defineProps<{ stages: StageStats[] }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="props.stages.length"
|
||||
class="mt-4 grid grid-cols-1 gap-4 min-[1080px]:grid-cols-[repeat(auto-fit,minmax(340px,1fr))]"
|
||||
>
|
||||
<SlowestStagesCard :stages="props.stages" />
|
||||
<StageFailuresCard :stages="props.stages" />
|
||||
</div>
|
||||
<Card v-else class="mt-4">
|
||||
<CardHeader>
|
||||
<CardTitle>Per stage</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Empty>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No stage data yet</EmptyTitle>
|
||||
<EmptyDescription>Stage timing and failures appear here once workflows have run.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -0,0 +1,114 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watchEffect } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { api } from "@/lib/api";
|
||||
import { workflowLabel } from "./labels";
|
||||
|
||||
/** A workflow definition, as far as this form needs it. */
|
||||
interface Definition {
|
||||
id: string;
|
||||
name?: string;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
const props = defineProps<{ definitions: Definition[] }>();
|
||||
|
||||
/** Starting work enters Archie's normal admitted task queue, not a side door. */
|
||||
|
||||
const enabled = computed(() => props.definitions.filter((d) => d.enabled));
|
||||
const defaultWorkflow = computed(() => enabled.value[0]?.id ?? "");
|
||||
|
||||
const identity = ref("");
|
||||
const repository = ref("");
|
||||
const workflow = ref(defaultWorkflow.value);
|
||||
const title = ref("");
|
||||
const instructions = ref("");
|
||||
const submitting = ref(false);
|
||||
const notice = ref("");
|
||||
|
||||
// The definitions arrive after the first render, so the default can only be
|
||||
// applied once they do.
|
||||
watchEffect(() => {
|
||||
if (!workflow.value && defaultWorkflow.value) workflow.value = defaultWorkflow.value;
|
||||
});
|
||||
|
||||
async function submit() {
|
||||
submitting.value = true;
|
||||
notice.value = "";
|
||||
try {
|
||||
const result = await api.workRequest<{ task_id: number }>({
|
||||
identity: identity.value,
|
||||
repository: repository.value,
|
||||
workflow: workflow.value,
|
||||
title: title.value,
|
||||
instructions: instructions.value,
|
||||
});
|
||||
notice.value = `Queued task #${result.task_id}.`;
|
||||
identity.value = "";
|
||||
repository.value = "";
|
||||
workflow.value = defaultWorkflow.value;
|
||||
title.value = "";
|
||||
instructions.value = "";
|
||||
} catch (err) {
|
||||
notice.value = String((err as Error).message || err);
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card class="mb-4">
|
||||
<CardHeader>
|
||||
<CardTitle>Start work</CardTitle>
|
||||
<CardDescription>This enters Archie's normal admitted task queue.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form @submit.prevent="submit">
|
||||
<FieldGroup>
|
||||
<Field>
|
||||
<FieldLabel for="wf-identity">Identity</FieldLabel>
|
||||
<Input id="wf-identity" v-model="identity" required />
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel for="wf-repository">Repository</FieldLabel>
|
||||
<Input id="wf-repository" v-model="repository" placeholder="owner/repository" required />
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel for="wf-workflow">Workflow</FieldLabel>
|
||||
<Select v-model="workflow" required>
|
||||
<SelectTrigger id="wf-workflow">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem v-for="d in enabled" :key="d.id" :value="d.id">
|
||||
{{ workflowLabel(d.name || d.id) }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel for="wf-title">Task title</FieldLabel>
|
||||
<Input id="wf-title" v-model="title" required />
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel for="wf-instructions">Instructions</FieldLabel>
|
||||
<Textarea id="wf-instructions" v-model="instructions" :rows="3" required />
|
||||
</Field>
|
||||
<Field orientation="horizontal">
|
||||
<Button type="submit" :disabled="submitting">Start work</Button>
|
||||
<p v-if="notice" class="text-sm text-fg-muted">{{ notice }}</p>
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -0,0 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { STATUS_FILL, type StatusKind } from "@/lib/status";
|
||||
|
||||
/**
|
||||
* A small proportional bar under a rate. It carries the same shape in every
|
||||
* workflow table so two rates can be compared by eye without reading either.
|
||||
*/
|
||||
const props = withDefaults(defineProps<{ fraction: number; kind?: StatusKind }>(), { kind: "ok" });
|
||||
|
||||
const width = computed(() => `${Math.min(100, Math.max(0, props.fraction))}%`);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mt-2 h-[5px] w-[140px] overflow-hidden rounded-full bg-border">
|
||||
<div class="h-full rounded-full transition-[width]" :class="STATUS_FILL[props.kind]" :style="`width:${width}`" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,60 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { pct, workflowLabel } from "./labels";
|
||||
import WorkflowBar from "./WorkflowBar.vue";
|
||||
import { workflowRows, type WorkflowDefinition, type WorkflowStats } from "./workflow-rows";
|
||||
|
||||
/** Run outcomes per workflow, definitions merged with whatever stats exist. */
|
||||
const props = defineProps<{ workflows: WorkflowStats[]; definitions: WorkflowDefinition[] }>();
|
||||
|
||||
const rows = computed(() => workflowRows(props.workflows, props.definitions));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Per workflow</CardTitle>
|
||||
<CardDescription v-if="rows.length">Success rate is merged tasks over all runs</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Empty v-if="!rows.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No workflow runs yet</EmptyTitle>
|
||||
<EmptyDescription>Stats appear here once a task has run through a workflow.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<Table v-else>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Workflow</TableHead>
|
||||
<TableHead>Origin</TableHead>
|
||||
<TableHead>Runs</TableHead>
|
||||
<TableHead>Success rate</TableHead>
|
||||
<TableHead>Avg tokens</TableHead>
|
||||
<TableHead>Avg steps</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="w in rows" :key="w.workflow">
|
||||
<TableCell class="font-medium">{{ workflowLabel(w.workflow) }}</TableCell>
|
||||
<TableCell class="font-mono">{{ w.origin || "registry" }}</TableCell>
|
||||
<TableCell>{{ `${w.runs} run${w.runs === 1 ? "" : "s"}` }}</TableCell>
|
||||
<TableCell>
|
||||
<div class="flex items-baseline gap-2 text-sm">
|
||||
{{ pct(w.merged, w.runs) }}%
|
||||
<span class="text-xs text-fg-subtle">{{ w.merged }} of {{ w.runs }} merged</span>
|
||||
</div>
|
||||
<WorkflowBar :fraction="pct(w.merged, w.runs)" :kind="pct(w.merged, w.runs) >= 50 ? 'ok' : 'warn'" />
|
||||
</TableCell>
|
||||
<TableCell class="font-mono">{{ w.avg_tokens ? w.avg_tokens.toLocaleString() : "—" }}</TableCell>
|
||||
<TableCell class="font-mono">{{ w.avg_steps ? w.avg_steps.toFixed(1) : "—" }}</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -0,0 +1,72 @@
|
||||
<script setup lang="ts">
|
||||
import { RefreshCw } from "@lucide/vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { api } from "@/lib/api";
|
||||
import StartWorkForm from "./StartWorkForm.vue";
|
||||
import type { StageStats } from "./stages";
|
||||
import StagesSection from "./StagesSection.vue";
|
||||
import WorkflowTable from "./WorkflowTable.vue";
|
||||
import type { WorkflowDefinition, WorkflowStats } from "./workflow-rows";
|
||||
|
||||
/** Run outcomes and spend per workflow, and where stages get stuck. */
|
||||
|
||||
interface WorkflowsResponse {
|
||||
definitions?: WorkflowDefinition[];
|
||||
workflows?: WorkflowStats[];
|
||||
stages?: StageStats[];
|
||||
}
|
||||
|
||||
const definitions = ref<WorkflowDefinition[]>([]);
|
||||
const workflows = ref<WorkflowStats[]>([]);
|
||||
const stages = ref<StageStats[]>([]);
|
||||
const error = ref<string | null>(null);
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
const data = await api.workflows<WorkflowsResponse>();
|
||||
definitions.value = data?.definitions || [];
|
||||
workflows.value = data?.workflows || [];
|
||||
stages.value = data?.stages || [];
|
||||
error.value = null;
|
||||
} catch (err) {
|
||||
error.value = String((err as Error).message || err);
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Workflows" subtitle="Run outcomes and spend per workflow, and where stages get stuck.">
|
||||
<Button variant="outline" @click="load">
|
||||
<RefreshCw data-icon="inline-start" />
|
||||
Refresh
|
||||
</Button>
|
||||
</PageHeader>
|
||||
|
||||
<!-- Starting work needs a definition to start: with none served, the form
|
||||
could only be submitted to fail. -->
|
||||
<StartWorkForm v-if="definitions.length" :definitions="definitions" />
|
||||
|
||||
<Card v-if="error">
|
||||
<CardContent>
|
||||
<Empty>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>Cannot reach archied</EmptyTitle>
|
||||
<EmptyDescription>{{ error }}</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<template v-else>
|
||||
<WorkflowTable :workflows="workflows" :definitions="definitions" />
|
||||
<StagesSection :stages="stages" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,32 @@
|
||||
/** Naming and numbers shared by the workflow tables. */
|
||||
|
||||
const WORKFLOW_LABELS: Record<string, string> = {
|
||||
bootstrap: "Bootstrap",
|
||||
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 "—";
|
||||
if (ms < 1000) return `${ms} ms`;
|
||||
const secs = ms / 1000;
|
||||
if (secs < 60) return `${secs.toFixed(1)} s`;
|
||||
return `${(secs / 60).toFixed(1)} min`;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/** Per-stage timing and failure data, and the two readings the page shows. */
|
||||
|
||||
export interface StageStats {
|
||||
workflow: string;
|
||||
stage: string;
|
||||
runs: number;
|
||||
errors: number;
|
||||
avg_ms?: number;
|
||||
}
|
||||
|
||||
/** Stages by average duration, slowest first. */
|
||||
export function slowestStages(stages: StageStats[]): StageStats[] {
|
||||
return [...stages].sort((a, b) => (b.avg_ms || 0) - (a.avg_ms || 0));
|
||||
}
|
||||
|
||||
/** Only the stages that have failed, and by how much. A stage that has never
|
||||
* errored is not a zero-length row here, it is absent. */
|
||||
export function failingStages(stages: StageStats[]): StageStats[] {
|
||||
return [...stages].filter((s) => s.errors > 0).sort((a, b) => b.errors - a.errors);
|
||||
}
|
||||
|
||||
/** The largest duration in the set, used to scale the bars. */
|
||||
export function maxStageMs(stages: StageStats[]): number {
|
||||
return Math.max(...stages.map((s) => s.avg_ms || 0), 1);
|
||||
}
|
||||
Reference in new issue
Block a user