fix(ui): trim the task page and draw a run's pinned definition on the canvas
This commit is contained in:
9 files changed
+93
-75
No files matched your search
@@ -81,7 +81,7 @@ const nodeClass = computed(() =>
|
||||
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="min-w-0 text-sm font-medium break-words hover:underline"
|
||||
:class="props.selected ? 'text-primary' : ''"
|
||||
>{{ stage.name || "(unnamed stage)" }}</span
|
||||
>
|
||||
@@ -91,9 +91,7 @@ const nodeClass = computed(() =>
|
||||
meta.label
|
||||
}}</Badge>
|
||||
<span v-else class="sr-only">ok</span>
|
||||
<span class="text-xs text-fg-muted">{{
|
||||
ran ? `ran for ${ran}` : "duration not recorded"
|
||||
}}</span>
|
||||
<span v-if="ran" class="text-xs text-fg-muted">{{ ran }}</span>
|
||||
</button>
|
||||
<div
|
||||
v-if="stage.error"
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
|
||||
import { computed } from "vue";
|
||||
|
||||
import { RUN_TABS } from "./task-run";
|
||||
import { useTaskRun } from "./use-task-run";
|
||||
|
||||
/**
|
||||
* The run page's tab bar. It owns no state and renders no panel: the open tab
|
||||
@@ -15,12 +18,17 @@ import { RUN_TABS } from "./task-run";
|
||||
* ends. Automatic activation is right here because every panel is a local
|
||||
* render, not a fetch: there is no cost to switching.
|
||||
*/
|
||||
const run = useTaskRun();
|
||||
// The sandbox follows a live container; a finished attempt has none to show.
|
||||
const tabs = computed(() =>
|
||||
RUN_TABS.filter((tab) => tab.id !== "sandbox" || run.task?.status === "running"),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TabsList variant="line" class="w-full justify-start">
|
||||
<TabsTrigger
|
||||
v-for="tab in RUN_TABS"
|
||||
v-for="tab in tabs"
|
||||
:key="tab.id"
|
||||
:value="tab.id"
|
||||
class="flex-none px-2"
|
||||
|
||||
@@ -197,6 +197,7 @@ watch([() => route.hash, current], async () => {
|
||||
line?.scrollIntoView({ block: "center" });
|
||||
line?.focus({ preventScroll: true });
|
||||
}, { immediate: true, flush: "post" });
|
||||
const TASK_FIELDS = ["task", "task_id"];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -251,7 +252,7 @@ watch([() => route.hash, current], async () => {
|
||||
ref="logFrame"
|
||||
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="entry.id ?? i" :entry="entry" :data-log-id="entry.id" tabindex="-1" />
|
||||
<LogRow v-for="(entry, i) in view.entries" :key="entry.id ?? i" :entry="entry" :omit="TASK_FIELDS" :data-log-id="entry.id" tabindex="-1" />
|
||||
</div>
|
||||
<div v-if="canPage" class="mt-2 flex flex-wrap items-center gap-2 px-1">
|
||||
<Button variant="outline" size="sm" :disabled="!canOlder" @click="loadOlder">Older</Button>
|
||||
|
||||
@@ -60,17 +60,10 @@ const run = useTaskRun();
|
||||
: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"
|
||||
/>
|
||||
<div v-else-if="tab.id === 'debug'" class="space-y-6">
|
||||
<DebugView :state="run.debugState" :attempt="run.attemptNumber" />
|
||||
<AttemptConfig :events="run.events" :attempt="run.attemptNumber" />
|
||||
</div>
|
||||
|
||||
<SandboxView
|
||||
v-else-if="tab.id === 'sandbox'"
|
||||
|
||||
@@ -29,15 +29,14 @@ export interface TaskRunTab {
|
||||
export const RUN_TABS: TaskRunTab[] = [
|
||||
{ id: "log", label: "Log" },
|
||||
{ id: "changes", label: "Changes" },
|
||||
{ id: "config", label: "Config" },
|
||||
{ id: "debug", label: "Debug" },
|
||||
{ id: "sandbox", label: "Sandbox" },
|
||||
];
|
||||
|
||||
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"]);
|
||||
/** URL ids for tabs that were folded into another. */
|
||||
const MOVED_TABS: Record<string, string> = { stages: "log", config: "debug" };
|
||||
|
||||
/** The task record as the task list serves it. */
|
||||
export interface TaskRecord {
|
||||
@@ -177,9 +176,7 @@ 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";
|
||||
if (MOVED_TABS[requested]) return MOVED_TABS[requested];
|
||||
return TAB_IDS.has(requested) ? requested : RUN_TABS[0].id;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user