fix(webui): settle the run page head around the attempt pager
The head strip breaks into a full-width control row -- Back, Refresh, and Start a new run on the left, the forge coordinates pushed to the far edge -- and the meta row pairs the lifecycle badge with the attempt pager, which rides in from TaskMetaBar's slot. TaskMetaBar narrows to the served status badge; the forge links move out of it into the control row where the other navigation lives.
This commit is contained in:
5 files changed
+61
-64
No files matched your search
@@ -9,7 +9,6 @@ import {
|
||||
PaginationNext,
|
||||
PaginationPrevious,
|
||||
} from "@/components/ui/pagination";
|
||||
|
||||
import { useTaskRun } from "./use-task-run";
|
||||
|
||||
/**
|
||||
@@ -19,22 +18,20 @@ import { useTaskRun } from "./use-task-run";
|
||||
* rail reads the same response, so the two views of the same task's attempts
|
||||
* can never disagree about which one is on screen.
|
||||
*
|
||||
* One attempt renders the rail anyway, disabled: the control states "there is
|
||||
* exactly one run" by being inert rather than by disappearing, which is what
|
||||
* the old text fact ("attempt 1 of 1") said without saying it as navigation.
|
||||
* Hidden for zero or one attempt: a one-page pager is the text fact wearing
|
||||
* extra chrome. The URL names the attempt either way, and the panels show
|
||||
* which attempt is on screen.
|
||||
*/
|
||||
const run = useTaskRun();
|
||||
|
||||
const attempts = computed(() => run.attempts?.attempts ?? []);
|
||||
|
||||
const selected = computed(() =>
|
||||
attempts.value.findIndex((a) => Number(a.attempt) === Number(run.attemptNumber)),
|
||||
);
|
||||
|
||||
// Hidden for zero or one attempt: a one-page pager is the text fact with
|
||||
// extra chrome. The URL names an attempt either way, and the panels below
|
||||
// show which attempt is on screen.
|
||||
const loaded = computed(() => (run.attempts?.attempts ?? []).length > 1);
|
||||
const total = computed(() => (run.attempts?.attempts ?? []).length);
|
||||
const loaded = computed(() => attempts.value.length > 1);
|
||||
const total = computed(() => attempts.value.length);
|
||||
|
||||
// reka's pagination counts pages over items; one attempt per page makes the
|
||||
// page number an index into the run history. The controlled page keeps the
|
||||
@@ -55,25 +52,23 @@ function select(p: number): void {
|
||||
:page="page"
|
||||
:sibling-count="1"
|
||||
aria-label="Attempts of this task"
|
||||
class="mx-0"
|
||||
class="mx-0 w-auto"
|
||||
@update:page="select"
|
||||
>
|
||||
<PaginationContent>
|
||||
<PaginationContent v-slot="{ items }">
|
||||
<PaginationPrevious size="icon-sm" class="border-transparent" />
|
||||
<PaginationList v-slot="{ items }">
|
||||
<template v-for="(item, i) in items" :key="i">
|
||||
<PaginationEllipsis v-if="item.type === 'ellipsis'" :index="i" />
|
||||
<PaginationItem
|
||||
v-else
|
||||
:value="item.value"
|
||||
:is-active="item.value === page"
|
||||
size="icon-sm"
|
||||
:title="`Attempt ${attempts[item.value - 1]?.attempt}`"
|
||||
>
|
||||
{{ item.value }}
|
||||
</PaginationItem>
|
||||
</template>
|
||||
</PaginationList>
|
||||
<template v-for="(item, i) in items" :key="i">
|
||||
<PaginationEllipsis v-if="item.type === 'ellipsis'" :index="i" />
|
||||
<PaginationItem
|
||||
v-else
|
||||
:value="item.value"
|
||||
:is-active="item.value === page"
|
||||
size="icon-sm"
|
||||
:title="`Attempt ${attempts[item.value - 1]?.attempt}`"
|
||||
>
|
||||
{{ item.value }}
|
||||
</PaginationItem>
|
||||
</template>
|
||||
<PaginationNext size="icon-sm" class="border-transparent" />
|
||||
</PaginationContent>
|
||||
</Pagination>
|
||||
|
||||
@@ -33,7 +33,7 @@ import { useTaskRun } from "./use-task-run";
|
||||
* `compact` renders the bare control for the header's action row; on its own
|
||||
* the component also renders the disabled reason.
|
||||
*/
|
||||
const props = defineProps<{ id?: string; compact?: boolean }>();
|
||||
const props = defineProps<{ id?: string; compact?: boolean; class?: string }>();
|
||||
|
||||
const run = useTaskRun();
|
||||
|
||||
@@ -59,6 +59,7 @@ const errorText = computed(() => {
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger as-child>
|
||||
<Button
|
||||
:class="props.class"
|
||||
:variant="run.retryKind === 'primary' ? 'default' : 'outline'"
|
||||
:disabled="!run.canRetry || run.retryBusy"
|
||||
:title="unavailable || 'Retry this task as a new run'"
|
||||
|
||||
@@ -43,15 +43,13 @@ const run = provideTaskRun(taskId);
|
||||
<TaskDetailNotice v-else-if="run.missing" kind="missing" :raw="rawId" />
|
||||
<div v-else>
|
||||
<TaskHeader :id="rawId" />
|
||||
<TaskMetaBar />
|
||||
<TaskMetaBar>
|
||||
<AttemptSelector class="ml-auto" />
|
||||
</TaskMetaBar>
|
||||
<TaskNotes :id="rawId" />
|
||||
<AttemptSelector />
|
||||
|
||||
<Card>
|
||||
<CardContent>
|
||||
<div class="mb-2 flex justify-end">
|
||||
<AttemptSelector />
|
||||
</div>
|
||||
<Tabs class="gap-4" :model-value="run.tab" @update:model-value="run.setTab">
|
||||
<TabBar />
|
||||
<TaskRunPanels :id="rawId" />
|
||||
|
||||
@@ -12,7 +12,9 @@ import { useTaskRun } from "./use-task-run";
|
||||
* The run page's head, one strip: the task, its workflow line, and the
|
||||
* actions. Back and Refresh are page chrome; Start a new run lives here too,
|
||||
* since a restart is the page's one decision. The commit-discard consequence
|
||||
* is stated in the confirm dialog, not beside the button.
|
||||
* is stated in the confirm dialog, not beside the button. The forge
|
||||
* coordinates (repo, issue, PR) sit at the row's far end: context, not
|
||||
* action, but read left-to-right as where this work lives.
|
||||
*/
|
||||
const props = defineProps<{ id: string }>();
|
||||
|
||||
@@ -28,7 +30,7 @@ const workflow = computed(() => (run.task?.workflow ? `${run.task.workflow} work
|
||||
<h1 class="text-2xl font-semibold tracking-[-0.02em]">{{ title }}</h1>
|
||||
<p v-if="workflow" class="mt-1 text-sm text-fg-muted">{{ workflow }}</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<div class="flex w-full flex-wrap items-center gap-2">
|
||||
<Button variant="outline" as-child>
|
||||
<RouterLink to="/tasks">
|
||||
<ArrowLeft data-icon="inline-start" />
|
||||
@@ -39,7 +41,34 @@ const workflow = computed(() => (run.task?.workflow ? `${run.task.workflow} work
|
||||
<RefreshCw data-icon="inline-start" />
|
||||
Refresh
|
||||
</Button>
|
||||
<StartNewRun compact :id="id" />
|
||||
<StartNewRun compact :id="id" class="mr-auto" />
|
||||
<a
|
||||
v-if="run.task?.repo_url"
|
||||
class="text-link hover:underline"
|
||||
:href="run.task.repo_url"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{{ run.task.owner }}/{{ run.task.repo }}
|
||||
</a>
|
||||
<a
|
||||
v-if="run.task?.issue_url && run.task?.issue_number"
|
||||
class="text-link hover:underline"
|
||||
:href="run.task.issue_url"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Issue #{{ run.task.issue_number }}
|
||||
</a>
|
||||
<a
|
||||
v-if="run.task?.pr_url && run.task?.pr_number"
|
||||
class="text-link hover:underline"
|
||||
:href="run.task.pr_url"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
PR #{{ run.task.pr_number }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -8,9 +8,9 @@ import { statusKind, statusLabel } from "@/lib/task-meta";
|
||||
import { useTaskRun } from "./use-task-run";
|
||||
|
||||
/**
|
||||
* One meta line under the title: lifecycle status, the attempt on screen, and
|
||||
* the forge coordinates. Everything comes from reads the page already holds,
|
||||
* so the bar costs no request of its own.
|
||||
* The task's lifecycle status, plus whatever the page parks on the same row
|
||||
* (the attempt pager rides here, pushed right). Everything comes from reads
|
||||
* the page already holds, so the bar costs no request of its own.
|
||||
*
|
||||
* "Not read" and "loading" are kept apart from "no status": the task list is
|
||||
* a list of the 100 most recently updated, so a task outside it is a fact
|
||||
@@ -30,32 +30,6 @@ const taskStatusLabel = computed(() => statusLabel(run.task?.status ?? ""));
|
||||
<template v-else-if="run.task">
|
||||
<Badge :variant="taskKind">{{ taskStatusLabel }}</Badge>
|
||||
</template>
|
||||
<a
|
||||
v-if="run.task?.repo_url"
|
||||
class="text-link hover:underline"
|
||||
:href="run.task.repo_url"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{{ run.task.owner }}/{{ run.task.repo }}
|
||||
</a>
|
||||
<a
|
||||
v-if="run.task?.issue_url && run.task?.issue_number"
|
||||
class="text-link hover:underline"
|
||||
:href="run.task.issue_url"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Issue #{{ run.task.issue_number }}
|
||||
</a>
|
||||
<a
|
||||
v-if="run.task?.pr_url && run.task?.pr_number"
|
||||
class="text-link hover:underline"
|
||||
:href="run.task.pr_url"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
PR #{{ run.task.pr_number }}
|
||||
</a>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user