refactor(ui): build settings, org, task, workflow and dashboard pages from the shared components
This commit is contained in:
77 files changed
+505
-744
No files matched your search
@@ -5,6 +5,7 @@ import { computed, onMounted, ref, watch } from "vue";
|
||||
import { ArrowLeft, Braces, Type } from "@lucide/vue";
|
||||
|
||||
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog";
|
||||
import { Timestamp } from "@/components/ui/timestamp";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
@@ -144,10 +145,6 @@ function resolved(name: string): { value?: string; failure?: string } {
|
||||
return name in values ? { value: shortValue(values[name]) } : {};
|
||||
}
|
||||
|
||||
function when(at?: string): string {
|
||||
return at ? new Date(at).toLocaleString(undefined, { dateStyle: "short", timeStyle: "short" }) : "";
|
||||
}
|
||||
|
||||
// A mapping another binding also reads is left as it is: the edit gets its own.
|
||||
function sharedMapping(id?: string): boolean {
|
||||
return bindings.value.some((b) => b.mapping_id === id && b.id !== props.binding?.id);
|
||||
@@ -282,7 +279,7 @@ const resume = () => transition(api.bindingResume, "pending_approval");
|
||||
<Select v-if="sourceCaptures.length" :model-value="captureId ?? undefined" @update:model-value="captureId = String($event)">
|
||||
<SelectTrigger id="bind-capture" size="sm" class="w-full" aria-label="Example event"><SelectValue placeholder="Pick an event" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="c in sourceCaptures" :key="c.id" :value="String(c.id)">#{{ c.id }} · {{ when(c.received_at) }}{{ c.event_type ? "" : " · unidentified" }}</SelectItem>
|
||||
<SelectItem v-for="c in sourceCaptures" :key="c.id" :value="String(c.id)">#{{ c.id }} · <Timestamp :at="c.received_at" absolute />{{ c.event_type ? "" : " · unidentified" }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<p v-else class="text-xs text-fg-subtle" :title="`Send an event to ${hookURL} and it appears here`">No events</p>
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -27,11 +22,7 @@ const maxMs = computed(() => maxStageMs(props.stages));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Slowest stages</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Section title="Slowest stages" class="mb-0">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
@@ -53,6 +44,5 @@ const maxMs = computed(() => maxStageMs(props.stages));
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Section>
|
||||
</template>
|
||||
@@ -1,12 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import {
|
||||
Empty,
|
||||
EmptyHeader,
|
||||
@@ -31,11 +26,7 @@ const rows = computed(() => failingStages(props.stages));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Most failures</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Section title="Most failures" class="mb-0">
|
||||
<Empty v-if="!rows.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No failures recorded</EmptyTitle>
|
||||
@@ -60,6 +51,5 @@ const rows = computed(() => failingStages(props.stages));
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Section>
|
||||
</template>
|
||||
@@ -117,7 +117,7 @@ const scopedLogs = computed(() => logs.value ? { ...logs.value, entries: (logs.v
|
||||
<p class="text-xs text-fg-muted">Agent's own report · {{ describeTimelineEvent(report).title }}</p>
|
||||
</div>
|
||||
<div v-if="group.tools.length" class="space-y-1">
|
||||
<h4 class="text-xs font-medium text-fg-muted">Tool calls · {{ group.tools.length }}</h4>
|
||||
<h4 class="text-caption font-medium uppercase text-fg-muted">Tool calls · {{ group.tools.length }}</h4>
|
||||
<ol class="divide-y divide-border rounded-md border border-border">
|
||||
<li v-for="(tool, i) in expanded ? group.tools : group.tools.slice(0, 12)" :key="i" class="px-3 py-2">
|
||||
<div class="flex justify-between gap-2 text-xs"><span class="font-mono">{{ tool.data?.tool }}</span><span :class="tool.data?.failed ? 'text-danger' : 'text-fg-muted'">{{ tool.data?.failed ? 'Failed' : 'Returned' }}</span></div>
|
||||
@@ -130,18 +130,18 @@ const scopedLogs = computed(() => logs.value ? { ...logs.value, entries: (logs.v
|
||||
<p v-else-if="group.agents.length" class="text-xs text-fg-muted">{{ group.agents.reduce((sum, agent) => sum + agent.tokens_used, 0).toLocaleString() }} tokens recorded</p>
|
||||
</section>
|
||||
<section v-if="suppressed.length" class="space-y-1">
|
||||
<h3 class="text-xs font-medium text-fg-muted">Skipped in test run</h3>
|
||||
<h3 class="text-caption font-medium uppercase text-fg-muted">Skipped in test run</h3>
|
||||
<ul class="divide-y divide-border rounded-md border border-border">
|
||||
<li v-for="(event, i) in suppressed" :key="i" class="px-3 py-2 text-xs break-words whitespace-pre-wrap">{{ event.detail }}</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="space-y-3">
|
||||
<h3 class="text-xs font-medium text-fg-muted">Captured changes</h3>
|
||||
<h3 class="text-caption font-medium uppercase text-fg-muted">Captured changes</h3>
|
||||
<p v-if="changesError" role="alert" class="text-danger">{{ changesError }}</p>
|
||||
<ChangeCapture v-for="(capture, i) in captures" :key="i" :capture="capture" :task="task" />
|
||||
</section>
|
||||
<section class="space-y-2">
|
||||
<h3 class="text-xs font-medium text-fg-muted">Log</h3>
|
||||
<h3 class="text-caption font-medium uppercase text-fg-muted">Log</h3>
|
||||
<TaskLogs :state="scopedLogs" :attempt="attempt" :filterable="false" />
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { ago } from "@/lib/format";
|
||||
import { Timestamp } from "@/components/ui/timestamp";
|
||||
import { cn } from "@/lib/utils";
|
||||
import WorkflowCanvas from "./WorkflowCanvas.vue";
|
||||
import { lineDiff, stepMarks, type WorkflowRevision } from "./workflow-revisions";
|
||||
@@ -50,7 +51,7 @@ const CHANGE_VARIANTS = { added: "default", edited: "secondary", removed: "destr
|
||||
<span class="font-mono text-xs text-fg-subtle">v{{ item.version }}</span>
|
||||
<Badge :variant="CHANGE_VARIANTS[item.change]">{{ item.change }}</Badge>
|
||||
</span>
|
||||
<span class="mt-0.5 block truncate text-xs text-fg-muted" :title="item.at">{{ item.actor || "unknown" }} · {{ item.source || "unknown" }} · {{ ago(item.at) }}</span>
|
||||
<span class="mt-0.5 block truncate text-xs text-fg-muted" :title="item.at">{{ item.actor || "unknown" }} · {{ item.source || "unknown" }} · <Timestamp :at="item.at" /></span>
|
||||
</button>
|
||||
</li>
|
||||
<li v-if="!revisions.length" class="px-3 py-2 text-sm text-fg-muted">{{ error || "No recorded changes" }}</li>
|
||||
@@ -77,11 +78,11 @@ const CHANGE_VARIANTS = { added: "default", edited: "secondary", removed: "destr
|
||||
><span class="inline-block w-4 select-none text-fg-subtle">{{ line.kind === "add" ? "+" : line.kind === "del" ? "-" : "" }}</span>{{ line.text }}</span></code></pre>
|
||||
<div v-else class="grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2">
|
||||
<div class="flex min-h-0 flex-col gap-1">
|
||||
<span class="text-xs font-medium text-fg-muted">v{{ revision.version }}</span>
|
||||
<span class="text-caption font-medium uppercase text-fg-muted">v{{ revision.version }}</span>
|
||||
<div class="min-h-0 flex-1 max-md:h-72 max-md:flex-none"><WorkflowCanvas :yaml="then" :marks="thenMarks" /></div>
|
||||
</div>
|
||||
<div class="flex min-h-0 flex-col gap-1">
|
||||
<span class="text-xs font-medium text-fg-muted">Current</span>
|
||||
<span class="text-caption font-medium uppercase text-fg-muted">Current</span>
|
||||
<div class="min-h-0 flex-1 max-md:h-72 max-md:flex-none"><WorkflowCanvas :yaml="current" :marks="nowMarks" /></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,10 @@ import {
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { StatusDot } from "@/components/ui/status-dot";
|
||||
import { Table, TableBody, TableCell, TableRow } from "@/components/ui/table";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { api } from "@/lib/api";
|
||||
import { delivered } from "@/lib/delivered";
|
||||
@@ -206,14 +209,14 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<section v-if="!selected && !loading && store.state.resource && !error" class="min-w-0 rounded-lg border border-border bg-card" aria-label="Workflow">
|
||||
<Section v-if="!selected && !loading && store.state.resource && !error" class="mb-0 min-w-0" role="region" aria-label="Workflow">
|
||||
<Empty>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No workflows</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</section>
|
||||
<section v-else-if="selected && store.state.resource" class="min-w-0 rounded-lg border border-border bg-card px-3 py-4 sm:px-5 max-md:flex max-md:h-full max-md:min-h-0 max-md:flex-col" aria-label="Workflow">
|
||||
</Section>
|
||||
<Card v-else-if="selected && store.state.resource" class="min-w-0 px-3 sm:px-5 max-md:flex max-md:h-full max-md:min-h-0 max-md:flex-col" role="region" aria-label="Workflow">
|
||||
<!-- Below lg the list is gone: this picks the workflow instead. -->
|
||||
<header class="mb-2 flex shrink-0 items-center gap-2 lg:hidden">
|
||||
<div class="min-w-0 flex-1"><WorkflowPicker class="w-full" :value="selected" :workflows="rows" label="Workflow" @pick="selected = $event" /></div>
|
||||
@@ -251,16 +254,18 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
||||
<EmptyTitle>No runs yet</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<ul v-else class="divide-y divide-border">
|
||||
<li v-for="t in workflowRuns" :key="t.id" class="flex items-center gap-3 py-2 text-sm">
|
||||
<RouterLink :to="`/tasks/${t.id}`" class="min-w-0 flex-1 truncate hover:underline">{{ t.title || `Task ${t.id}` }}</RouterLink>
|
||||
<span class="hidden font-mono text-xs text-fg-subtle sm:block">{{ t.owner && t.repo ? `${t.owner}/${t.repo}${t.issue_url && t.issue_number ? ` #${t.issue_number}` : ""}` : "" }}</span>
|
||||
<Badge :variant="statusKind(t.status ?? '')">{{ statusLabel(t.status ?? "") }}</Badge>
|
||||
</li>
|
||||
</ul>
|
||||
<Table v-else aria-label="Runs">
|
||||
<TableBody>
|
||||
<TableRow v-for="t in workflowRuns" :key="t.id">
|
||||
<TableCell class="w-full max-w-0 truncate"><RouterLink :to="`/tasks/${t.id}`" class="hover:underline">{{ t.title || `Task ${t.id}` }}</RouterLink></TableCell>
|
||||
<TableCell class="hidden font-mono text-xs text-fg-subtle sm:table-cell">{{ t.owner && t.repo ? `${t.owner}/${t.repo}${t.issue_url && t.issue_number ? ` #${t.issue_number}` : ""}` : "" }}</TableCell>
|
||||
<TableCell class="text-right"><Badge :variant="statusKind(t.status ?? '')">{{ statusLabel(t.status ?? "") }}</Badge></TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</template>
|
||||
</WorkflowEditor>
|
||||
</section>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user