A workflow-enablement control-plane resource lists, per org, the workflows that org has disabled. A binding targeting a disabled workflow is skipped at dispatch like an unarmed one, is refused on save, and is flagged on the binding list; the workflows page toggles it. Bindings now carry the org_id column they already had in storage, over the State Store wire too. Org-owned workflow definitions are deferred to a follow-up bead: they need the caller's org, which the access chain resolves.
92 lines
2.7 KiB
Vue
92 lines
2.7 KiB
Vue
<script setup lang="ts">
|
|
import { Check, Pencil, Trash2 } from "@lucide/vue";
|
|
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { Button } from "@/components/ui/button";
|
|
import { TableCell, TableRow } from "@/components/ui/table";
|
|
import BindingStatusBadge from "./BindingStatusBadge.vue";
|
|
import { eventTypeLabel, type EventType } from "@/captures/event-types";
|
|
import {
|
|
bindingEventType,
|
|
repoPin,
|
|
type Binding,
|
|
type MappingOption,
|
|
} from "./binding-draft";
|
|
|
|
/** One saved binding's summary row. */
|
|
const props = defineProps<{
|
|
binding: Binding;
|
|
mappings: MappingOption[];
|
|
eventTypes: EventType[];
|
|
}>();
|
|
const emit = defineEmits<{
|
|
edit: [binding: Binding];
|
|
approve: [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(
|
|
bindingEventType(props.binding, props.mappings),
|
|
props.eventTypes,
|
|
)
|
|
}}
|
|
<Badge v-if="props.binding.unsigned" variant="warn">Unsigned</Badge>
|
|
</div>
|
|
</TableCell>
|
|
<TableCell
|
|
class="max-w-56 truncate font-mono text-xs text-fg-muted"
|
|
:title="props.binding.filter"
|
|
>
|
|
{{ props.binding.filter || "—" }}
|
|
</TableCell>
|
|
<TableCell>
|
|
<div class="flex items-center gap-2">
|
|
{{ props.binding.workflow || "—" }}
|
|
<Badge v-if="props.binding.workflow_disabled" variant="warn">Disabled</Badge>
|
|
</div>
|
|
</TableCell>
|
|
<TableCell class="font-mono text-fg-muted">{{
|
|
repoPin(props.binding)
|
|
}}</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>
|
|
<Button
|
|
variant="outline"
|
|
size="sm"
|
|
@click="emit('delete', props.binding)"
|
|
>
|
|
<Trash2 data-icon="inline-start" />
|
|
Delete
|
|
</Button>
|
|
</div>
|
|
</TableCell>
|
|
</TableRow>
|
|
</template>
|