diff --git a/ui/src/workflows/RunWorkflowButton.vue b/ui/src/workflows/RunWorkflowButton.vue index 619cfd7c1..65cf9de9c 100644 --- a/ui/src/workflows/RunWorkflowButton.vue +++ b/ui/src/workflows/RunWorkflowButton.vue @@ -8,6 +8,8 @@ import NewTaskForm from "@/tasks/NewTaskForm.vue"; defineProps<{ workflow: string; disabled?: boolean; + /** Why it is disabled, shown on the button. */ + disabledReason?: string; /** The unsaved definition to test-run; absent runs the stored one. */ draft?: string; }>(); @@ -31,7 +33,7 @@ function started(taskId: number): void { variant="outline" :aria-label="`${draft !== undefined ? 'Test' : 'Run'} ${workflow}`" :disabled="disabled" - :title="draft !== undefined ? 'Runs this draft once. Every delivery is recorded as what it would have sent and none is sent, including in called workflows; reads, model calls and commands still run' : disabled ? 'Save first' : undefined" + :title="disabled ? disabledReason : draft !== undefined ? 'Runs this draft once; deliveries are recorded, not sent' : undefined" > {{ draft !== undefined ? "Test" : "Run" }} diff --git a/ui/src/workflows/WorkflowEditor.vue b/ui/src/workflows/WorkflowEditor.vue index 44dac79ec..69fdb8d5a 100644 --- a/ui/src/workflows/WorkflowEditor.vue +++ b/ui/src/workflows/WorkflowEditor.vue @@ -341,7 +341,8 @@ async function publish(): Promise { } // The run button and draft menu item each control their dialog. -const runOpen = ref(false); +// The page opens this too, from a list row's Run, so there is one run dialog. +const runOpen = defineModel("runOpen", { default: false }); const draftOpen = ref(false); const confirmDelete = ref(false); const confirmDiscard = ref(false); @@ -469,6 +470,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect()); :workflow="selected" :draft="dirty ? yaml : undefined" :disabled="!parsed.ok" + :disabled-reason="parsed.ok ? undefined : validationLabel(parsed)" @started="(id) => { view = 'canvas'; void follow(id); }" /> diff --git a/ui/src/workflows/WorkflowsPage.vue b/ui/src/workflows/WorkflowsPage.vue index 2b88a1c97..b008e1c80 100644 --- a/ui/src/workflows/WorkflowsPage.vue +++ b/ui/src/workflows/WorkflowsPage.vue @@ -15,10 +15,8 @@ import { import { Badge } from "@/components/ui/badge"; import { Card } from "@/components/ui/card"; import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "@/components/ui/context-menu"; -import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { DropdownMenuItem } from "@/components/ui/dropdown-menu"; import { MoreMenu } from "@/components/ui/more-menu"; -import NewTaskForm from "@/tasks/NewTaskForm.vue"; import { Section } from "@/components/ui/section"; import { StatusDot } from "@/components/ui/status-dot"; import { Switch } from "@/components/ui/switch"; @@ -140,13 +138,13 @@ const enabledOf = (id: string) => data.value.definitions?.find((d) => d.id === i // The editor's tab, so a row can open straight onto its runs. const view = ref("canvas"); const router = useRouter(); -const runTarget = ref(""); -const runOpen = computed({ - get: () => runTarget.value !== "", - set: (open) => { - if (!open) runTarget.value = ""; - }, -}); +// A row's Run opens the editor's run dialog on that workflow. +const runOpen = ref(false); +function runWorkflow(id: string): void { + selected.value = id; + view.value = "canvas"; + runOpen.value = true; +} async function duplicate(id: string) { const source = stored.value.find((d) => d.id === id); @@ -171,7 +169,7 @@ function rowActions(id: string): RowAction[] { if (enabled !== undefined) actions.push({ label: enabled ? "Disable" : "Enable", icon: Power, run: () => void setEnabled(id, !enabled) }); if (saved) { actions.push( - { label: "Run", icon: Play, run: () => (runTarget.value = id) }, + { label: "Run", icon: Play, run: () => runWorkflow(id) }, { label: "Open runs", icon: ListChecks, @@ -265,7 +263,7 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total : {{ provenance }} - +