Files
archie/ui/src/tasks/TaskHeader.vue
T
sam 2237b38b3a fix(ui/topbar): replace Jump to with a command palette, drop filler chrome (#1650)
* fix(ui/topbar): replace Jump to with a command palette, drop filler chrome

Jump to opens a shadcn-vue Command dialog that finds pages, tasks and
workflows by name. The connection indicator shows only when the stream is
lost, the dead documentation link is gone, and the profile menu label has
no stray whitespace.

* fix(ui): trim stray whitespace from template text and drop em dashes from copy

Element text that started or ended with a line break rendered with leading
and trailing spaces. Also removes the unused 'soon' nav state and the nav
group components no route reaches.

* fix(ui): drop the space a hidden spinner left before button text

* fix(ui/status): one dense Status page, full-width settings, problems-only apply status

Status drops its tabs and the duplicate health card; services list only
what is wrong. Settings pages use the full width, the resizable sidebar
handle is gone, and apply status shows only processes that have not
applied a change. PageHeader puts the title and actions on one line.

* refactor(ui): use shadcn ToggleGroup and Badge, drop SegmentedControl and StatusPill

Status badges show only when a state needs attention: no Running, Enabled,
Active, Listening or live pills next to healthy rows. Removes the unused
pagination, radio-group and scroll-area components.

* fix(ui/history): use the shadcn Table with fixed columns so nothing is clipped

* fix(ui/workflows): apply ?workflow= only once the workflow is listed

Selecting it before the definitions loaded opened an empty canvas.

* refactor(ui/workflows): use shadcn Input, NativeSelect, Checkbox and Button in editors

Replaces hand-rolled inputs, selects, the repository mode switch and icon
buttons in the workflow editor, bind dialog, harness page, sources panel
and review gate. Adds the upstream shadcn-vue NativeSelect.

* style(ui): rounded-rectangle controls instead of pills

Halves the radius scale so inputs, selects and buttons stop reading as
pills, and badges and chips lose their full rounding.

* fix(ui/alerts): centre the bell's failed state and stop it contradicting Needs you

* fix(ui/tasks): one header line, aligned columns, no placeholder issue numbers

Tasks puts its filters beside the title and drops the stat tiles the
dashboard already shows. Sort headers align with their cells, chat tasks
no longer show their synthetic issue number, and Logs and the task
not-found page use the shared header.

* fix(ui/dashboard): shared header and cards, empty cards stay silent

Needs you uses the shadcn Card and drops its duplicate Open button; quality
gates and token outlook render only when there is something to show; the
throughput strip moves into the dashboard, its only user.

* refactor(ui/stores): one Pinia store per feature

Splits the site-wide control-plane store and the module-level refs into
settings, workflows, tasks, events, org and session stores. Identity
requests move into lib/api. Drops store fields nothing read: per-resource
stream state, the states map and loadApplyStatus.

* fix(ui/org): one header for the org area, sections drop their repeated titles

The org name is the page title with the admin's org switcher and New org
beside it; Members and Workspaces tables sit in cards like other pages.

* fix(ui/events): shadcn Tabs for the capture, map and bind steps

Replaces the numbered step strip with line tabs that carry each step's
count; the Listening pill is gone and Capture off shows only when it is.

* fix(ui/workflows): confirm a workflow delete in an AlertDialog, not window.confirm

* style(ui/settings): denser setting rows
2026-10-12 04:40:21 +11:00

128 lines
4.9 KiB
Vue

<script setup lang="ts">
import { computed } from "vue";
import { ArrowUpRight, CircleAlert } from "@lucide/vue";
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb";
import { Badge } from "@/components/ui/badge";
import { statusKind, statusLabel } from "@/lib/task-meta";
import DispatchLinks from "@/bindings/DispatchLinks.vue";
import StartNewRun from "./StartNewRun.vue";
import TaskRowActions from "./TaskRowActions.vue";
import { shownActionIds } from "./task-actions";
import { useTaskRun } from "./use-task-run";
/**
* The task's head: where it sits, what it is, its state and forge links, and
* the page's one decision, starting a new run. A parked task opens with the
* reason it stopped.
*/
const props = defineProps<{ id: string }>();
const run = useTaskRun();
const title = computed(() => run.task?.title || `Task #${props.id}`);
const status = computed(() => run.task?.status ?? "");
const parked = computed(() => status.value === "parked" && !!run.task?.park_reason);
// The head has room for one control: the reap an operator reaches for once a
// task is finished with. Whether this task offers it at all is the server's
// action list, never this page's opinion about the status.
const HEAD_ACTIONS = ["archive", "merge"];
// The run's inputs and written outputs, one row per name.
const io = computed(() => {
const rows = (prefix: string, values?: Record<string, unknown>) =>
Object.entries(values ?? {}).map(([name, value]) => ({
label: `${prefix} ${name}`,
value: typeof value === "string" ? value : JSON.stringify(value),
}));
return [...rows("input", run.attempts?.inputs), ...rows("output", run.attempts?.outputs)];
});
const headerActions = computed(() =>
shownActionIds(run.task?.actions, HEAD_ACTIONS),
);
</script>
<template>
<div class="mb-6">
<Breadcrumb class="mb-2">
<BreadcrumbList>
<BreadcrumbItem><BreadcrumbLink as-child><RouterLink to="/tasks">Tasks</RouterLink></BreadcrumbLink></BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem><BreadcrumbPage class="font-mono">#{{ id }}</BreadcrumbPage></BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
<div class="flex flex-wrap items-start justify-between gap-4">
<div class="min-w-0">
<h1 class="text-2xl font-semibold">{{ title }}</h1>
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm">
<Badge v-if="status" :variant="statusKind(status)">{{ statusLabel(status) }}</Badge>
<span v-if="run.task?.workflow" class="font-mono text-xs text-fg-muted">{{ run.task.workflow }}</span>
<a
v-if="run.task?.issue_url && run.task?.issue_number"
class="inline-flex items-center gap-0.5 font-mono text-xs text-fg-muted hover:text-foreground"
:href="run.task.issue_url"
target="_blank"
rel="noreferrer"
>{{ run.task.owner }}/{{ run.task.repo }} #{{ run.task.issue_number }}<ArrowUpRight class="size-3" aria-hidden="true"
/></a>
<DispatchLinks kind="tasks" :id="id" />
<a
v-if="run.task?.pr_url && run.task?.pr_number"
class="inline-flex items-center gap-0.5 font-mono text-xs text-fg-muted hover:text-foreground"
:href="run.task.pr_url"
target="_blank"
rel="noreferrer"
>PR #{{ run.task.pr_number }}<ArrowUpRight class="size-3" aria-hidden="true"
/></a>
</div>
</div>
<div class="flex flex-wrap items-center gap-2">
<TaskRowActions
v-if="run.task && headerActions.length"
:task="run.task"
:only="HEAD_ACTIONS"
@done="run.refreshAll()"
/>
<StartNewRun compact :id="id" />
</div>
</div>
<dl
v-if="io.length || run.attempts?.called_by"
class="mt-3 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs"
>
<template v-if="run.attempts?.called_by">
<dt class="text-fg-subtle">Called by</dt>
<dd>
<RouterLink :to="`/tasks/${run.attempts.called_by}`" class="font-mono text-fg-muted hover:text-foreground hover:underline"
>task #{{ run.attempts.called_by }}</RouterLink
>
</dd>
</template>
<template v-for="row in io" :key="row.label">
<dt class="text-fg-subtle">{{ row.label }}</dt>
<dd class="font-mono break-words text-fg-muted">{{ row.value }}</dd>
</template>
</dl>
<div
v-if="parked"
role="status"
class="mt-4 flex items-start gap-3 rounded-md border border-warn/40 bg-warn-soft px-4 py-3"
>
<CircleAlert class="mt-0.5 size-4 shrink-0 text-warn" aria-hidden="true" />
<div class="min-w-0">
<p class="text-sm font-medium text-warn">Parked</p>
<p class="mt-0.5 font-mono text-xs break-words text-fg-muted">{{ run.task?.park_reason }}</p>
</div>
</div>
</div>
</template>