feat(webui): split the task run page into a master-detail pane
The five tabs gave the stage rail less than a third of the screen and disconnected the log stream from the stage that produced it. The stage rail is now the page's master pane, always visible; the four context panels are the inspector and own the tab bar. Selecting a stage commands the inspector to the log tab with that stage's filter set; clicking the selected stage clears it. Selection is a command, not a binding -- the operator can change the filter afterwards. No endpoint, RPC or contract changed. tab=stages still resolves, to the log tab; every inspector tab and attempt deep-link survives a reload. Below the shell's 900px frame breakpoint the rail stacks above the inspector. Design of record: docs/prds/task-run-master-detail.md (Draft, per-run panel contracts unchanged from task-run-detail.md).
This commit is contained in:
7 files changed
+178
-56
No files matched your search
@@ -9,7 +9,7 @@ import PanelLoading from "./PanelLoading.vue";
|
||||
import StageRow from "./StageRow.vue";
|
||||
import { stageStatusMeta } from "./stage-rail";
|
||||
import { useTaskRun } from "./use-task-run";
|
||||
import type { AttemptsState } from "./task-run";
|
||||
import type { AttemptsState, Stage } from "./task-run";
|
||||
|
||||
/**
|
||||
* The per-attempt stage rail.
|
||||
@@ -35,6 +35,24 @@ const attempt = computed(() => attempts.value.find((a) => Number(a.attempt) ===
|
||||
const meta = computed(() => stageStatusMeta(attempt.value?.status));
|
||||
const stages = computed(() => attempt.value?.stages || []);
|
||||
|
||||
/**
|
||||
* Master-detail selection (docs/prds/task-run-master-detail.md): clicking a
|
||||
* stage commands the inspector to the log tab with this stage's filter set.
|
||||
* Clicking the selected stage clears the filter back to all stages. The
|
||||
* selection is a command, not a binding: the operator can change the filter
|
||||
* afterwards and the rail does not fight them. A stage with no name has
|
||||
* 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;
|
||||
}
|
||||
|
||||
function selectStage(stage: Stage): void {
|
||||
if (!stage.name) return;
|
||||
run.setFilters({ stage: selectedStage(stage) ? "" : stage.name, level: run.filters.level });
|
||||
run.setTab("log");
|
||||
}
|
||||
|
||||
/** An attempt's start is rendered as an absolute instant, never as "started 2
|
||||
* days ago": on a still-running attempt a relative stamp reads as two days of
|
||||
* work, which is exactly the elapsed-time claim the design forbids. */
|
||||
@@ -81,6 +99,8 @@ const startedAt = computed(() => {
|
||||
:stage="stage"
|
||||
:attempt-number="attempt.attempt"
|
||||
:events="run.events"
|
||||
:selected="selectedStage(stage)"
|
||||
@select="selectStage(stage)"
|
||||
/>
|
||||
</ol>
|
||||
<Empty v-else>
|
||||
|
||||
@@ -19,8 +19,11 @@ const props = defineProps<{
|
||||
stage: Stage;
|
||||
attemptNumber: number;
|
||||
events: TaskEvent[] | null | undefined;
|
||||
selected?: boolean;
|
||||
}>();
|
||||
|
||||
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));
|
||||
@@ -47,17 +50,28 @@ const nodeClass = computed(() =>
|
||||
<template>
|
||||
<li
|
||||
class="relative grid grid-cols-[1.75rem_1fr] gap-2 pb-4 before:absolute before:top-4 before:bottom-0 before:left-[0.6875rem] before:w-px before:bg-border-strong last:before:hidden max-[700px]:grid-cols-1 max-[700px]:border-b max-[700px]:border-border max-[700px]:pb-3 max-[700px]:before:hidden"
|
||||
:class="props.selected ? 'rounded-md bg-primary-soft' : ''"
|
||||
>
|
||||
<span :class="nodeClass" aria-hidden="true" class="max-[700px]:hidden" />
|
||||
<div class="min-w-0">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<div class="min-w-0" :class="props.selected ? '-my-2 rounded-md py-2' : ''">
|
||||
<!--
|
||||
Selecting a stage commands the inspector to this stage's log (the
|
||||
master-detail contract). The control is a real button so keyboard
|
||||
activation works without the row carrying a second role.
|
||||
-->
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full flex-wrap items-center gap-2 rounded text-left"
|
||||
:aria-pressed="props.selected ?? false"
|
||||
@click="emit('select')"
|
||||
>
|
||||
<!-- 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">{{ 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>
|
||||
</div>
|
||||
</button>
|
||||
<div
|
||||
v-if="stage.error"
|
||||
class="mt-2 rounded-sm border-l-[3px] border-danger bg-danger-soft px-3 py-2 text-sm break-words whitespace-pre-wrap text-fg-muted"
|
||||
|
||||
@@ -12,6 +12,7 @@ import TaskHeader from "./TaskHeader.vue";
|
||||
import TaskMetaBar from "./TaskMetaBar.vue";
|
||||
import TaskNotes from "./TaskNotes.vue";
|
||||
import TaskRunPanels from "./TaskRunPanels.vue";
|
||||
import StageRail from "./StageRail.vue";
|
||||
import { parseTaskId } from "./task-run";
|
||||
import { provideTaskRun } from "./use-task-run";
|
||||
|
||||
@@ -24,11 +25,16 @@ import { provideTaskRun } from "./use-task-run";
|
||||
* the query string, so every view of this page is a deep link that survives a
|
||||
* reload -- /tasks/42?tab=changes&attempt=2.
|
||||
*
|
||||
* The page is a master-detail split pane (docs/prds/task-run-master-detail.md):
|
||||
* the stage rail is the master and is always visible, the four context panels
|
||||
* are the inspector and own the tab bar. Below the shell's 900px frame
|
||||
* breakpoint the rail stacks above the inspector.
|
||||
*
|
||||
* This file composes the page and nothing else: the reads and the caches are
|
||||
* use-task-run, the head, meta bar, notes, restart control, attempt selector,
|
||||
* tab bar and panel area are each their own component. The router keys this
|
||||
* component on the path (App.vue), so a different :id gets a fresh instance
|
||||
* rather than diffing the last task's state in place.
|
||||
* rail, tab bar and panel area are each their own component. The router keys
|
||||
* this component on the path (App.vue), so a different :id gets a fresh
|
||||
* instance rather than diffing the last task's state in place.
|
||||
*/
|
||||
const route = useRoute();
|
||||
|
||||
@@ -48,13 +54,24 @@ const run = provideTaskRun(taskId);
|
||||
</TaskMetaBar>
|
||||
<TaskNotes :id="rawId" />
|
||||
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Tabs class="gap-4" :model-value="run.tab" @update:model-value="run.setTab">
|
||||
<TabBar />
|
||||
<TaskRunPanels :id="rawId" />
|
||||
</Tabs>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<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
|
||||
to speak for it.
|
||||
-->
|
||||
<aside aria-label="Run stages">
|
||||
<StageRail :state="run.attempts" />
|
||||
</aside>
|
||||
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Tabs class="gap-4" :model-value="run.tab" @update:model-value="run.setTab">
|
||||
<TabBar />
|
||||
<TaskRunPanels :id="rawId" />
|
||||
</Tabs>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -7,19 +7,18 @@ import ChangedFiles from "./ChangedFiles.vue";
|
||||
import DebugView from "./DebugView.vue";
|
||||
import PanelError from "./PanelError.vue";
|
||||
import PanelLoading from "./PanelLoading.vue";
|
||||
import StageRail from "./StageRail.vue";
|
||||
import TaskLogs from "./TaskLogs.vue";
|
||||
import { RUN_TABS } from "./task-run";
|
||||
import { useTaskRun } from "./use-task-run";
|
||||
|
||||
/**
|
||||
* The run page's panel area: one panel per tab, each reading the attempt the
|
||||
* page has selected.
|
||||
* The run page's inspector panels: one panel per tab, each reading the attempt
|
||||
* the page has selected. The stage rail lives in the page's master pane and is
|
||||
* not one of these tabs.
|
||||
*
|
||||
* The rail owns its own loading, failure and empty states. Every other panel is
|
||||
* scoped to one attempt, and "no attempt" is a claim only a successful read of
|
||||
* the run history can make -- a read still in flight is not a verdict either,
|
||||
* and a failed read is reported as a failed read.
|
||||
* Every panel is scoped to one attempt, and "no attempt" is a claim only a
|
||||
* successful read of the run history can make -- a read still in flight is not
|
||||
* a verdict either, and a failed read is reported as a failed read.
|
||||
*/
|
||||
const props = defineProps<{ id: string }>();
|
||||
|
||||
@@ -28,42 +27,37 @@ const run = useTaskRun();
|
||||
|
||||
<template>
|
||||
<TabsContent v-for="tab in RUN_TABS" :key="tab.id" :value="tab.id">
|
||||
<StageRail v-if="tab.id === 'stages'" :state="run.attempts" />
|
||||
<PanelLoading v-if="run.attempts === undefined" label="Loading this task's attempts…" />
|
||||
|
||||
<template v-else>
|
||||
<PanelLoading v-if="run.attempts === undefined" label="Loading this task's attempts…" />
|
||||
<PanelError
|
||||
v-else-if="run.attempts === null"
|
||||
title="Could not load this task's attempts"
|
||||
detail="The task's run history could not be read."
|
||||
/>
|
||||
|
||||
<PanelError
|
||||
v-else-if="run.attempts === null"
|
||||
title="Could not load this task's attempts"
|
||||
detail="The task's run history could not be read."
|
||||
/>
|
||||
<Empty v-else-if="run.attemptNumber == null">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No attempt recorded</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<TaskLogs
|
||||
v-else-if="tab.id === 'log'"
|
||||
:state="run.logState"
|
||||
:attempt="run.attemptNumber"
|
||||
:stages="run.stageNames"
|
||||
:filters="run.filters"
|
||||
:task-id="props.id"
|
||||
@filter="run.setFilters"
|
||||
/>
|
||||
|
||||
<Empty v-else-if="run.attemptNumber == null">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No attempt recorded</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<ChangedFiles v-else-if="tab.id === 'changes'" :state="run.changesState" :task="run.task" />
|
||||
|
||||
<TaskLogs
|
||||
v-else-if="tab.id === 'log'"
|
||||
:state="run.logState"
|
||||
:attempt="run.attemptNumber"
|
||||
:stages="run.stageNames"
|
||||
:filters="run.filters"
|
||||
:task-id="props.id"
|
||||
@filter="run.setFilters"
|
||||
/>
|
||||
<AttemptConfig
|
||||
v-else-if="tab.id === 'config'"
|
||||
:events="run.events"
|
||||
:attempt="run.attemptNumber"
|
||||
/>
|
||||
|
||||
<ChangedFiles v-else-if="tab.id === 'changes'" :state="run.changesState" :task="run.task" />
|
||||
|
||||
<AttemptConfig
|
||||
v-else-if="tab.id === 'config'"
|
||||
:events="run.events"
|
||||
:attempt="run.attemptNumber"
|
||||
/>
|
||||
|
||||
<DebugView v-else-if="tab.id === 'debug'" :state="run.debugState" :attempt="run.attemptNumber" />
|
||||
</template>
|
||||
<DebugView v-else-if="tab.id === 'debug'" :state="run.debugState" :attempt="run.attemptNumber" />
|
||||
</TabsContent>
|
||||
</template>
|
||||
@@ -21,8 +21,12 @@ export interface TaskRunTab {
|
||||
label: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The inspector's tabs. The stage rail is not one of them: it is the page's
|
||||
* master pane, always visible, and selecting a stage commands the inspector
|
||||
* to the log tab with that stage's filter set (docs/prds/task-run-master-detail.md).
|
||||
*/
|
||||
export const RUN_TABS: TaskRunTab[] = [
|
||||
{ id: "stages", label: "Stages" },
|
||||
{ id: "log", label: "Log" },
|
||||
{ id: "changes", label: "Changed files" },
|
||||
{ id: "config", label: "Configuration" },
|
||||
@@ -31,6 +35,9 @@ export const RUN_TABS: TaskRunTab[] = [
|
||||
|
||||
const TAB_IDS = new Set(RUN_TABS.map((tab) => tab.id));
|
||||
|
||||
/** URL ids from before the split-pane layout that must keep resolving. */
|
||||
const LEGACY_TAB_IDS = new Set(["stages"]);
|
||||
|
||||
/** The task record as the task list serves it. */
|
||||
export interface TaskRecord {
|
||||
id: number | string;
|
||||
@@ -149,6 +156,9 @@ export function parseTaskId(raw: unknown): number | null {
|
||||
|
||||
export function initialTab(query: LocationQuery | undefined): string {
|
||||
const requested = String(query?.tab ?? "");
|
||||
// tab=stages named the rail before the split pane; the rail is now always
|
||||
// visible, so the URL resolves to the inspector's first tab.
|
||||
if (LEGACY_TAB_IDS.has(requested)) return "log";
|
||||
return TAB_IDS.has(requested) ? requested : RUN_TABS[0].id;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user