refactor: format markdown files using prettier, fix spelling concerns, reduce Taskfile bloat
This commit is contained in:
608 files changed
+63317
-10219
No files matched your search
@@ -1,8 +1,21 @@
|
||||
<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 {
|
||||
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";
|
||||
@@ -18,7 +31,9 @@ const maxMs = computed(() => maxStageMs(props.stages));
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Slowest stages</CardTitle>
|
||||
<CardDescription>Average duration, this workflow's stages</CardDescription>
|
||||
<CardDescription
|
||||
>Average duration, this workflow's stages</CardDescription
|
||||
>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Table>
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
<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 {
|
||||
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";
|
||||
@@ -24,7 +42,9 @@ const rows = computed(() => failingStages(props.stages));
|
||||
<Empty v-if="!rows.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No failures recorded</EmptyTitle>
|
||||
<EmptyDescription>Every stage has completed cleanly so far.</EmptyDescription>
|
||||
<EmptyDescription
|
||||
>Every stage has completed cleanly so far.</EmptyDescription
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<Table v-else>
|
||||
|
||||
@@ -2,10 +2,23 @@
|
||||
import { computed, ref, watchEffect } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
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 {
|
||||
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";
|
||||
@@ -35,7 +48,8 @@ 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;
|
||||
if (!workflow.value && defaultWorkflow.value)
|
||||
workflow.value = defaultWorkflow.value;
|
||||
});
|
||||
|
||||
async function submit() {
|
||||
@@ -67,7 +81,9 @@ async function submit() {
|
||||
<Card class="mb-4">
|
||||
<CardHeader>
|
||||
<CardTitle>Start work</CardTitle>
|
||||
<CardDescription>This enters Archie's normal admitted task queue.</CardDescription>
|
||||
<CardDescription
|
||||
>This enters Archie's normal admitted task queue.</CardDescription
|
||||
>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form @submit.prevent="submit">
|
||||
@@ -78,7 +94,12 @@ async function submit() {
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel for="wf-repository">Repository</FieldLabel>
|
||||
<Input id="wf-repository" v-model="repository" placeholder="owner/repository" required />
|
||||
<Input
|
||||
id="wf-repository"
|
||||
v-model="repository"
|
||||
placeholder="owner/repository"
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel for="wf-workflow">Workflow</FieldLabel>
|
||||
@@ -101,7 +122,12 @@ async function submit() {
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel for="wf-instructions">Instructions</FieldLabel>
|
||||
<Textarea id="wf-instructions" v-model="instructions" :rows="3" required />
|
||||
<Textarea
|
||||
id="wf-instructions"
|
||||
v-model="instructions"
|
||||
:rows="3"
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
<Field orientation="horizontal">
|
||||
<Button type="submit" :disabled="submitting">Start work</Button>
|
||||
|
||||
@@ -7,13 +7,20 @@ 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 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
|
||||
class="h-full rounded-full transition-[width]"
|
||||
:class="STATUS_FILL[props.kind]"
|
||||
:style="`width:${width}`"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -6,7 +6,13 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import {
|
||||
@@ -20,25 +26,38 @@ import ConfigCard from "@/settings/ConfigCard.vue";
|
||||
|
||||
const store = useControlPlaneStore();
|
||||
const state = computed(() => store.stateFor("workflow-definitions"));
|
||||
const collection = computed(() => (state.value.resource?.value as WorkflowDefinitionCollection | undefined) ?? { definitions: [] });
|
||||
const shipped = computed<WorkflowDefinitionCollection>(() => store.shippedWorkflows());
|
||||
const collection = computed(
|
||||
() =>
|
||||
(state.value.resource?.value as
|
||||
WorkflowDefinitionCollection | undefined) ?? { definitions: [] },
|
||||
);
|
||||
const shipped = computed<WorkflowDefinitionCollection>(() =>
|
||||
store.shippedWorkflows(),
|
||||
);
|
||||
const selected = ref("");
|
||||
const id = ref("");
|
||||
const yaml = ref("");
|
||||
const localError = ref("");
|
||||
|
||||
const shippedEntry = computed(() => shipped.value.definitions.find((entry) => entry.id === id.value));
|
||||
const shippedEntry = computed(() =>
|
||||
shipped.value.definitions.find((entry) => entry.id === id.value),
|
||||
);
|
||||
|
||||
watchEffect(() => {
|
||||
const entries = collection.value.definitions;
|
||||
if (entries.length && (!selected.value || !entries.some((entry) => entry.id === selected.value))) {
|
||||
if (
|
||||
entries.length &&
|
||||
(!selected.value || !entries.some((entry) => entry.id === selected.value))
|
||||
) {
|
||||
select(entries[0].id);
|
||||
}
|
||||
});
|
||||
|
||||
function select(value: string): void {
|
||||
selected.value = value;
|
||||
const entry = collection.value.definitions.find((candidate) => candidate.id === value);
|
||||
const entry = collection.value.definitions.find(
|
||||
(candidate) => candidate.id === value,
|
||||
);
|
||||
id.value = entry?.id ?? value;
|
||||
yaml.value = entry?.yaml ?? `id: ${value}\nsteps:\n - type: `;
|
||||
localError.value = "";
|
||||
@@ -46,7 +65,12 @@ function select(value: string): void {
|
||||
|
||||
function create(): void {
|
||||
let index = 1;
|
||||
while (collection.value.definitions.some((entry) => entry.id === `workflow-${index}`)) index++;
|
||||
while (
|
||||
collection.value.definitions.some(
|
||||
(entry) => entry.id === `workflow-${index}`,
|
||||
)
|
||||
)
|
||||
index++;
|
||||
select(`workflow-${index}`);
|
||||
}
|
||||
|
||||
@@ -57,15 +81,26 @@ async function save(next: WorkflowDefinitionCollection): Promise<boolean> {
|
||||
|
||||
async function saveDraft(): Promise<void> {
|
||||
const nextID = id.value.trim();
|
||||
if (!nextID) { localError.value = "Workflow ID is required."; return; }
|
||||
if (!nextID) {
|
||||
localError.value = "Workflow ID is required.";
|
||||
return;
|
||||
}
|
||||
const previous = selected.value;
|
||||
let next = collection.value;
|
||||
if (previous && previous !== nextID) next = removeWorkflowDefinition(next, previous);
|
||||
if (await save(upsertWorkflowDefinition(next, { id: nextID, yaml: yaml.value }))) selected.value = nextID;
|
||||
if (previous && previous !== nextID)
|
||||
next = removeWorkflowDefinition(next, previous);
|
||||
if (
|
||||
await save(upsertWorkflowDefinition(next, { id: nextID, yaml: yaml.value }))
|
||||
)
|
||||
selected.value = nextID;
|
||||
}
|
||||
|
||||
async function remove(): Promise<void> {
|
||||
if (!selected.value || !await save(removeWorkflowDefinition(collection.value, selected.value))) return;
|
||||
if (
|
||||
!selected.value ||
|
||||
!(await save(removeWorkflowDefinition(collection.value, selected.value)))
|
||||
)
|
||||
return;
|
||||
selected.value = "";
|
||||
id.value = "";
|
||||
yaml.value = "";
|
||||
@@ -73,45 +108,108 @@ async function remove(): Promise<void> {
|
||||
|
||||
async function restoreOne(): Promise<void> {
|
||||
if (!shippedEntry.value) return;
|
||||
await save(upsertWorkflowDefinition(collection.value, cloneControlPlaneValue(shippedEntry.value)));
|
||||
await save(
|
||||
upsertWorkflowDefinition(
|
||||
collection.value,
|
||||
cloneControlPlaneValue(shippedEntry.value),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
async function restoreAll(): Promise<void> {
|
||||
if (await save(cloneControlPlaneValue(shipped.value))) select(shipped.value.definitions[0]?.id ?? "");
|
||||
if (await save(cloneControlPlaneValue(shipped.value)))
|
||||
select(shipped.value.definitions[0]?.id ?? "");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigCard title="Definitions">
|
||||
<div class="mb-4 flex flex-wrap items-center gap-2">
|
||||
<Select :model-value="selected" @update:model-value="select(String($event))">
|
||||
<SelectTrigger class="min-w-56"><SelectValue placeholder="Select workflow" /></SelectTrigger>
|
||||
<SelectContent><SelectItem v-for="entry in collection.definitions" :key="entry.id" :value="entry.id">{{ entry.id }}</SelectItem></SelectContent>
|
||||
<Select
|
||||
:model-value="selected"
|
||||
@update:model-value="select(String($event))"
|
||||
>
|
||||
<SelectTrigger class="min-w-56"
|
||||
><SelectValue placeholder="Select workflow"
|
||||
/></SelectTrigger>
|
||||
<SelectContent
|
||||
><SelectItem
|
||||
v-for="entry in collection.definitions"
|
||||
:key="entry.id"
|
||||
:value="entry.id"
|
||||
>{{ entry.id }}</SelectItem
|
||||
></SelectContent
|
||||
>
|
||||
</Select>
|
||||
<Button type="button" variant="outline" @click="create"><Plus /> New</Button>
|
||||
<Button type="button" variant="outline" :disabled="!shipped.definitions.length" @click="restoreAll"><RotateCcw /> Restore shipped</Button>
|
||||
<Button type="button" variant="outline" @click="create"
|
||||
><Plus /> New</Button
|
||||
>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
:disabled="!shipped.definitions.length"
|
||||
@click="restoreAll"
|
||||
><RotateCcw /> Restore shipped</Button
|
||||
>
|
||||
</div>
|
||||
|
||||
<form class="space-y-4" @submit.prevent="saveDraft">
|
||||
<div class="space-y-1.5">
|
||||
<Label for="workflow-id">ID</Label>
|
||||
<Input id="workflow-id" v-model="id" name="workflow-id" required autocomplete="off" />
|
||||
<Input
|
||||
id="workflow-id"
|
||||
v-model="id"
|
||||
name="workflow-id"
|
||||
required
|
||||
autocomplete="off"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<Label for="workflow-yaml">YAML</Label>
|
||||
<Textarea id="workflow-yaml" v-model="yaml" name="workflow-yaml" required class="min-h-80 resize-y font-mono" spellcheck="false" />
|
||||
<Textarea
|
||||
id="workflow-yaml"
|
||||
v-model="yaml"
|
||||
name="workflow-yaml"
|
||||
required
|
||||
class="min-h-80 resize-y font-mono"
|
||||
spellcheck="false"
|
||||
/>
|
||||
</div>
|
||||
<p v-if="localError || state.error" class="text-sm text-destructive" role="alert">{{ localError || state.error }}</p>
|
||||
<p
|
||||
v-if="localError || state.error"
|
||||
class="text-sm text-destructive"
|
||||
role="alert"
|
||||
>
|
||||
{{ localError || state.error }}
|
||||
</p>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<Badge :variant="state.stream === 'live' ? 'ok' : 'warn'">{{ state.stream === 'live' ? 'Live' : 'Connecting' }}</Badge>
|
||||
<span v-if="state.resource" class="text-xs text-muted-foreground">Version {{ state.resource.version }}</span>
|
||||
<Badge :variant="state.stream === 'live' ? 'ok' : 'warn'">{{
|
||||
state.stream === "live" ? "Live" : "Connecting"
|
||||
}}</Badge>
|
||||
<span v-if="state.resource" class="text-xs text-muted-foreground"
|
||||
>Version {{ state.resource.version }}</span
|
||||
>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<Button v-if="shippedEntry" type="button" variant="outline" @click="restoreOne"><RotateCcw /> Restore this workflow</Button>
|
||||
<Button v-if="selected" type="button" variant="destructive" @click="remove"><Trash2 /> Remove</Button>
|
||||
<Button type="submit" :disabled="state.saving"><Spinner v-if="state.saving" data-icon="inline-start" /> Validate & save</Button>
|
||||
<Button
|
||||
v-if="shippedEntry"
|
||||
type="button"
|
||||
variant="outline"
|
||||
@click="restoreOne"
|
||||
><RotateCcw /> Restore this workflow</Button
|
||||
>
|
||||
<Button
|
||||
v-if="selected"
|
||||
type="button"
|
||||
variant="destructive"
|
||||
@click="remove"
|
||||
><Trash2 /> Remove</Button
|
||||
>
|
||||
<Button type="submit" :disabled="state.saving"
|
||||
><Spinner v-if="state.saving" data-icon="inline-start" /> Validate &
|
||||
save</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,15 +1,40 @@
|
||||
<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 {
|
||||
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";
|
||||
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 props = defineProps<{
|
||||
workflows: WorkflowStats[];
|
||||
definitions: WorkflowDefinition[];
|
||||
}>();
|
||||
|
||||
const rows = computed(() => workflowRows(props.workflows, props.definitions));
|
||||
</script>
|
||||
@@ -18,13 +43,18 @@ const rows = computed(() => workflowRows(props.workflows, props.definitions));
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Per workflow</CardTitle>
|
||||
<CardDescription v-if="rows.length">Success rate is merged tasks over all runs</CardDescription>
|
||||
<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>
|
||||
<EmptyDescription
|
||||
>Stats appear here once a task has run through a
|
||||
workflow.</EmptyDescription
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<Table v-else>
|
||||
@@ -40,18 +70,33 @@ const rows = computed(() => workflowRows(props.workflows, props.definitions));
|
||||
</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 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>
|
||||
<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'" />
|
||||
<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>
|
||||
<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>
|
||||
|
||||
@@ -3,7 +3,12 @@ import { onMounted, ref } from "vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { api } from "@/lib/api";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import { useControlPlaneStore } from "@/stores/control-plane";
|
||||
@@ -39,7 +44,9 @@ async function load() {
|
||||
}
|
||||
|
||||
useLiveResource("tasks", () => void load(), 500);
|
||||
onMounted(async () => { await Promise.all([load(), controlPlane.load()]); });
|
||||
onMounted(async () => {
|
||||
await Promise.all([load(), controlPlane.load()]);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -18,7 +18,10 @@ export function workflowLabel(name: string | undefined | null): string {
|
||||
|
||||
/** 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 {
|
||||
export function pct(
|
||||
part: number | undefined | null,
|
||||
whole: number | undefined | null,
|
||||
): number {
|
||||
if (!whole || !part) return 0;
|
||||
return Math.round((part / whole) * 100);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ export function slowestStages(stages: StageStats[]): StageStats[] {
|
||||
/** 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);
|
||||
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. */
|
||||
|
||||
@@ -55,7 +55,11 @@ export function workflowRows(
|
||||
claimed.add(definition.id);
|
||||
rows.push({
|
||||
...definition,
|
||||
...(stats.get(definition.id) || { workflow: definition.id, runs: 0, merged: 0 }),
|
||||
...(stats.get(definition.id) || {
|
||||
workflow: definition.id,
|
||||
runs: 0,
|
||||
merged: 0,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user