Files
archie/ui/src/tasks/TaskRunPanels.vue
T

73 lines
2.2 KiB
Vue

<script setup lang="ts">
import { TabsContent } from "@/components/ui/tabs";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import AttemptConfig from "./AttemptConfig.vue";
import ChangedFiles from "./ChangedFiles.vue";
import DebugView from "./DebugView.vue";
import PanelError from "./PanelError.vue";
import PanelLoading from "./PanelLoading.vue";
import TaskLogs from "./TaskLogs.vue";
import { errors } from "@/copy/errors";
import { RUN_TABS } from "./task-run";
import { useTaskRun } from "./use-task-run";
/**
* 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.
*
* 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 }>();
const run = useTaskRun();
</script>
<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…"
/>
<PanelError
v-else-if="run.attempts === null"
:title="errors.tasks.attempts.loadFailed"
:detail="errors.tasks.panels.noAnswer"
retry-label="Retry"
@retry="run.refreshAll()"
/>
<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"
@retry="run.refreshAll()"
:stages="run.stageNames"
:filters="run.filters"
:task-id="props.id"
@filter="run.setFilters"
/>
<ChangedFiles
v-else-if="tab.id === 'changes'"
:state="run.changesState"
:task="run.task"
/>
<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>
</TabsContent>
</template>