feat(eda): per-org workflow enable/disable gating bindings
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.
This commit is contained in:
1 parent
e6916d57bb
commit
dc1b61d394
29 files changed
+543
-34
No files matched your search
@@ -46,7 +46,12 @@ const emit = defineEmits<{
|
||||
>
|
||||
{{ props.binding.filter || "—" }}
|
||||
</TableCell>
|
||||
<TableCell>{{ props.binding.workflow || "—" }}</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>
|
||||
|
||||
@@ -29,6 +29,8 @@ export interface Binding {
|
||||
status?: string;
|
||||
version?: number;
|
||||
unsigned?: boolean;
|
||||
/** Set when the binding's org has disabled the workflow it targets. */
|
||||
workflow_disabled?: boolean;
|
||||
}
|
||||
|
||||
/** One workflow input's assignment on the wire. */
|
||||
|
||||
@@ -158,6 +158,12 @@ export const api = {
|
||||
setup: <T = unknown>() => request<T>("/api/setup"),
|
||||
capabilities: <T = unknown>() => request<T>("/api/capabilities"),
|
||||
workflows: <T = unknown>() => request<T>("/api/workflows"),
|
||||
workflowEnabled: (id: string, enabled: boolean) =>
|
||||
request<void>(`/api/workflows/${encodeURIComponent(id)}/enabled`, {
|
||||
method: "PUT",
|
||||
body: { enabled },
|
||||
parse: false,
|
||||
}),
|
||||
workRequest: <T = unknown>(workRequest: Payload) =>
|
||||
request<T>("/api/work-requests", { method: "POST", body: workRequest }),
|
||||
skills: <T = unknown>() => request<T>("/api/skills"),
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Plus, RotateCcw } from "@lucide/vue";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { StatusPill } from "@/components/ui/status-pill";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { api } from "@/lib/api";
|
||||
import { delivered } from "@/lib/delivered";
|
||||
@@ -72,6 +73,17 @@ watchEffect(() => {
|
||||
if (!selected.value && rows.value.length) selected.value = rows.value[0]!.id;
|
||||
});
|
||||
const current = computed(() => rows.value.find((r) => r.id === selected.value));
|
||||
// A workflow the server does not list yet (a new, unsaved one) has no
|
||||
// enabled state to show.
|
||||
const enabled = computed(() => data.value.definitions?.find((d) => d.id === selected.value)?.enabled);
|
||||
async function setEnabled(value: boolean) {
|
||||
try {
|
||||
await api.workflowEnabled(selected.value, value);
|
||||
await load();
|
||||
} catch (err) {
|
||||
error.value = String((err as Error).message || err);
|
||||
}
|
||||
}
|
||||
const stages = computed(() => (data.value.stages ?? []).filter((s) => s.workflow === selected.value));
|
||||
const workflowRuns = computed(() => runs.value.filter((t) => t.workflow === selected.value));
|
||||
const tab = ref("definition");
|
||||
@@ -135,6 +147,10 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
||||
<h2 class="font-mono text-[15px] font-medium">{{ selected }}</h2>
|
||||
<StatusPill v-if="current?.origin">{{ current.origin }}</StatusPill>
|
||||
<span v-if="current" class="ml-auto text-xs text-fg-subtle">{{ current.runs || 0 }} runs</span>
|
||||
<label v-if="enabled !== undefined" class="flex items-center gap-2 text-xs text-fg-muted">
|
||||
Enabled
|
||||
<Switch :model-value="enabled" aria-label="Workflow enabled" @update:model-value="setEnabled" />
|
||||
</label>
|
||||
</header>
|
||||
<Tabs v-model="tab">
|
||||
<TabsList>
|
||||
|
||||
Reference in new issue
Block a user