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
@@ -33,7 +33,10 @@ const recognised = computed(() => schema.value === configSchema());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PanelLoading v-if="events === undefined" label="Loading this task's events…" />
|
||||
<PanelLoading
|
||||
v-if="events === undefined"
|
||||
label="Loading this task's events…"
|
||||
/>
|
||||
<PanelError
|
||||
v-else-if="events === null"
|
||||
title="Could not load this task's events"
|
||||
@@ -53,7 +56,9 @@ const recognised = computed(() => schema.value === configSchema());
|
||||
</div>
|
||||
<JsonBlock v-if="recognised" :value="document" />
|
||||
<template v-else>
|
||||
<p class="mb-2 text-sm text-warn">Unknown schema{{ schema ? ` (${schema})` : "" }} — shown verbatim.</p>
|
||||
<p class="mb-2 text-sm text-warn">
|
||||
Unknown schema{{ schema ? ` (${schema})` : "" }} — shown verbatim.
|
||||
</p>
|
||||
<JsonBlock :value="event.data" />
|
||||
</template>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,9 @@ const run = useTaskRun();
|
||||
const attempts = computed(() => run.attempts?.attempts ?? []);
|
||||
|
||||
const selected = computed(() =>
|
||||
attempts.value.findIndex((a) => Number(a.attempt) === Number(run.attemptNumber)),
|
||||
attempts.value.findIndex(
|
||||
(a) => Number(a.attempt) === Number(run.attemptNumber),
|
||||
),
|
||||
);
|
||||
|
||||
const loaded = computed(() => attempts.value.length > 1);
|
||||
@@ -72,4 +74,4 @@ function select(p: number): void {
|
||||
<PaginationNext size="icon-sm" class="border-transparent" />
|
||||
</PaginationContent>
|
||||
</Pagination>
|
||||
</template>
|
||||
</template>
|
||||
@@ -21,24 +21,48 @@ const prNumber = computed(() => props.capture.pr_number);
|
||||
<section>
|
||||
<div class="flex flex-wrap items-baseline justify-between gap-3">
|
||||
<span class="text-sm font-medium">
|
||||
{{ capture.captured_after ? `Captured after ${capture.captured_after}` : "Captured"
|
||||
{{
|
||||
capture.captured_after
|
||||
? `Captured after ${capture.captured_after}`
|
||||
: "Captured"
|
||||
}}<span v-if="capture.stage"> in stage {{ capture.stage }}</span>
|
||||
</span>
|
||||
<span class="text-xs text-fg-muted">{{ capture.captured_at ? ago(capture.captured_at) : "" }}</span>
|
||||
<span class="text-xs text-fg-muted">{{
|
||||
capture.captured_at ? ago(capture.captured_at) : ""
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="mt-2 mb-3 flex flex-wrap items-center gap-3 text-xs text-fg-muted">
|
||||
<div
|
||||
class="mt-2 mb-3 flex flex-wrap items-center gap-3 text-xs text-fg-muted"
|
||||
>
|
||||
<span class="font-mono">
|
||||
<a v-if="links.repo" class="text-link hover:underline" :href="links.repo" target="_blank" rel="noreferrer">
|
||||
<a
|
||||
v-if="links.repo"
|
||||
class="text-link hover:underline"
|
||||
:href="links.repo"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{{ capture.owner }}/{{ capture.repo }}
|
||||
</a>
|
||||
<template v-else>{{ capture.owner || "" }}/{{ capture.repo || "" }}</template>
|
||||
<template v-else
|
||||
>{{ capture.owner || "" }}/{{ capture.repo || "" }}</template
|
||||
>
|
||||
</span>
|
||||
<span v-if="capture.branch" class="font-mono">
|
||||
{{ capture.branch }}<span v-if="capture.base"> → {{ capture.base }}</span>
|
||||
{{ capture.branch
|
||||
}}<span v-if="capture.base"> → {{ capture.base }}</span>
|
||||
</span>
|
||||
<span v-if="capture.head_sha" class="font-mono">{{ String(capture.head_sha).slice(0, 8) }}</span>
|
||||
<span v-if="capture.head_sha" class="font-mono">{{
|
||||
String(capture.head_sha).slice(0, 8)
|
||||
}}</span>
|
||||
<template v-if="prNumber">
|
||||
<a v-if="links.pr" class="text-link hover:underline" :href="links.pr" target="_blank" rel="noreferrer">
|
||||
<a
|
||||
v-if="links.pr"
|
||||
class="text-link hover:underline"
|
||||
:href="links.pr"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
PR #{{ prNumber }}
|
||||
</a>
|
||||
<span v-else class="font-mono">PR #{{ prNumber }}</span>
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
|
||||
import { fileStatusLabel } from "./changed-files";
|
||||
import type { Capture } from "./task-run";
|
||||
@@ -13,12 +20,17 @@ import type { Capture } from "./task-run";
|
||||
const props = defineProps<{ capture: Capture }>();
|
||||
|
||||
const files = computed(() => props.capture.files || []);
|
||||
const total = computed(() => Number(props.capture.totals?.files) || files.value.length);
|
||||
const total = computed(
|
||||
() => Number(props.capture.totals?.files) || files.value.length,
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<p v-if="!files.length" class="py-3 text-xs text-fg-muted">
|
||||
This capture recorded no file entries{{ total ? `, though its totals cover ${total} file${total === 1 ? "" : "s"}` : ""
|
||||
This capture recorded no file entries{{
|
||||
total
|
||||
? `, though its totals cover ${total} file${total === 1 ? "" : "s"}`
|
||||
: ""
|
||||
}}.
|
||||
</p>
|
||||
<template v-else>
|
||||
@@ -34,13 +46,17 @@ const total = computed(() => Number(props.capture.totals?.files) || files.value.
|
||||
<TableBody>
|
||||
<TableRow v-for="(file, i) in files" :key="`${file.path}:${i}`">
|
||||
<TableCell class="font-mono break-all whitespace-normal">
|
||||
<span v-if="file.old_path" class="text-fg-muted">{{ file.old_path }} → </span>{{ file.path }}
|
||||
<span v-if="file.old_path" class="text-fg-muted"
|
||||
>{{ file.old_path }} → </span
|
||||
>{{ file.path }}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{{ fileStatusLabel(file.status) }}
|
||||
<!-- binary means "no textual hunks were recorded", not "this is a
|
||||
binary file on disk": the counts beside it are still real. -->
|
||||
<span v-if="file.binary" class="block text-xs text-fg-muted">no textual hunks</span>
|
||||
<span v-if="file.binary" class="block text-xs text-fg-muted"
|
||||
>no textual hunks</span
|
||||
>
|
||||
</TableCell>
|
||||
<TableCell class="text-right font-mono whitespace-nowrap">
|
||||
{{ file.additions ? `+${file.additions}` : "—" }}
|
||||
@@ -52,7 +68,8 @@ const total = computed(() => Number(props.capture.totals?.files) || files.value.
|
||||
</TableBody>
|
||||
</Table>
|
||||
<p v-if="capture.truncated" class="mt-2 text-xs text-fg-muted">
|
||||
Showing the first {{ files.length }} of {{ total }} files. The totals above cover every file in this capture.
|
||||
Showing the first {{ files.length }} of {{ total }} files. The totals
|
||||
above cover every file in this capture.
|
||||
</p>
|
||||
</template>
|
||||
</template>
|
||||
@@ -25,8 +25,12 @@ const props = defineProps<{
|
||||
const captures = computed(() => props.state?.captures || []);
|
||||
|
||||
// A capture event WAS recorded but its payload could not be read.
|
||||
const undecodable = computed(() => props.state?.found === true && !captures.value.length);
|
||||
const nothingRecorded = computed(() => !props.state?.found || !captures.value.length);
|
||||
const undecodable = computed(
|
||||
() => props.state?.found === true && !captures.value.length,
|
||||
);
|
||||
const nothingRecorded = computed(
|
||||
() => !props.state?.found || !captures.value.length,
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -39,7 +43,9 @@ const nothingRecorded = computed(() => !props.state?.found || !captures.value.le
|
||||
|
||||
<Empty v-else-if="undecodable">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>A change capture was recorded but could not be read</EmptyTitle>
|
||||
<EmptyTitle
|
||||
>A change capture was recorded but could not be read</EmptyTitle
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ defineProps<{
|
||||
state: DebugState | null | undefined;
|
||||
attempt: number | null;
|
||||
}>();
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -29,7 +28,9 @@ defineProps<{
|
||||
detail="archied did not answer for this task's debug view. Live updates will try again when the daemon reconnects."
|
||||
/>
|
||||
<div v-else>
|
||||
<p class="mb-3 text-sm text-fg-muted">The stored record and every event, verbatim.</p>
|
||||
<p class="mb-3 text-sm text-fg-muted">
|
||||
The stored record and every event, verbatim.
|
||||
</p>
|
||||
<JsonBlock :value="state" />
|
||||
</div>
|
||||
</template>
|
||||
+39
-12
@@ -1,7 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
import PanelError from "./PanelError.vue";
|
||||
@@ -30,7 +35,9 @@ const run = useTaskRun();
|
||||
|
||||
const attempts = computed(() => props.state?.attempts || []);
|
||||
|
||||
const attempt = computed(() => attempts.value.find((a) => Number(a.attempt) === Number(run.attemptNumber)));
|
||||
const attempt = computed(() =>
|
||||
attempts.value.find((a) => Number(a.attempt) === Number(run.attemptNumber)),
|
||||
);
|
||||
|
||||
const meta = computed(() => stageStatusMeta(attempt.value?.status));
|
||||
const stages = computed(() => attempt.value?.stages || []);
|
||||
@@ -44,12 +51,17 @@ const stages = computed(() => attempt.value?.stages || []);
|
||||
* nothing to filter on and is not selectable.
|
||||
*/
|
||||
function selectedStage(stage: Stage): boolean {
|
||||
return run.tab === "log" && Boolean(stage.name) && run.filters.stage === stage.name;
|
||||
return (
|
||||
run.tab === "log" && Boolean(stage.name) && run.filters.stage === stage.name
|
||||
);
|
||||
}
|
||||
|
||||
function selectStage(stage: Stage): void {
|
||||
if (!stage.name) return;
|
||||
run.setFilters({ stage: selectedStage(stage) ? "" : stage.name, level: run.filters.level });
|
||||
run.setFilters({
|
||||
stage: selectedStage(stage) ? "" : stage.name,
|
||||
level: run.filters.level,
|
||||
});
|
||||
run.setTab("log");
|
||||
}
|
||||
|
||||
@@ -66,7 +78,10 @@ const startedAt = computed(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PanelLoading v-if="state === undefined" label="Loading this task's attempts…" />
|
||||
<PanelLoading
|
||||
v-if="state === undefined"
|
||||
label="Loading this task's attempts…"
|
||||
/>
|
||||
<PanelError
|
||||
v-else-if="state === null"
|
||||
title="Could not load this task's attempts"
|
||||
@@ -82,7 +97,10 @@ const startedAt = computed(() => {
|
||||
<Empty v-else-if="!attempt">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>Attempt {{ run.attemptNumber }} is not recorded</EmptyTitle>
|
||||
<EmptyDescription>This task recorded attempt {{ attempts.map((a) => a.attempt).join(", ") }}.</EmptyDescription>
|
||||
<EmptyDescription
|
||||
>This task recorded attempt
|
||||
{{ attempts.map((a) => a.attempt).join(", ") }}.</EmptyDescription
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
|
||||
@@ -92,7 +110,10 @@ const startedAt = computed(() => {
|
||||
<Badge :variant="meta.kind">{{ meta.label }}</Badge>
|
||||
<span class="text-xs text-fg-muted">{{ startedAt }}</span>
|
||||
</div>
|
||||
<ol v-if="stages.length" :aria-label="`Stages recorded in attempt ${attempt.attempt}`">
|
||||
<ol
|
||||
v-if="stages.length"
|
||||
:aria-label="`Stages recorded in attempt ${attempt.attempt}`"
|
||||
>
|
||||
<StageRow
|
||||
v-for="(stage, i) in stages"
|
||||
:key="`${stage.seq ?? i}:${stage.name}`"
|
||||
@@ -109,8 +130,9 @@ const startedAt = computed(() => {
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<p class="mt-3 max-w-[70ch] text-xs text-fg-muted">
|
||||
<strong>ok</strong> means the stage returned without error. Archie records no exit code and does not verify
|
||||
that the work was correct, so this is a progress status, not a check result.
|
||||
<strong>ok</strong> means the stage returned without error. Archie
|
||||
records no exit code and does not verify that the work was correct, so
|
||||
this is a progress status, not a check result.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -118,9 +140,14 @@ const startedAt = computed(() => {
|
||||
where every event predates the attempt column answers with no attempts
|
||||
at all, and reporting "No attempts recorded" there without the count
|
||||
would present unattributable history as nothing having happened. -->
|
||||
<p v-if="Number(state.unattributed_events) > 0" class="mt-3 max-w-[70ch] text-xs text-fg-muted">
|
||||
{{ Number(state.unattributed_events) }} event{{ Number(state.unattributed_events) === 1 ? "" : "s" }} on this
|
||||
task predate attempt attribution and cannot be assigned to a run.
|
||||
<p
|
||||
v-if="Number(state.unattributed_events) > 0"
|
||||
class="mt-3 max-w-[70ch] text-xs text-fg-muted"
|
||||
>
|
||||
{{ Number(state.unattributed_events) }} event{{
|
||||
Number(state.unattributed_events) === 1 ? "" : "s"
|
||||
}}
|
||||
on this task predate attempt attribution and cannot be assigned to a run.
|
||||
</p>
|
||||
</template>
|
||||
</template>
|
||||
@@ -26,7 +26,9 @@ const emit = defineEmits<{ select: [] }>();
|
||||
|
||||
const meta = computed(() => stageStatusMeta(props.stage.status));
|
||||
const ran = computed(() => duration(props.stage.duration_ms));
|
||||
const reports = computed(() => agentReports(props.events, props.attemptNumber, props.stage.name));
|
||||
const reports = computed(() =>
|
||||
agentReports(props.events, props.attemptNumber, props.stage.name),
|
||||
);
|
||||
|
||||
// The node carries the status as a shape, the same way the label's own kind
|
||||
// does; the connector behind it is what makes the stages read as one run rather
|
||||
@@ -68,9 +70,15 @@ const nodeClass = computed(() =>
|
||||
<!-- A stage name is one unbroken token often enough that it has to be
|
||||
allowed to break, or a long one pushes the status and duration off
|
||||
the row. -->
|
||||
<span class="min-w-0 font-mono font-medium break-words hover:underline" :class="props.selected ? 'text-primary' : ''">{{ stage.name || "(unnamed stage)" }}</span>
|
||||
<span
|
||||
class="min-w-0 font-mono font-medium break-words hover:underline"
|
||||
:class="props.selected ? 'text-primary' : ''"
|
||||
>{{ stage.name || "(unnamed stage)" }}</span
|
||||
>
|
||||
<Badge :variant="meta.kind">{{ meta.label }}</Badge>
|
||||
<span class="text-xs text-fg-muted">{{ ran ? `ran for ${ran}` : "duration not recorded" }}</span>
|
||||
<span class="text-xs text-fg-muted">{{
|
||||
ran ? `ran for ${ran}` : "duration not recorded"
|
||||
}}</span>
|
||||
</button>
|
||||
<div
|
||||
v-if="stage.error"
|
||||
@@ -78,7 +86,11 @@ const nodeClass = computed(() =>
|
||||
>
|
||||
{{ stage.error }}
|
||||
</div>
|
||||
<div v-for="(report, i) in reports" :key="i" class="mt-2 text-xs text-fg-muted">
|
||||
<div
|
||||
v-for="(report, i) in reports"
|
||||
:key="i"
|
||||
class="mt-2 text-xs text-fg-muted"
|
||||
>
|
||||
<span>Agent's own report, not verified by archie: </span>
|
||||
{{ [report.title, report.detail].filter(Boolean).join(" · ") }}
|
||||
</div>
|
||||
|
||||
@@ -38,19 +38,24 @@ const props = defineProps<{ id?: string; compact?: boolean; class?: string }>();
|
||||
const run = useTaskRun();
|
||||
|
||||
const confirmText = computed(
|
||||
() => `Start a new run for "${run.task?.title || `task ${props.id}`}"? The previous attempt's commits are discarded.`,
|
||||
() =>
|
||||
`Start a new run for "${run.task?.title || `task ${props.id}`}"? The previous attempt's commits are discarded.`,
|
||||
);
|
||||
|
||||
const unavailable = computed(() => {
|
||||
if (run.canRetry || run.taskList === undefined) return "";
|
||||
return run.task ? `New runs start from a parked task. This task is ${statusLabel(run.task.status ?? "")}.` : "";
|
||||
return run.task
|
||||
? `New runs start from a parked task. This task is ${statusLabel(run.task.status ?? "")}.`
|
||||
: "";
|
||||
});
|
||||
|
||||
const errorText = computed(() => {
|
||||
const err = run.retryError;
|
||||
if (!err) return "";
|
||||
if (err.kind === "session-expired") return "Dashboard authentication is required.";
|
||||
if (err.kind === "refused") return `${err.message} — this run cannot be restarted from here.`;
|
||||
if (err.kind === "session-expired")
|
||||
return "Dashboard authentication is required.";
|
||||
if (err.kind === "refused")
|
||||
return `${err.message} — this run cannot be restarted from here.`;
|
||||
return `${err.message} — try again, or check the daemon.`;
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -19,6 +19,8 @@ import { RUN_TABS } from "./task-run";
|
||||
|
||||
<template>
|
||||
<TabsList variant="line" class="w-full justify-start">
|
||||
<TabsTrigger v-for="tab in RUN_TABS" :key="tab.id" :value="tab.id">{{ tab.label }}</TabsTrigger>
|
||||
<TabsTrigger v-for="tab in RUN_TABS" :key="tab.id" :value="tab.id">{{
|
||||
tab.label
|
||||
}}</TabsTrigger>
|
||||
</TabsList>
|
||||
</template>
|
||||
@@ -5,7 +5,12 @@ import { RouterLink } from "vue-router";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
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";
|
||||
|
||||
/**
|
||||
* A run page that cannot be opened, said plainly. There are two ways in: the
|
||||
@@ -40,7 +45,9 @@ const copy = computed(() =>
|
||||
<div>
|
||||
<div class="mb-5 flex flex-wrap items-start justify-between gap-5">
|
||||
<div>
|
||||
<h1 class="text-3xl font-semibold tracking-[-0.03em]">{{ copy.title }}</h1>
|
||||
<h1 class="text-3xl font-semibold tracking-[-0.03em]">
|
||||
{{ copy.title }}
|
||||
</h1>
|
||||
<p class="mt-2 text-sm text-fg-muted">{{ copy.sub }}</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
|
||||
@@ -54,7 +54,9 @@ const run = provideTaskRun(taskId);
|
||||
</TaskMetaBar>
|
||||
<TaskNotes :id="rawId" />
|
||||
|
||||
<div class="grid items-start gap-4 min-[900px]:grid-cols-[20rem_minmax(0,1fr)]">
|
||||
<div
|
||||
class="grid items-start gap-4 min-[900px]:grid-cols-[20rem_minmax(0,1fr)]"
|
||||
>
|
||||
<!--
|
||||
The master pane: the attempt's stage rail, always on screen. It owns
|
||||
its own loading, failure and empty states, so the inspector never has
|
||||
@@ -66,7 +68,11 @@ const run = provideTaskRun(taskId);
|
||||
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Tabs class="gap-4" :model-value="run.tab" @update:model-value="run.setTab">
|
||||
<Tabs
|
||||
class="gap-4"
|
||||
:model-value="run.tab"
|
||||
@update:model-value="run.setTab"
|
||||
>
|
||||
<TabBar />
|
||||
<TaskRunPanels :id="rawId" />
|
||||
</Tabs>
|
||||
|
||||
@@ -2,7 +2,14 @@
|
||||
import { computed } from "vue";
|
||||
|
||||
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 { statusList } from "@/lib/task-meta";
|
||||
|
||||
/**
|
||||
@@ -25,7 +32,10 @@ const emit = defineEmits<{
|
||||
const selected = computed(() => props.status || ALL_STATUSES);
|
||||
|
||||
function selectStatus(value: unknown) {
|
||||
emit("update:status", typeof value === "string" && value !== ALL_STATUSES ? value : "");
|
||||
emit(
|
||||
"update:status",
|
||||
typeof value === "string" && value !== ALL_STATUSES ? value : "",
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -40,14 +50,21 @@ function selectStatus(value: unknown) {
|
||||
@update:model-value="emit('update:search', String($event))"
|
||||
/>
|
||||
<Select :model-value="selected" @update:model-value="selectStatus">
|
||||
<SelectTrigger aria-label="Filter by status" class="w-45 max-[480px]:w-full">
|
||||
<SelectTrigger
|
||||
aria-label="Filter by status"
|
||||
class="w-45 max-[480px]:w-full"
|
||||
>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem :value="ALL_STATUSES">All statuses</SelectItem>
|
||||
<SelectItem value="needs_you">Needs you</SelectItem>
|
||||
<SelectItem v-for="entry in statusList()" :key="entry.id" :value="entry.id">
|
||||
<SelectItem
|
||||
v-for="entry in statusList()"
|
||||
:key="entry.id"
|
||||
:value="entry.id"
|
||||
>
|
||||
{{ entry.label }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
|
||||
@@ -21,7 +21,9 @@ const props = defineProps<{ id: string }>();
|
||||
const run = useTaskRun();
|
||||
|
||||
const title = computed(() => run.task?.title || `Task #${props.id}`);
|
||||
const workflow = computed(() => (run.task?.workflow ? `${run.task.workflow} workflow` : ""));
|
||||
const workflow = computed(() =>
|
||||
run.task?.workflow ? `${run.task.workflow} workflow` : "",
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { LOG_LEVELS } from "@/lib/log";
|
||||
|
||||
import type { LogFilters } from "./task-run";
|
||||
@@ -28,7 +35,12 @@ const props = defineProps<{
|
||||
|
||||
const emit = defineEmits<{ filter: [next: LogFilters] }>();
|
||||
|
||||
const levelOptions = computed(() => LOG_LEVELS.map((level) => ({ value: level.value || ALL, label: level.label })));
|
||||
const levelOptions = computed(() =>
|
||||
LOG_LEVELS.map((level) => ({
|
||||
value: level.value || ALL,
|
||||
label: level.label,
|
||||
})),
|
||||
);
|
||||
const levelValue = computed(() => props.filters.level || ALL);
|
||||
const stageValue = computed(() => props.filters.stage || ALL);
|
||||
|
||||
@@ -47,16 +59,26 @@ function setStage(value: unknown): void {
|
||||
|
||||
<template>
|
||||
<div class="flex flex-wrap items-center gap-3 border-b border-border pb-3">
|
||||
<span class="text-sm font-medium">{{ attempt > 0 ? `Attempt ${attempt}` : "Current attempt" }}</span>
|
||||
<span class="text-sm font-medium">{{
|
||||
attempt > 0 ? `Attempt ${attempt}` : "Current attempt"
|
||||
}}</span>
|
||||
|
||||
<div class="inline-flex items-center gap-2">
|
||||
<Select :model-value="levelValue" aria-label="Filter log entries by level" @update:model-value="setLevel">
|
||||
<Select
|
||||
:model-value="levelValue"
|
||||
aria-label="Filter log entries by level"
|
||||
@update:model-value="setLevel"
|
||||
>
|
||||
<SelectTrigger size="sm">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem v-for="option in levelOptions" :key="option.value" :value="option.value">
|
||||
<SelectItem
|
||||
v-for="option in levelOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
@@ -65,14 +87,20 @@ function setStage(value: unknown): void {
|
||||
</div>
|
||||
|
||||
<div class="inline-flex items-center gap-2">
|
||||
<Select :model-value="stageValue" aria-label="Filter log entries by stage" @update:model-value="setStage">
|
||||
<Select
|
||||
:model-value="stageValue"
|
||||
aria-label="Filter log entries by stage"
|
||||
@update:model-value="setStage"
|
||||
>
|
||||
<SelectTrigger size="sm">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem :value="ALL">All stages</SelectItem>
|
||||
<SelectItem v-for="stage in stages" :key="stage" :value="stage">{{ stage }}</SelectItem>
|
||||
<SelectItem v-for="stage in stages" :key="stage" :value="stage">{{
|
||||
stage
|
||||
}}</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
+45
-12
@@ -48,24 +48,38 @@ const props = withDefaults(
|
||||
|
||||
defineEmits<{ filter: [next: LogFilters] }>();
|
||||
|
||||
const resolvedAttempt = computed(() => Number(props.attempt) || Number(props.state?.attempt) || 0);
|
||||
const resolvedAttempt = computed(
|
||||
() => Number(props.attempt) || Number(props.state?.attempt) || 0,
|
||||
);
|
||||
|
||||
/** The pane's state, decided once so the announcement and the body can never
|
||||
* disagree about which case is on screen. */
|
||||
const view = computed(() => {
|
||||
const state = props.state;
|
||||
if (state === undefined) return { kind: "loading" as const, status: "Loading this attempt's log" };
|
||||
if (state === null) return { kind: "failed" as const, status: "This attempt's log could not be loaded" };
|
||||
if (state === undefined)
|
||||
return { kind: "loading" as const, status: "Loading this attempt's log" };
|
||||
if (state === null)
|
||||
return {
|
||||
kind: "failed" as const,
|
||||
status: "This attempt's log could not be loaded",
|
||||
};
|
||||
// A reader exists in this process but the attempt has no log file. That is a
|
||||
// fact about the attempt, and saying "logging was not enabled" here (which
|
||||
// this panel used to do) told the operator to go and change a setting that
|
||||
// was already correct.
|
||||
if (state.found === false && !state.disabled) {
|
||||
return { kind: "nolog" as const, status: "No log recorded for this attempt" };
|
||||
return {
|
||||
kind: "nolog" as const,
|
||||
status: "No log recorded for this attempt",
|
||||
};
|
||||
}
|
||||
// This process cannot read task logs at all. That IS about the deployment,
|
||||
// and it is the only case where the pane may say so.
|
||||
if (state.disabled) return { kind: "disabled" as const, status: "This dashboard cannot read task logs" };
|
||||
if (state.disabled)
|
||||
return {
|
||||
kind: "disabled" as const,
|
||||
status: "This dashboard cannot read task logs",
|
||||
};
|
||||
const entries = state.entries || [];
|
||||
if (!entries.length) {
|
||||
return {
|
||||
@@ -82,7 +96,12 @@ const view = computed(() => {
|
||||
});
|
||||
|
||||
const download = computed(() =>
|
||||
props.taskId != null ? api.taskLogDownloadURL(String(props.taskId), resolvedAttempt.value || null) : null,
|
||||
props.taskId != null
|
||||
? api.taskLogDownloadURL(
|
||||
String(props.taskId),
|
||||
resolvedAttempt.value || null,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -101,27 +120,39 @@ const download = computed(() =>
|
||||
for the log's lines: putting aria-live on the list itself would read
|
||||
every entry aloud on every load, which for a 500-entry pane is
|
||||
unusable. -->
|
||||
<p class="sr-only" role="status" aria-live="polite" aria-atomic="true">{{ view.status }}</p>
|
||||
<p class="sr-only" role="status" aria-live="polite" aria-atomic="true">
|
||||
{{ view.status }}
|
||||
</p>
|
||||
|
||||
<PanelLoading v-if="view.kind === 'loading'" label="Loading attempt log…" />
|
||||
|
||||
<div v-else-if="view.kind === 'failed'" class="flex flex-col items-start gap-2 py-3">
|
||||
<div
|
||||
v-else-if="view.kind === 'failed'"
|
||||
class="flex flex-col items-start gap-2 py-3"
|
||||
>
|
||||
<p class="text-sm text-fg-muted">
|
||||
Could not load this attempt's log. Live updates will try again when the daemon reconnects.
|
||||
Could not load this attempt's log. Live updates will try again when the
|
||||
daemon reconnects.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Empty v-else-if="view.kind === 'nolog'">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No log recorded for this attempt</EmptyTitle>
|
||||
<EmptyDescription>This attempt produced no output, or it has not started writing yet.</EmptyDescription>
|
||||
<EmptyDescription
|
||||
>This attempt produced no output, or it has not started writing
|
||||
yet.</EmptyDescription
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
|
||||
<Empty v-else-if="view.kind === 'disabled'">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No persisted log for this attempt</EmptyTitle>
|
||||
<EmptyDescription>The log service is not reporting a reader, so the file cannot be read.</EmptyDescription>
|
||||
<EmptyDescription
|
||||
>The log service is not reporting a reader, so the file cannot be
|
||||
read.</EmptyDescription
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
|
||||
@@ -134,7 +165,9 @@ const download = computed(() =>
|
||||
<template v-else>
|
||||
<!-- The detail page's log is the primary content, so it takes a framed
|
||||
read surface of its own and the tallest one on the page. -->
|
||||
<div class="max-h-[62vh] overflow-y-auto rounded-sm border border-border bg-card px-2">
|
||||
<div
|
||||
class="max-h-[62vh] overflow-y-auto rounded-sm border border-border bg-card px-2"
|
||||
>
|
||||
<LogRow v-for="(entry, i) in view.entries" :key="i" :entry="entry" />
|
||||
</div>
|
||||
<Button v-if="download" variant="outline" size="sm" class="mt-3" as-child>
|
||||
|
||||
@@ -20,16 +20,20 @@ const run = useTaskRun();
|
||||
|
||||
// The server owns the status vocabulary and answers with the same five kinds
|
||||
// the Badge draws, which is what makes the cast honest rather than a guess.
|
||||
const taskKind = computed<StatusKind>(() => statusKind(run.task?.status ?? "") as StatusKind);
|
||||
const taskKind = computed<StatusKind>(
|
||||
() => statusKind(run.task?.status ?? "") as StatusKind,
|
||||
);
|
||||
const taskStatusLabel = computed(() => statusLabel(run.task?.status ?? ""));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mb-4 flex flex-wrap items-center gap-3 text-sm">
|
||||
<span v-if="run.taskList === undefined" class="text-fg-muted">loading…</span>
|
||||
<span v-if="run.taskList === undefined" class="text-fg-muted"
|
||||
>loading…</span
|
||||
>
|
||||
<template v-else-if="run.task">
|
||||
<Badge :variant="taskKind">{{ taskStatusLabel }}</Badge>
|
||||
</template>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
@@ -41,7 +41,9 @@ import TaskRowActions from "./TaskRowActions.vue";
|
||||
* link semantics and a keyboard path of its own: every control inside it has to
|
||||
* stop the event on its way out, or activating a button would also navigate.
|
||||
*/
|
||||
const props = withDefaults(defineProps<{ task: Task; showRepo?: boolean }>(), { showRepo: true });
|
||||
const props = withDefaults(defineProps<{ task: Task; showRepo?: boolean }>(), {
|
||||
showRepo: true,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{ done: [taskId: Task["id"]] }>();
|
||||
|
||||
@@ -58,7 +60,9 @@ const parkClassLabels: Record<string, string> = {
|
||||
transient: "transient",
|
||||
terminal: "terminal",
|
||||
};
|
||||
const parkClassLabel = computed(() => parkClassLabels[props.task.park_class ?? ""] ?? "");
|
||||
const parkClassLabel = computed(
|
||||
() => parkClassLabels[props.task.park_class ?? ""] ?? "",
|
||||
);
|
||||
const parkClassTitle = computed(() => {
|
||||
switch (props.task.park_class) {
|
||||
case "transient":
|
||||
@@ -164,11 +168,15 @@ function open() {
|
||||
</Badge>
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell class="text-fg-muted">{{ props.task.workflow || "—" }}</TableCell>
|
||||
<TableCell class="text-fg-muted">{{
|
||||
props.task.workflow || "—"
|
||||
}}</TableCell>
|
||||
<TableCell class="text-fg-muted">{{ props.task.stage || "—" }}</TableCell>
|
||||
<TableCell
|
||||
class="text-fg-muted"
|
||||
:title="props.task.created_at ? `Created ${ago(props.task.created_at)}` : ''"
|
||||
:title="
|
||||
props.task.created_at ? `Created ${ago(props.task.created_at)}` : ''
|
||||
"
|
||||
>
|
||||
{{ ago(props.task.updated_at) }}
|
||||
</TableCell>
|
||||
|
||||
@@ -57,7 +57,10 @@ const controls = computed<Control[]>(() =>
|
||||
(props.task.actions ?? [])
|
||||
.map((id) => actionFor(id))
|
||||
.filter((meta): meta is ActionMeta => meta !== null)
|
||||
.map((meta) => ({ ...meta, href: meta.kind === "link" ? forgeLink(meta.id) : "" })),
|
||||
.map((meta) => ({
|
||||
...meta,
|
||||
href: meta.kind === "link" ? forgeLink(meta.id) : "",
|
||||
})),
|
||||
);
|
||||
|
||||
//
|
||||
@@ -67,17 +70,30 @@ const controls = computed<Control[]>(() =>
|
||||
// of its own; every other non-link control folds behind a '···' menu that runs
|
||||
// the identical request path, and the forge links stay inline after the
|
||||
// primary because they navigate rather than act.
|
||||
const nonLinkControls = computed<Control[]>(() => controls.value.filter((c) => c.kind !== "link"));
|
||||
const primaryControl = computed<Control | null>(() => nonLinkControls.value[0] ?? null);
|
||||
const overflowControls = computed<Control[]>(() => nonLinkControls.value.slice(1));
|
||||
const linkControls = computed<Control[]>(() => controls.value.filter((c) => c.kind === "link"));
|
||||
const nonLinkControls = computed<Control[]>(() =>
|
||||
controls.value.filter((c) => c.kind !== "link"),
|
||||
);
|
||||
const primaryControl = computed<Control | null>(
|
||||
() => nonLinkControls.value[0] ?? null,
|
||||
);
|
||||
const overflowControls = computed<Control[]>(() =>
|
||||
nonLinkControls.value.slice(1),
|
||||
);
|
||||
const linkControls = computed<Control[]>(() =>
|
||||
controls.value.filter((c) => c.kind === "link"),
|
||||
);
|
||||
|
||||
const menuOpen = ref(false);
|
||||
|
||||
const confirmingMeta = computed(() => (confirmingId.value ? actionFor(confirmingId.value) : null));
|
||||
const confirmingMeta = computed(() =>
|
||||
confirmingId.value ? actionFor(confirmingId.value) : null,
|
||||
);
|
||||
const confirmText = computed(() =>
|
||||
confirmingMeta.value?.confirm
|
||||
? confirmingMeta.value.confirm.replaceAll("{title}", props.task.title || "this task")
|
||||
? confirmingMeta.value.confirm.replaceAll(
|
||||
"{title}",
|
||||
props.task.title || "this task",
|
||||
)
|
||||
: "",
|
||||
);
|
||||
const confirmLabel = computed(() => confirmingMeta.value?.label || "Confirm");
|
||||
@@ -88,8 +104,10 @@ const confirmLabel = computed(() => confirmingMeta.value?.label || "Confirm");
|
||||
// shell because they affect every request, not only this row.
|
||||
const errorText = computed(() => {
|
||||
if (!error.value) return "";
|
||||
if (error.value.kind === "session-expired") return "Dashboard authentication is required.";
|
||||
if (error.value.kind === "refused") return `${error.value.message} — you can't do that.`;
|
||||
if (error.value.kind === "session-expired")
|
||||
return "Dashboard authentication is required.";
|
||||
if (error.value.kind === "refused")
|
||||
return `${error.value.message} — you can't do that.`;
|
||||
return `${error.value.message} — try again, or check the daemon.`;
|
||||
});
|
||||
|
||||
@@ -152,7 +170,6 @@ function requestFromMenu(id: string) {
|
||||
menuOpen.value = false;
|
||||
request(id);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -162,7 +179,9 @@ function requestFromMenu(id: string) {
|
||||
variant="destructive"
|
||||
class="w-56 gap-0.5 px-2 py-1.5 text-xs whitespace-normal"
|
||||
>
|
||||
<AlertTitle v-if="error.kind === 'session-expired'" class="text-xs">Authentication required</AlertTitle>
|
||||
<AlertTitle v-if="error.kind === 'session-expired'" class="text-xs"
|
||||
>Authentication required</AlertTitle
|
||||
>
|
||||
<AlertDescription class="text-xs">{{ errorText }}</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
@@ -186,16 +205,34 @@ function requestFromMenu(id: string) {
|
||||
|
||||
<template v-for="control in linkControls" :key="control.id">
|
||||
<Button v-if="control.href" as-child variant="ghost" size="sm">
|
||||
<a :href="control.href" target="_blank" rel="noreferrer" @click.stop>{{ control.label }}</a>
|
||||
<a
|
||||
:href="control.href"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
@click.stop
|
||||
>{{ control.label }}</a
|
||||
>
|
||||
</Button>
|
||||
<Button v-else variant="ghost" size="sm" disabled :title="`${control.label} is unavailable`">
|
||||
<Button
|
||||
v-else
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
disabled
|
||||
:title="`${control.label} is unavailable`"
|
||||
>
|
||||
{{ control.label }}
|
||||
</Button>
|
||||
</template>
|
||||
|
||||
<DropdownMenu v-if="overflowControls.length" v-model:open="menuOpen">
|
||||
<DropdownMenuTrigger as-child>
|
||||
<Button variant="ghost" size="icon-sm" aria-label="More actions" :disabled="inFlight" @click.stop>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
aria-label="More actions"
|
||||
:disabled="inFlight"
|
||||
@click.stop
|
||||
>
|
||||
<Ellipsis :size="14" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
|
||||
@@ -27,7 +27,10 @@ const run = useTaskRun();
|
||||
|
||||
<template>
|
||||
<TabsContent v-for="tab in RUN_TABS" :key="tab.id" :value="tab.id">
|
||||
<PanelLoading v-if="run.attempts === undefined" label="Loading this task's attempts…" />
|
||||
<PanelLoading
|
||||
v-if="run.attempts === undefined"
|
||||
label="Loading this task's attempts…"
|
||||
/>
|
||||
|
||||
<PanelError
|
||||
v-else-if="run.attempts === null"
|
||||
@@ -50,7 +53,11 @@ const run = useTaskRun();
|
||||
@filter="run.setFilters"
|
||||
/>
|
||||
|
||||
<ChangedFiles v-else-if="tab.id === 'changes'" :state="run.changesState" :task="run.task" />
|
||||
<ChangedFiles
|
||||
v-else-if="tab.id === 'changes'"
|
||||
:state="run.changesState"
|
||||
:task="run.task"
|
||||
/>
|
||||
|
||||
<AttemptConfig
|
||||
v-else-if="tab.id === 'config'"
|
||||
@@ -58,6 +65,10 @@ const run = useTaskRun();
|
||||
:attempt="run.attemptNumber"
|
||||
/>
|
||||
|
||||
<DebugView v-else-if="tab.id === 'debug'" :state="run.debugState" :attempt="run.attemptNumber" />
|
||||
<DebugView
|
||||
v-else-if="tab.id === 'debug'"
|
||||
:state="run.debugState"
|
||||
:attempt="run.attemptNumber"
|
||||
/>
|
||||
</TabsContent>
|
||||
</template>
|
||||
@@ -1,7 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import TaskRow, { type Task } from "./TaskRow.vue";
|
||||
|
||||
/**
|
||||
@@ -10,7 +17,10 @@ import TaskRow, { type Task } from "./TaskRow.vue";
|
||||
* The `state` slot is drawn in the body's place so the columns stay announced
|
||||
* while the table has no rows to show.
|
||||
*/
|
||||
const props = withDefaults(defineProps<{ tasks: Task[]; showRepo?: boolean }>(), { showRepo: true });
|
||||
const props = withDefaults(
|
||||
defineProps<{ tasks: Task[]; showRepo?: boolean }>(),
|
||||
{ showRepo: true },
|
||||
);
|
||||
|
||||
const emit = defineEmits<{ done: [taskId: Task["id"]] }>();
|
||||
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
// and is exported so it can be tested directly (jsdom implements neither
|
||||
// matchMedia nor scrollIntoView).
|
||||
export function prefersReducedMotion(): boolean {
|
||||
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches === true;
|
||||
return (
|
||||
typeof window !== "undefined" &&
|
||||
window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches === true
|
||||
);
|
||||
}
|
||||
|
||||
export function revealBehavior(): ScrollBehavior {
|
||||
@@ -17,12 +20,22 @@ export function revealBehavior(): ScrollBehavior {
|
||||
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { api } from "@/lib/api";
|
||||
import { statusList } from "@/lib/task-meta";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import TaskFilters from "./TaskFilters.vue";
|
||||
import { boardStatus, initialTaskFilter, taskMatchesStatus } from "./task-filter";
|
||||
import {
|
||||
boardStatus,
|
||||
initialTaskFilter,
|
||||
taskMatchesStatus,
|
||||
} from "./task-filter";
|
||||
import type { Task } from "./TaskRow.vue";
|
||||
import TaskTable from "./TaskTable.vue";
|
||||
import TasksState from "./TasksState.vue";
|
||||
@@ -43,7 +56,9 @@ const tasks = ref<Task[] | null>(null);
|
||||
const error = ref<string | null>(null);
|
||||
const search = ref("");
|
||||
|
||||
const statusQuery = computed(() => (typeof route.query.status === "string" ? route.query.status : ""));
|
||||
const statusQuery = computed(() =>
|
||||
typeof route.query.status === "string" ? route.query.status : "",
|
||||
);
|
||||
const requestedTaskId = computed(() => {
|
||||
const raw = route.query.task;
|
||||
const id = Number(typeof raw === "string" ? raw : NaN);
|
||||
@@ -63,7 +78,9 @@ const visible = computed(() =>
|
||||
if (!taskMatchesStatus(task, status.value, statusList())) return false;
|
||||
const needle = search.value.trim().toLowerCase();
|
||||
if (!needle) return true;
|
||||
return `${task.title ?? ""} ${task.repo ?? ""}`.toLowerCase().includes(needle);
|
||||
return `${task.title ?? ""} ${task.repo ?? ""}`
|
||||
.toLowerCase()
|
||||
.includes(needle);
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import {
|
||||
Empty,
|
||||
EmptyContent,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
|
||||
/**
|
||||
@@ -18,13 +24,22 @@ const emit = defineEmits<{ clear: [] }>();
|
||||
|
||||
const copy = computed(() => {
|
||||
if (props.kind === "error") {
|
||||
return { title: "Cannot reach archied", description: props.detail || "The daemon did not answer." };
|
||||
return {
|
||||
title: "Cannot reach archied",
|
||||
description: props.detail || "The daemon did not answer.",
|
||||
};
|
||||
}
|
||||
if (props.kind === "empty") {
|
||||
return { title: "No tasks yet", description: "Tasks appear here once archied picks up an issue to work." };
|
||||
return {
|
||||
title: "No tasks yet",
|
||||
description: "Tasks appear here once archied picks up an issue to work.",
|
||||
};
|
||||
}
|
||||
if (props.kind === "no-match") {
|
||||
return { title: "No matching tasks", description: "Try a different search or status filter." };
|
||||
return {
|
||||
title: "No matching tasks",
|
||||
description: "Try a different search or status filter.",
|
||||
};
|
||||
}
|
||||
return { title: "Loading tasks…", description: "" };
|
||||
});
|
||||
@@ -44,7 +59,9 @@ const copy = computed(() => {
|
||||
<EmptyDescription>{{ copy.description }}</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
<EmptyContent v-if="props.kind === 'no-match'">
|
||||
<Button variant="ghost" size="sm" @click="emit('clear')">Clear filters</Button>
|
||||
<Button variant="ghost" size="sm" @click="emit('clear')"
|
||||
>Clear filters</Button
|
||||
>
|
||||
</EmptyContent>
|
||||
</Empty>
|
||||
</template>
|
||||
@@ -23,13 +23,18 @@ const counts = computed(() => {
|
||||
|
||||
const total = computed(() => props.tasks.length);
|
||||
const working = computed(() => counts.value.running ?? 0);
|
||||
const delivered = computed(() => (counts.value.merged ?? 0) + (counts.value.pr_open ?? 0));
|
||||
const delivered = computed(
|
||||
() => (counts.value.merged ?? 0) + (counts.value.pr_open ?? 0),
|
||||
);
|
||||
|
||||
// "Needs you" is the server's grouping, not a local pair of ids: the same set
|
||||
// backs the ?status=needs_you filter, so the tile and the filter cannot drift.
|
||||
const needsYou = computed(() => {
|
||||
const attention = attentionStatusIds();
|
||||
return Object.entries(counts.value).reduce((sum, [status, n]) => (attention.has(status) ? sum + n : sum), 0);
|
||||
return Object.entries(counts.value).reduce(
|
||||
(sum, [status, n]) => (attention.has(status) ? sum + n : sum),
|
||||
0,
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -38,12 +43,16 @@ const needsYou = computed(() => {
|
||||
<StatTile
|
||||
label="Total tasks"
|
||||
:value="total"
|
||||
:compare="total ? 'Everything archied has ever picked up' : 'No tasks yet'"
|
||||
:compare="
|
||||
total ? 'Everything archied has ever picked up' : 'No tasks yet'
|
||||
"
|
||||
/>
|
||||
<StatTile
|
||||
label="Working now"
|
||||
:value="working"
|
||||
:compare="total ? `${working} of ${total} in progress` : 'Nothing running'"
|
||||
:compare="
|
||||
total ? `${working} of ${total} in progress` : 'Nothing running'
|
||||
"
|
||||
/>
|
||||
<StatTile
|
||||
label="Needs you"
|
||||
@@ -54,7 +63,11 @@ const needsYou = computed(() => {
|
||||
<StatTile
|
||||
label="Delivered"
|
||||
:value="delivered"
|
||||
:compare="total ? `${Math.round((delivered / total) * 100)}% of all tasks` : 'No tasks yet'"
|
||||
:compare="
|
||||
total
|
||||
? `${Math.round((delivered / total) * 100)}% of all tasks`
|
||||
: 'No tasks yet'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -28,7 +28,9 @@ const line = computed(() => describeTimelineEvent(props.event));
|
||||
/>
|
||||
<div>
|
||||
<div class="text-sm font-medium">{{ line.title }}</div>
|
||||
<div v-if="line.detail" class="mt-0.5 text-xs text-fg-muted">{{ line.detail }}</div>
|
||||
<div v-if="line.detail" class="mt-0.5 text-xs text-fg-muted">
|
||||
{{ line.detail }}
|
||||
</div>
|
||||
<div class="mt-0.5 text-xs text-fg-subtle">{{ ago(event.at) }}</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -17,7 +17,11 @@ export function selectConfigEvent(
|
||||
attempt: number | null,
|
||||
): TaskEvent | null {
|
||||
return (
|
||||
(events || []).find((ev) => ev && ev.kind === "config_captured" && Number(ev.attempt) === Number(attempt)) ||
|
||||
null
|
||||
(events || []).find(
|
||||
(ev) =>
|
||||
ev &&
|
||||
ev.kind === "config_captured" &&
|
||||
Number(ev.attempt) === Number(attempt),
|
||||
) || null
|
||||
);
|
||||
}
|
||||
@@ -20,10 +20,15 @@ export { changeStatusLabel as fileStatusLabel } from "@/lib/task-meta";
|
||||
* coordinates shows its owner/repo and PR number as text rather than a dead
|
||||
* link.
|
||||
*/
|
||||
export function captureLinks(capture: Capture | undefined, task: TaskRecord | null): { repo: string; pr: string } {
|
||||
export function captureLinks(
|
||||
capture: Capture | undefined,
|
||||
task: TaskRecord | null,
|
||||
): { repo: string; pr: string } {
|
||||
const repo = capture?.repo_url || task?.repo_url || "";
|
||||
const samePR =
|
||||
task && String(task.pr_number ?? "") !== "" && String(task.pr_number) === String(capture?.pr_number ?? "");
|
||||
task &&
|
||||
String(task.pr_number ?? "") !== "" &&
|
||||
String(task.pr_number) === String(capture?.pr_number ?? "");
|
||||
const pr = capture?.pr_url || (samePR ? task?.pr_url || "" : "");
|
||||
return { repo, pr };
|
||||
}
|
||||
|
||||
@@ -28,7 +28,9 @@ const STAGE_STATUS: Record<string, StageStatusMeta> = {
|
||||
};
|
||||
|
||||
export function stageStatusMeta(status?: string | null): StageStatusMeta {
|
||||
return STAGE_STATUS[status ?? ""] || { label: status || "unknown", kind: "idle" };
|
||||
return (
|
||||
STAGE_STATUS[status ?? ""] || { label: status || "unknown", kind: "idle" }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,10 @@ export function taskStatuses(catalog: StatusMeta[]): Set<string> {
|
||||
* operator input, and an unknown status would filter the whole board away with
|
||||
* no control showing why.
|
||||
*/
|
||||
export function initialTaskFilter(requested: string | null | undefined, catalog: StatusMeta[]): string {
|
||||
export function initialTaskFilter(
|
||||
requested: string | null | undefined,
|
||||
catalog: StatusMeta[],
|
||||
): string {
|
||||
return requested && taskStatuses(catalog).has(requested) ? requested : "";
|
||||
}
|
||||
|
||||
@@ -55,6 +58,9 @@ export function taskMatchesStatus(
|
||||
catalog: StatusMeta[],
|
||||
): boolean {
|
||||
if (!status) return true;
|
||||
if (status === "needs_you") return catalog.some((entry) => entry.needs_you && entry.id === (task.status ?? ""));
|
||||
if (status === "needs_you")
|
||||
return catalog.some(
|
||||
(entry) => entry.needs_you && entry.id === (task.status ?? ""),
|
||||
);
|
||||
return task.status === status;
|
||||
}
|
||||
@@ -168,7 +168,9 @@ export function initialTab(query: LocationQuery | undefined): string {
|
||||
* "the current attempt" (taskLogTarget, internal/webui/api_tasks_logs.go), so
|
||||
* it selects the current attempt rather than a nonexistent attempt 0.
|
||||
*/
|
||||
export function initialAttempt(query: LocationQuery | undefined): number | null {
|
||||
export function initialAttempt(
|
||||
query: LocationQuery | undefined,
|
||||
): number | null {
|
||||
const raw = query?.attempt;
|
||||
if (raw == null || raw === "") return null;
|
||||
const n = Number(raw);
|
||||
@@ -176,7 +178,10 @@ export function initialAttempt(query: LocationQuery | undefined): number | null
|
||||
}
|
||||
|
||||
/** The query string a tab and an attempt are addressed by. */
|
||||
export function runQuery(tab: string, attempt: number | null): LocationQueryRaw {
|
||||
export function runQuery(
|
||||
tab: string,
|
||||
attempt: number | null,
|
||||
): LocationQueryRaw {
|
||||
const query: LocationQueryRaw = { tab: tab || RUN_TABS[0].id };
|
||||
if (attempt) query.attempt = String(attempt);
|
||||
return query;
|
||||
@@ -200,5 +205,10 @@ export function logCacheKey(
|
||||
filters: LogFilters = EMPTY_LOG_FILTERS,
|
||||
): string {
|
||||
const applied = filters || EMPTY_LOG_FILTERS;
|
||||
return [id, Number(attempt) || 0, applied.level || "", applied.stage || ""].join("|");
|
||||
return [
|
||||
id,
|
||||
Number(attempt) || 0,
|
||||
applied.level || "",
|
||||
applied.stage || "",
|
||||
].join("|");
|
||||
}
|
||||
@@ -25,7 +25,8 @@ export function duration(milliseconds: unknown): string {
|
||||
const roundedSeconds = Math.round(seconds);
|
||||
const minutes = Math.floor(roundedSeconds / 60);
|
||||
const remSec = roundedSeconds % 60;
|
||||
if (minutes < 60) return remSec === 0 ? `${minutes} min` : `${minutes} min ${remSec} s`;
|
||||
if (minutes < 60)
|
||||
return remSec === 0 ? `${minutes} min` : `${minutes} min ${remSec} s`;
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const remMin = minutes - hours * 60;
|
||||
return remMin === 0 ? `${hours} h` : `${hours} h ${remMin} min`;
|
||||
@@ -62,7 +63,9 @@ export function describeTimelineEvent(ev: TaskEvent = {}): TimelineLine {
|
||||
}
|
||||
if (ev.kind === "stage_finish") {
|
||||
const elapsed = duration(data.duration_ms);
|
||||
const context = [workflow, elapsed && `ran for ${elapsed}`].filter(Boolean).join(" · ");
|
||||
const context = [workflow, elapsed && `ran for ${elapsed}`]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
return {
|
||||
title: data.interrupted
|
||||
? `Stage interrupted: ${stage}`
|
||||
@@ -74,8 +77,14 @@ export function describeTimelineEvent(ev: TaskEvent = {}): TimelineLine {
|
||||
}
|
||||
if (ev.kind === "task_retried") {
|
||||
const retryCount = Number(data.retry_count);
|
||||
const attempt = Number.isFinite(retryCount) && retryCount > 0 ? `Retry ${retryCount}` : "Retry requested";
|
||||
const previous = [text(data.previous_stage) && `after ${text(data.previous_stage)}`, text(data.previous_reason)]
|
||||
const attempt =
|
||||
Number.isFinite(retryCount) && retryCount > 0
|
||||
? `Retry ${retryCount}`
|
||||
: "Retry requested";
|
||||
const previous = [
|
||||
text(data.previous_stage) && `after ${text(data.previous_stage)}`,
|
||||
text(data.previous_reason),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(": ");
|
||||
return { title: attempt, detail: previous || ev.detail || "" };
|
||||
@@ -116,15 +125,26 @@ export function describeTimelineEvent(ev: TaskEvent = {}): TimelineLine {
|
||||
}
|
||||
if (ev.kind === "unsigned_event") {
|
||||
const source = text(data.source);
|
||||
return { title: "Started by an unsigned event", detail: source ? `source ${source}` : "", tone: "warn" };
|
||||
return {
|
||||
title: "Started by an unsigned event",
|
||||
detail: source ? `source ${source}` : "",
|
||||
tone: "warn",
|
||||
};
|
||||
}
|
||||
if (ev.kind === "changes_captured") {
|
||||
const totals = (data.totals ?? {}) as { files?: unknown };
|
||||
const fileCount = Number(totals.files);
|
||||
const files =
|
||||
Number.isFinite(fileCount) && fileCount > 0 ? `${fileCount} file${fileCount === 1 ? "" : "s"} changed` : "";
|
||||
const after = data.captured_after ? `captured after ${text(data.captured_after)}` : "";
|
||||
return { title: "Change capture recorded", detail: [files, after].filter(Boolean).join(" · ") };
|
||||
Number.isFinite(fileCount) && fileCount > 0
|
||||
? `${fileCount} file${fileCount === 1 ? "" : "s"} changed`
|
||||
: "";
|
||||
const after = data.captured_after
|
||||
? `captured after ${text(data.captured_after)}`
|
||||
: "";
|
||||
return {
|
||||
title: "Change capture recorded",
|
||||
detail: [files, after].filter(Boolean).join(" · "),
|
||||
};
|
||||
}
|
||||
|
||||
return { title: words(ev.kind || ev.type), detail: ev.detail || "" };
|
||||
|
||||
@@ -10,7 +10,18 @@
|
||||
* belongs to, so a late response for an attempt the operator has already left
|
||||
* lands under its own key and is never shown against another attempt.
|
||||
*/
|
||||
import { computed, inject, onMounted, provide, reactive, ref, watch, type ComputedRef, type InjectionKey, type Ref } from "vue";
|
||||
import {
|
||||
computed,
|
||||
inject,
|
||||
onMounted,
|
||||
provide,
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
type ComputedRef,
|
||||
type InjectionKey,
|
||||
type Ref,
|
||||
} from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import { api, classifyActionError, type ActionErrorKind } from "@/lib/api";
|
||||
@@ -107,25 +118,41 @@ export function provideTaskRun(id: ComputedRef<number | null>): TaskRun {
|
||||
: null,
|
||||
);
|
||||
const currentAttempt = computed<number | null>(() =>
|
||||
Number(attempts.value?.current_attempt) > 0 ? Number(attempts.value?.current_attempt) : null,
|
||||
Number(attempts.value?.current_attempt) > 0
|
||||
? Number(attempts.value?.current_attempt)
|
||||
: null,
|
||||
);
|
||||
// The wire spells "the task's current attempt" as 0, which is not an attempt
|
||||
// number: a task with no run at all must not address attempt 0.
|
||||
const attemptNumber = computed<number | null>(() => requestedAttempt.value ?? currentAttempt.value);
|
||||
const attemptNumber = computed<number | null>(
|
||||
() => requestedAttempt.value ?? currentAttempt.value,
|
||||
);
|
||||
const selectedAttempt = computed(() =>
|
||||
(attempts.value?.attempts || []).find((a) => Number(a.attempt) === Number(attemptNumber.value)),
|
||||
(attempts.value?.attempts || []).find(
|
||||
(a) => Number(a.attempt) === Number(attemptNumber.value),
|
||||
),
|
||||
);
|
||||
const stageNames = computed(() => [
|
||||
...new Set((selectedAttempt.value?.stages || []).map((stage) => stage.name).filter(Boolean) as string[]),
|
||||
...new Set(
|
||||
(selectedAttempt.value?.stages || [])
|
||||
.map((stage) => stage.name)
|
||||
.filter(Boolean) as string[],
|
||||
),
|
||||
]);
|
||||
|
||||
const retryMeta = computed(() => actionFor("retry"));
|
||||
const canRetry = computed(() => Boolean(retryMeta.value && (task.value?.actions || []).includes("retry")));
|
||||
const canRetry = computed(() =>
|
||||
Boolean(retryMeta.value && (task.value?.actions || []).includes("retry")),
|
||||
);
|
||||
|
||||
const logKey = computed(() =>
|
||||
id.value == null || attemptNumber.value == null ? null : logCacheKey(id.value, attemptNumber.value, filters.value),
|
||||
id.value == null || attemptNumber.value == null
|
||||
? null
|
||||
: logCacheKey(id.value, attemptNumber.value, filters.value),
|
||||
);
|
||||
const changeKey = computed(() =>
|
||||
id.value == null ? null : attemptKey(id.value, attemptNumber.value),
|
||||
);
|
||||
const changeKey = computed(() => (id.value == null ? null : attemptKey(id.value, attemptNumber.value)));
|
||||
const debugKey = changeKey;
|
||||
|
||||
const logState = computed<LogState | null | undefined>(() =>
|
||||
@@ -370,6 +397,7 @@ export function provideTaskRun(id: ComputedRef<number | null>): TaskRun {
|
||||
/** The run state provided by the nearest TaskDetailPage. */
|
||||
export function useTaskRun(): TaskRun {
|
||||
const run = inject(TASK_RUN);
|
||||
if (!run) throw new Error("useTaskRun() must be called under a TaskDetailPage");
|
||||
if (!run)
|
||||
throw new Error("useTaskRun() must be called under a TaskDetailPage");
|
||||
return run;
|
||||
}
|
||||
Reference in new issue
Block a user