Files
archie/ui/src/bindings/BindingsTable.vue
T
sam 5c8fb901f9 feat(ui/events): captures, mappings and bindings run on the binary's API (#2062, #2098)
The Capture, Map and Bind steps read the module's captures, event types,
mappings and triggers. A binding is a trigger bound to an event type; the
sources panel creates HMAC sources and shows each delivery's verification
result. The workspace filter is removed: the binary has one workspace per
organisation and the data carries none.
2026-11-22 11:46:02 +11:00

105 lines
2.9 KiB
Vue

<script setup lang="ts">
import { computed } from "vue";
import { errors } from "@/copy/errors";
import { Section } from "@/components/ui/section";
import {
Empty,
EmptyDescription,
EmptyHeader,
EmptyTitle,
} from "@/components/ui/empty";
import { Skeleton } from "@/components/ui/skeleton";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import BindingRow from "./BindingRow.vue";
import type { EventType } from "@/captures/event-types";
import type { Binding } from "./binding-trigger";
import type { LoadFailure } from "./use-bindings";
const props = defineProps<{
/** null means loading, [] means loaded and empty. */
bindings: Binding[] | null;
eventTypes: EventType[];
failure: LoadFailure | null;
}>();
const emit = defineEmits<{
edit: [binding: Binding];
approve: [binding: Binding];
pause: [binding: Binding];
resume: [binding: Binding];
delete: [binding: Binding];
}>();
const loading = computed(() => props.bindings === null);
const rows = computed(() => props.bindings ?? []);
// The failure description is the daemon's own words. "bindings not configured"
// answers a deployment with no binding store wired, and the operator can act on
// that, where a blanket "cannot reach archied" would be false about a daemon
// that answered.
const failureTitle = computed(() =>
props.failure?.kind === "unconfigured"
? errors.bindings.table.notConfigured
: errors.common.unresponsive,
);
</script>
<template>
<Empty v-if="props.failure">
<EmptyHeader>
<EmptyTitle>{{ failureTitle }}</EmptyTitle>
<EmptyDescription>{{ props.failure.message }}</EmptyDescription>
</EmptyHeader>
</Empty>
<Empty v-else-if="!loading && !rows.length">
<EmptyHeader>
<EmptyTitle>No bindings yet</EmptyTitle>
</EmptyHeader>
</Empty>
<Section v-else>
<Table>
<TableHeader>
<TableRow>
<TableHead>Name</TableHead>
<TableHead>Event type</TableHead>
<TableHead>Workflow</TableHead>
<TableHead>Status</TableHead>
<TableHead />
</TableRow>
</TableHeader>
<TableBody>
<template v-if="loading">
<TableRow v-for="row in 3" :key="row">
<TableCell v-for="col in 5" :key="col"
><Skeleton class="h-4 w-full"
/></TableCell>
</TableRow>
</template>
<template v-else>
<BindingRow
v-for="binding in rows"
:key="binding.id"
:binding="binding"
:event-types="props.eventTypes"
@edit="emit('edit', $event)"
@approve="emit('approve', $event)"
@pause="emit('pause', $event)"
@resume="emit('resume', $event)"
@delete="emit('delete', $event)"
/>
</template>
</TableBody>
</Table>
</Section>
</template>