Files
archie/ui/src/bindings/BindingRow.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

74 lines
2.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { Check, Pause, Pencil, Play, Trash2 } from "@lucide/vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
import { MoreMenu } from "@/components/ui/more-menu";
import { TableCell, TableRow } from "@/components/ui/table";
import BindingStatusBadge from "./BindingStatusBadge.vue";
import { eventTypeLabel, type EventType } from "@/captures/event-types";
import type { Binding } from "./binding-trigger";
/** One saved binding's summary row. */
const props = defineProps<{
binding: Binding;
eventTypes: EventType[];
}>();
const emit = defineEmits<{
edit: [binding: Binding];
approve: [binding: Binding];
pause: [binding: Binding];
resume: [binding: Binding];
delete: [binding: Binding];
}>();
</script>
<template>
<TableRow>
<TableCell class="font-medium">{{ props.binding.name }}</TableCell>
<TableCell class="font-mono text-fg-muted">
<div class="flex items-center gap-2">
{{ eventTypeLabel(props.binding.event_type_id, props.eventTypes) }}
<Badge v-if="props.binding.unsigned" variant="warn">Unsigned</Badge>
</div>
</TableCell>
<TableCell>{{ props.binding.workflow || "–" }}</TableCell>
<TableCell><BindingStatusBadge :status="props.binding.status" /></TableCell>
<TableCell>
<div class="flex items-center justify-end gap-1">
<Button
variant="outline"
size="sm"
@click="emit('edit', props.binding)"
>
<Pencil data-icon="inline-start" />
Edit</Button>
<!-- Only a pending binding can be approved. An armed binding is
already firing, so the button would be a no-op -- or worse, a
misleading one. -->
<Button
v-if="props.binding.status === 'pending_approval'"
size="sm"
@click="emit('approve', props.binding)"
>
<Check data-icon="inline-start" />
Approve</Button>
<MoreMenu :label="`More actions for ${props.binding.name}`">
<DropdownMenuItem
v-if="props.binding.status === 'armed'"
@select="emit('pause', props.binding)"
><Pause />Pause</DropdownMenuItem>
<!-- Resuming returns the binding to pending approval, so it is
approved again before it fires. -->
<DropdownMenuItem
v-if="props.binding.status === 'paused'"
@select="emit('resume', props.binding)"
><Play />Resume</DropdownMenuItem>
<DropdownMenuItem variant="destructive" @select="emit('delete', props.binding)"><Trash2 />Delete</DropdownMenuItem>
</MoreMenu>
</div>
</TableCell>
</TableRow>
</template>