This commit is contained in:
3 files changed
+15
-21
No files matched your search
@@ -8,6 +8,8 @@ import NewTaskForm from "@/tasks/NewTaskForm.vue";
|
|||||||
defineProps<{
|
defineProps<{
|
||||||
workflow: string;
|
workflow: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
/** Why it is disabled, shown on the button. */
|
||||||
|
disabledReason?: string;
|
||||||
/** The unsaved definition to test-run; absent runs the stored one. */
|
/** The unsaved definition to test-run; absent runs the stored one. */
|
||||||
draft?: string;
|
draft?: string;
|
||||||
}>();
|
}>();
|
||||||
@@ -31,7 +33,7 @@ function started(taskId: number): void {
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
:aria-label="`${draft !== undefined ? 'Test' : 'Run'} ${workflow}`"
|
:aria-label="`${draft !== undefined ? 'Test' : 'Run'} ${workflow}`"
|
||||||
:disabled="disabled"
|
: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"
|
||||||
>
|
>
|
||||||
<component :is="draft !== undefined ? FlaskConical : Play" data-icon="inline-start" /> <span>{{ draft !== undefined ? "Test" : "Run" }}</span></Button>
|
<component :is="draft !== undefined ? FlaskConical : Play" data-icon="inline-start" /> <span>{{ draft !== undefined ? "Test" : "Run" }}</span></Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
|
|||||||
@@ -341,7 +341,8 @@ async function publish(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The run button and draft menu item each control their dialog.
|
// 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<boolean>("runOpen", { default: false });
|
||||||
const draftOpen = ref(false);
|
const draftOpen = ref(false);
|
||||||
const confirmDelete = ref(false);
|
const confirmDelete = ref(false);
|
||||||
const confirmDiscard = ref(false);
|
const confirmDiscard = ref(false);
|
||||||
@@ -469,6 +470,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect());
|
|||||||
:workflow="selected"
|
:workflow="selected"
|
||||||
:draft="dirty ? yaml : undefined"
|
:draft="dirty ? yaml : undefined"
|
||||||
:disabled="!parsed.ok"
|
:disabled="!parsed.ok"
|
||||||
|
:disabled-reason="parsed.ok ? undefined : validationLabel(parsed)"
|
||||||
@started="(id) => { view = 'canvas'; void follow(id); }"
|
@started="(id) => { view = 'canvas'; void follow(id); }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,10 +15,8 @@ import {
|
|||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "@/components/ui/context-menu";
|
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 { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||||
import { MoreMenu } from "@/components/ui/more-menu";
|
import { MoreMenu } from "@/components/ui/more-menu";
|
||||||
import NewTaskForm from "@/tasks/NewTaskForm.vue";
|
|
||||||
import { Section } from "@/components/ui/section";
|
import { Section } from "@/components/ui/section";
|
||||||
import { StatusDot } from "@/components/ui/status-dot";
|
import { StatusDot } from "@/components/ui/status-dot";
|
||||||
import { Switch } from "@/components/ui/switch";
|
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.
|
// The editor's tab, so a row can open straight onto its runs.
|
||||||
const view = ref("canvas");
|
const view = ref("canvas");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const runTarget = ref("");
|
// A row's Run opens the editor's run dialog on that workflow.
|
||||||
const runOpen = computed({
|
const runOpen = ref(false);
|
||||||
get: () => runTarget.value !== "",
|
function runWorkflow(id: string): void {
|
||||||
set: (open) => {
|
selected.value = id;
|
||||||
if (!open) runTarget.value = "";
|
view.value = "canvas";
|
||||||
},
|
runOpen.value = true;
|
||||||
});
|
}
|
||||||
|
|
||||||
async function duplicate(id: string) {
|
async function duplicate(id: string) {
|
||||||
const source = stored.value.find((d) => d.id === id);
|
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 (enabled !== undefined) actions.push({ label: enabled ? "Disable" : "Enable", icon: Power, run: () => void setEnabled(id, !enabled) });
|
||||||
if (saved) {
|
if (saved) {
|
||||||
actions.push(
|
actions.push(
|
||||||
{ label: "Run", icon: Play, run: () => (runTarget.value = id) },
|
{ label: "Run", icon: Play, run: () => runWorkflow(id) },
|
||||||
{
|
{
|
||||||
label: "Open runs",
|
label: "Open runs",
|
||||||
icon: ListChecks,
|
icon: ListChecks,
|
||||||
@@ -265,7 +263,7 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
|||||||
<Badge v-if="provenance" variant="outline" class="shrink-0">{{ provenance }}</Badge>
|
<Badge v-if="provenance" variant="outline" class="shrink-0">{{ provenance }}</Badge>
|
||||||
<ApplyStatusRows kind="workflow-definitions" compact />
|
<ApplyStatusRows kind="workflow-definitions" compact />
|
||||||
</header>
|
</header>
|
||||||
<WorkflowEditor v-model:selected="selected" v-model:view="view" :stage-stats="stages" :stats-known="statsKnown" :stats-error="error ?? ''">
|
<WorkflowEditor v-model:selected="selected" v-model:view="view" v-model:run-open="runOpen" :stage-stats="stages" :stats-known="statsKnown" :stats-error="error ?? ''">
|
||||||
<template #title>
|
<template #title>
|
||||||
<h2 class="min-w-0 truncate text-title font-medium">{{ selected }}</h2>
|
<h2 class="min-w-0 truncate text-title font-medium">{{ selected }}</h2>
|
||||||
<Badge v-if="provenance" variant="outline" class="shrink-0">{{ provenance }}</Badge>
|
<Badge v-if="provenance" variant="outline" class="shrink-0">{{ provenance }}</Badge>
|
||||||
@@ -277,13 +275,5 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
|||||||
</WorkflowEditor>
|
</WorkflowEditor>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
<Dialog v-model:open="runOpen">
|
|
||||||
<DialogContent class="sm:max-w-[640px]">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>Run {{ runTarget }}</DialogTitle>
|
|
||||||
</DialogHeader>
|
|
||||||
<NewTaskForm v-if="runTarget" :workflow="runTarget" @started="(taskId) => { runTarget = ''; void router.push(`/tasks/${taskId}`); }" @cancel="runTarget = ''" />
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
Reference in new issue
Block a user