Files
archie/ui/src/runs/RunsPage.vue
T
sam f4bfa59dec feat(ui/workflows): restore the workflow list and page on the archie binary (#2023)
The list and page keep the original layout and read the binary's API.
Duplicate triggers are grouped. Runs and run pages use the shared table.
The older editor stays on its hidden route as WorkflowEditorPage.
2026-11-22 02:32:12 +11:00

53 lines
2.3 KiB
Vue

<script setup lang="ts">
import { computed, onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import { Search } from "@lucide/vue";
import PageHeader from "@/base/PageHeader.vue";
import { Button } from "@/components/ui/button";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
import { Spinner } from "@/components/ui/spinner";
import { api } from "@/lib/api";
import { usePoll, useRead } from "@/lib/use-read";
import { useLiveResource } from "@/stores/session";
import ApprovalsSection from "./ApprovalsSection.vue";
import RunTable from "./RunTable.vue";
const route = useRoute();
const { data, error, reload } = useRead(() => api.runs());
onMounted(reload);
useLiveResource(null, () => void reload());
usePoll(reload);
// A workflow links here with ?workflow=, which starts the filter on its name.
const query = ref(String(route.query.workflow ?? ""));
// A filter earns its place once the list outgrows a glance.
const FILTER_FROM = 8;
const filterable = computed(() => (data.value?.length ?? 0) > FILTER_FROM || !!query.value);
const shown = computed(() => {
const needle = query.value.trim().toLowerCase();
return (data.value ?? []).filter((r) => !needle || r.workflow.toLowerCase().includes(needle) || r.state.includes(needle));
});
</script>
<template>
<div>
<PageHeader title="Runs">
<InputGroup v-if="filterable" class="w-56 max-sm:w-full">
<InputGroupAddon><Search /></InputGroupAddon>
<InputGroupInput v-model="query" type="search" aria-label="Filter runs" placeholder="Filter" />
</InputGroup>
</PageHeader>
<ApprovalsSection @answered="reload" />
<div v-if="error" class="mb-4 text-label text-danger" role="alert">
<p>{{ error }}</p>
<Button variant="outline" size="sm" @click="reload">Retry</Button>
</div>
<p v-else-if="!data" class="flex items-center gap-2 text-label text-fg-muted"><Spinner />Loading runs…</p>
<Empty v-else-if="!data.length"><EmptyHeader><EmptyTitle>No runs</EmptyTitle></EmptyHeader></Empty>
<p v-else-if="!shown.length" class="text-label text-fg-muted">No run matches.</p>
<RunTable v-else :rows="shown" storage-key="runs" with-workflow />
</div>
</template>