feat(ui): workflow canvas cards expand in place instead of side panels
This commit is contained in:
21 files changed
+691
-610
No files matched your search
+82
-148
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
|
||||
import { computed, ref, useId } from "vue";
|
||||
import { CircleHelp, Plus, Trash2, X } from "@lucide/vue";
|
||||
import { ChevronDown, CircleHelp, Plus, Trash2 } from "@lucide/vue";
|
||||
import { parse, stringify } from "yaml";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -9,18 +8,17 @@ import { DurationInput } from "@/components/ui/duration-input";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { stepIcon } from "./step-icons";
|
||||
import { addBranch, branchingOf, deleteBranch, renameBranch, earlierStepIDs, replaceStep, stepAt, workflowField, type StepPath, type StepRecord } from "./workflow-edit";
|
||||
import type { WorkflowDefinitionEntry } from "@/stores/workflows";
|
||||
import type { InputSpec } from "./bind-event";
|
||||
import { inputValue } from "./work-request";
|
||||
import OptionSelect from "./OptionSelect.vue";
|
||||
import WorkflowPicker from "./WorkflowPicker.vue";
|
||||
import { stepTitle } from "./workflow-graph";
|
||||
import { stepControlsProblem, settingsProblem, type SettingsSchema, type StepTypeInfo } from "./workflow-yaml";
|
||||
|
||||
const uid = useId();
|
||||
const props = defineProps<{ yaml: string; path: StepPath; vocabulary: StepTypeInfo[]; workflows: WorkflowDefinitionEntry[]; modelAliases: string[] }>();
|
||||
const emit = defineEmits<{ "update:yaml": [string]; close: []; remove: [] }>();
|
||||
const emit = defineEmits<{ "update:yaml": [string] }>();
|
||||
|
||||
const step = computed<StepRecord>(() => stepAt(props.yaml, props.path) ?? {});
|
||||
const branching = computed(() => branchingOf(step.value));
|
||||
@@ -66,8 +64,8 @@ function kindOf(key: string, schema: SettingsSchema): Kind {
|
||||
return "yaml";
|
||||
}
|
||||
|
||||
// The setting that says what the step does leads, on its own; choices and
|
||||
// switches follow in a compact block; structured settings come last.
|
||||
// The setting that says what the step does leads, on its own; everything else
|
||||
// waits behind More.
|
||||
const fields = computed(() => {
|
||||
const entries = Object.entries(info.value?.settings?.properties ?? {})
|
||||
.filter(([key]) => type.value !== "workflow.call" || !["inputs", "outputs"].includes(key))
|
||||
@@ -80,6 +78,8 @@ const fields = computed(() => {
|
||||
long: rest.filter((field) => ["text", "lines", "yaml"].includes(field.kind)),
|
||||
};
|
||||
});
|
||||
const more = ref(!fields.value.lead && !branching.value);
|
||||
const choices = (options: string[]) => [{ value: "", label: "Default" }, ...options.map((option) => ({ value: option, label: option }))];
|
||||
|
||||
function write(next: StepRecord): void {
|
||||
// id and type lead, the way a step is read.
|
||||
@@ -117,10 +117,13 @@ const callerOutputs = computed(() => Object.entries((workflowField(props.yaml, "
|
||||
const inputMap = computed(() => (settings.value.inputs ?? {}) as Record<string, unknown>);
|
||||
const outputMap = computed(() => (settings.value.outputs ?? {}) as Record<string, string>);
|
||||
const isReference = (value: unknown) => typeof value === "string" && value.startsWith("inputs.");
|
||||
const structured = (spec: InputSpec) => ["object", "array"].includes(spec.type ?? "");
|
||||
const inputText = (name: string) => inputMap.value[name] === undefined ? "" : String(inputMap.value[name]);
|
||||
function setCallInput(name: string, value: string, inputType?: string): void {
|
||||
setSetting("inputs", { ...inputMap.value, [name]: value === "" ? undefined : isReference(value) ? value : inputValue(value, inputType ?? "string") });
|
||||
}
|
||||
const matching = (list: [string, InputSpec][], spec: InputSpec, prefix: string) =>
|
||||
list.filter(([, other]) => other.type === spec.type || other.type === "any" || spec.type === "any").map(([key]) => ({ value: `${prefix}.${key}`, label: key }));
|
||||
|
||||
// A reference goes into the text setting last focused: that is how this step
|
||||
// is connected to an earlier step's result.
|
||||
@@ -146,87 +149,65 @@ const asYaml = (value: unknown) => (value === undefined ? "" : stringify(value).
|
||||
const label = (key: string, schema: SettingsSchema) =>
|
||||
schema.title ?? key.replaceAll("_", " ").replace(/^./, (c) => c.toUpperCase());
|
||||
const text = (key: string) => (typeof settings.value[key] === "string" ? (settings.value[key] as string) : "");
|
||||
const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue", label: "Continue" }];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside class="flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl">
|
||||
<header class="flex items-center gap-2.5 border-b border-border px-4 py-3">
|
||||
<span class="flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary">
|
||||
<component :is="stepIcon(type)" class="size-4" />
|
||||
</span>
|
||||
<div class="min-w-0 flex-1">
|
||||
<Input
|
||||
:model-value="(step.id as string) ?? ''"
|
||||
class="h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent"
|
||||
:placeholder="stepTitle(type)"
|
||||
aria-label="Step id"
|
||||
@update:model-value="(value) => setField('id', String(value))"
|
||||
/>
|
||||
<div class="truncate font-mono text-[11px] text-fg-subtle">{{ type }}</div>
|
||||
<div class="space-y-4 px-3 py-3">
|
||||
<p v-if="problem" class="rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger" role="alert">{{ problem }}</p>
|
||||
|
||||
<section v-if="branching" class="space-y-3">
|
||||
<label v-if="type === 'switch'" class="block space-y-1.5">
|
||||
<span class="text-xs font-medium text-muted-foreground" title="The value whose case runs; a case named default runs when none matches">Switch on</span>
|
||||
<Input :model-value="branching.on" class="font-mono" placeholder="steps.assess.result.fit" :list="`${uid}-switch-on`" @change="setOn(($event.target as HTMLInputElement).value.trim())" />
|
||||
<datalist :id="`${uid}-switch-on`"><option v-for="id in earlier" :key="id" :value="`steps.${id}.result.`" /></datalist>
|
||||
</label>
|
||||
<div class="text-xs font-medium text-muted-foreground">{{ type === "switch" ? "Cases" : "Branches" }}</div>
|
||||
<div v-for="name in branches" :key="name" class="flex items-center gap-2">
|
||||
<Input :model-value="name" :class="type === 'switch' && 'font-mono'" :aria-label="`${type === 'switch' ? 'Case' : 'Branch'} ${name}`" @change="changeBranch('rename', name, ($event.target as HTMLInputElement).value.trim())" />
|
||||
<Button type="button" variant="ghost" size="icon-sm" :aria-label="`Remove ${name}`" :disabled="branches.length <= minBranches" @click="changeBranch('delete', name)"><Trash2 /></Button>
|
||||
</div>
|
||||
<Button type="button" variant="ghost" size="icon-sm" aria-label="Close" @click="emit('close')"><X /></Button>
|
||||
</header>
|
||||
<div class="flex items-center gap-2">
|
||||
<Input v-model="newBranch" :aria-label="type === 'switch' ? 'New case value' : 'New branch name'" :placeholder="type === 'switch' ? 'Value, or default' : 'Branch name'" @keydown.enter.prevent="changeBranch('add', newBranch.trim())" />
|
||||
<Button type="button" size="icon-sm" variant="outline" :aria-label="type === 'switch' ? 'Add case' : 'Add branch'" :disabled="!newBranch.trim()" @click="changeBranch('add', newBranch.trim())"><Plus /></Button>
|
||||
</div>
|
||||
<p v-if="branchError" role="alert" class="text-xs text-danger">{{ branchError }}</p>
|
||||
</section>
|
||||
|
||||
<div class="flex-1 space-y-5 overflow-y-auto px-4 py-4">
|
||||
<p v-if="problem" class="rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger" role="alert">{{ problem }}</p>
|
||||
|
||||
<section v-if="branching" class="space-y-3">
|
||||
<template v-if="type === 'switch'">
|
||||
<label class="block space-y-1.5">
|
||||
<span class="text-xs font-medium text-muted-foreground" title="The value whose case runs; a case named default runs when none matches">Switch on</span>
|
||||
<Input :model-value="branching.on" class="font-mono" placeholder="steps.assess.result.fit" list="switch-on" @change="setOn(($event.target as HTMLInputElement).value.trim())" />
|
||||
<datalist id="switch-on"><option v-for="id in earlier" :key="id" :value="`steps.${id}.result.`" /></datalist>
|
||||
</label>
|
||||
<section v-if="fields.lead" class="space-y-1.5">
|
||||
<div class="flex items-center gap-1 text-xs font-medium text-muted-foreground" :title="fields.lead.schema.description">
|
||||
{{ label(fields.lead.key, fields.lead.schema) }}
|
||||
<CircleHelp v-if="fields.lead.schema.description" class="size-3 text-fg-subtle" />
|
||||
</div>
|
||||
<WorkflowPicker v-if="fields.lead.kind === 'workflow'" :value="text(fields.lead.key)" :workflows="workflows" :label="label(fields.lead.key, fields.lead.schema)" @pick="setTarget(fields.lead.key, $event)" />
|
||||
<OptionSelect v-else-if="fields.lead.kind === 'select'" class="w-full" :model-value="text(fields.lead.key)" :options="choices(fields.lead.options)" :aria-label="label(fields.lead.key, fields.lead.schema)" @update:model-value="setSetting(fields.lead.key, $event || undefined)" />
|
||||
<Textarea
|
||||
v-else-if="fields.lead.kind === 'text'"
|
||||
:model-value="text(fields.lead.key)"
|
||||
class="min-h-32 text-[13px] leading-relaxed"
|
||||
@focus="focused = fields.lead.key"
|
||||
@update:model-value="setSetting(fields.lead.key, String($event))"
|
||||
/>
|
||||
<Input
|
||||
v-else
|
||||
:model-value="text(fields.lead.key)"
|
||||
@focus="focused = fields.lead.key"
|
||||
@update:model-value="setSetting(fields.lead.key, String($event))"
|
||||
/>
|
||||
<div v-if="earlier.length && fields.lead.kind !== 'select'" class="flex flex-wrap items-center gap-1 pt-0.5">
|
||||
<span class="text-[11px] text-fg-subtle">Insert</span>
|
||||
<template v-for="id in earlier" :key="id">
|
||||
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'summary')">{{ id }}</Button>
|
||||
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'result')">{{ id }}.result</Button>
|
||||
</template>
|
||||
<div class="text-xs font-medium text-muted-foreground">{{ type === "switch" ? "Cases" : "Branches" }}</div>
|
||||
<div v-for="name in branches" :key="name" class="flex items-center gap-2">
|
||||
<Input :model-value="name" :class="type === 'switch' && 'font-mono'" :aria-label="`${type === 'switch' ? 'Case' : 'Branch'} ${name}`" @change="changeBranch('rename', name, ($event.target as HTMLInputElement).value.trim())" />
|
||||
<Button type="button" variant="ghost" size="icon-sm" :aria-label="`Remove ${name}`" :disabled="branches.length <= minBranches" @click="changeBranch('delete', name)"><Trash2 /></Button>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<Input v-model="newBranch" :aria-label="type === 'switch' ? 'New case value' : 'New branch name'" :placeholder="type === 'switch' ? 'Value, or default' : 'Branch name'" @keydown.enter.prevent="changeBranch('add', newBranch.trim())" />
|
||||
<Button type="button" size="icon-sm" variant="outline" :aria-label="type === 'switch' ? 'Add case' : 'Add branch'" :disabled="!newBranch.trim()" @click="changeBranch('add', newBranch.trim())"><Plus /></Button>
|
||||
</div>
|
||||
<p v-if="branchError" role="alert" class="text-xs text-danger">{{ branchError }}</p>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="fields.lead" class="space-y-1.5">
|
||||
<div class="flex items-center gap-1 text-xs font-medium text-muted-foreground" :title="fields.lead.schema.description">
|
||||
{{ label(fields.lead.key, fields.lead.schema) }}
|
||||
<CircleHelp v-if="fields.lead.schema.description" class="size-3 text-fg-subtle" />
|
||||
</div>
|
||||
<WorkflowPicker v-if="fields.lead.kind === 'workflow'" :value="text(fields.lead.key)" :workflows="workflows" :label="label(fields.lead.key, fields.lead.schema)" @pick="setTarget(fields.lead.key, $event)" />
|
||||
<NativeSelect
|
||||
size="sm"
|
||||
v-else-if="fields.lead.kind === 'select'" class="w-full"
|
||||
:model-value="text(fields.lead.key)"
|
||||
@update:model-value="(value) => setSetting(fields.lead.key, String(value) || undefined)"
|
||||
>
|
||||
<NativeSelectOption value="">Default</NativeSelectOption>
|
||||
<NativeSelectOption v-for="option in fields.lead.options" :key="option" :value="option">{{ option }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<Textarea
|
||||
v-else-if="fields.lead.kind === 'text'"
|
||||
:model-value="text(fields.lead.key)"
|
||||
class="min-h-40 text-[13px] leading-relaxed"
|
||||
@focus="focused = fields.lead.key"
|
||||
@update:model-value="setSetting(fields.lead.key, String($event))"
|
||||
/>
|
||||
<Input
|
||||
v-else
|
||||
:model-value="text(fields.lead.key)"
|
||||
@focus="focused = fields.lead.key"
|
||||
@update:model-value="setSetting(fields.lead.key, String($event))"
|
||||
/>
|
||||
<div v-if="earlier.length && fields.lead.kind !== 'select'" class="flex flex-wrap items-center gap-1 pt-0.5">
|
||||
<span class="text-[11px] text-fg-subtle">Insert</span>
|
||||
<template v-for="id in earlier" :key="id">
|
||||
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'summary')">{{ id }}</Button>
|
||||
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'result')">{{ id }}.result</Button>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
<Button type="button" variant="ghost" size="xs" class="-ml-2 text-muted-foreground" :aria-expanded="more" @click="more = !more">
|
||||
<ChevronDown data-icon="inline-start" class="transition-transform" :class="!more && '-rotate-90'" />More
|
||||
</Button>
|
||||
|
||||
<template v-if="more">
|
||||
<section v-if="fields.compact.length" class="divide-y divide-border rounded-md border border-border">
|
||||
<div v-for="field in fields.compact" :key="field.key" class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex flex-1 items-center gap-1 text-[13px]" :title="field.schema.description">
|
||||
@@ -234,20 +215,8 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
<CircleHelp v-if="field.schema.description" class="size-3 text-fg-subtle" />
|
||||
</span>
|
||||
<WorkflowPicker v-if="field.kind === 'workflow'" class="max-w-48" :value="text(field.key)" :workflows="workflows" :label="label(field.key, field.schema)" @pick="setTarget(field.key, $event)" />
|
||||
<Switch
|
||||
v-else-if="field.kind === 'boolean'"
|
||||
:model-value="settings[field.key] === true"
|
||||
@update:model-value="setSetting(field.key, $event || undefined)"
|
||||
/>
|
||||
<NativeSelect
|
||||
size="sm"
|
||||
v-else-if="field.kind === 'select'" class="max-w-40"
|
||||
:model-value="text(field.key)"
|
||||
@update:model-value="(value) => setSetting(field.key, String(value) || undefined)"
|
||||
>
|
||||
<NativeSelectOption value="">Default</NativeSelectOption>
|
||||
<NativeSelectOption v-for="option in field.options" :key="option" :value="option">{{ option }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<Switch v-else-if="field.kind === 'boolean'" :model-value="settings[field.key] === true" @update:model-value="setSetting(field.key, $event || undefined)" />
|
||||
<OptionSelect v-else-if="field.kind === 'select'" class="w-40" :model-value="text(field.key)" :options="choices(field.options)" :aria-label="label(field.key, field.schema)" @update:model-value="setSetting(field.key, $event || undefined)" />
|
||||
<Input
|
||||
v-else-if="field.kind === 'number'"
|
||||
type="number"
|
||||
@@ -255,13 +224,7 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
:model-value="(settings[field.key] as number | undefined) ?? ''"
|
||||
@update:model-value="(value) => setSetting(field.key, String(value) === '' ? undefined : Number(String(value)))"
|
||||
/>
|
||||
<Input
|
||||
v-else
|
||||
class="h-7 w-40 text-[13px]"
|
||||
:model-value="text(field.key)"
|
||||
@focus="focused = field.key"
|
||||
@update:model-value="(value) => setSetting(field.key, String(value))"
|
||||
/>
|
||||
<Input v-else class="h-7 w-40 text-[13px]" :model-value="text(field.key)" @focus="focused = field.key" @update:model-value="(value) => setSetting(field.key, String(value))" />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -270,17 +233,16 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
<div class="text-xs font-medium text-muted-foreground">Inputs</div>
|
||||
<div v-for="[name, spec] in callInputs" :key="name" class="space-y-1.5">
|
||||
<div class="text-[13px]">{{ name }}<span v-if="spec.required" class="text-danger"> *</span><span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
|
||||
<NativeSelect size="sm" :aria-label="`${name} source`" class="w-full" :model-value="isReference(inputMap[name]) || ['object', 'array'].includes(spec.type ?? '') ? 'input' : 'value'" @update:model-value="(value) => setCallInput(name, String(value) === 'input' ? 'inputs.' : '')">
|
||||
<NativeSelectOption v-if="!['object', 'array'].includes(spec.type ?? '')" value="value">Value</NativeSelectOption>
|
||||
<NativeSelectOption value="input">Caller input</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<NativeSelect size="sm" v-if="isReference(inputMap[name]) || ['object', 'array'].includes(spec.type ?? '')" :aria-label="name" class="w-full" :model-value="inputText(name)" @update:model-value="(value) => setCallInput(name, String(value))">
|
||||
<NativeSelectOption value="">Choose input</NativeSelectOption>
|
||||
<NativeSelectOption v-for="[key] in callerInputs.filter(([, input]) => input.type === spec.type || input.type === 'any' || spec.type === 'any')" :key="key" :value="`inputs.${key}`">{{ key }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<NativeSelect size="sm" v-else-if="spec.type === 'bool'" :aria-label="name" class="w-full" :model-value="inputText(name)" @update:model-value="(value) => setCallInput(name, String(value), spec.type)">
|
||||
<NativeSelectOption value="">Unset</NativeSelectOption><NativeSelectOption value="true">True</NativeSelectOption><NativeSelectOption value="false">False</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<OptionSelect
|
||||
v-if="!structured(spec)"
|
||||
class="w-full"
|
||||
:aria-label="`${name} source`"
|
||||
:model-value="isReference(inputMap[name]) ? 'input' : 'value'"
|
||||
:options="[{ value: 'value', label: 'Value' }, { value: 'input', label: 'Caller input' }]"
|
||||
@update:model-value="setCallInput(name, $event === 'input' ? 'inputs.' : '')"
|
||||
/>
|
||||
<OptionSelect v-if="isReference(inputMap[name]) || structured(spec)" class="w-full" :aria-label="name" placeholder="Choose input" :model-value="inputText(name) === 'inputs.' ? '' : inputText(name)" :options="matching(callerInputs, spec, 'inputs')" @update:model-value="setCallInput(name, $event)" />
|
||||
<OptionSelect v-else-if="spec.type === 'bool'" class="w-full" :aria-label="name" :model-value="inputText(name)" :options="[{ value: '', label: 'Unset' }, { value: 'true', label: 'True' }, { value: 'false', label: 'False' }]" @update:model-value="setCallInput(name, $event, spec.type)" />
|
||||
<Input v-else :aria-label="name" :type="spec.type === 'number' ? 'number' : 'text'" step="any" :model-value="inputText(name)" @update:model-value="setCallInput(name, String($event), spec.type)" />
|
||||
</div>
|
||||
</section>
|
||||
@@ -288,10 +250,7 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
<div class="text-xs font-medium text-muted-foreground">Outputs</div>
|
||||
<div v-for="[name, spec] in callOutputs" :key="name" class="space-y-1.5">
|
||||
<div class="text-[13px]">{{ name }}<span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
|
||||
<NativeSelect size="sm" :aria-label="`${name} output`" :disabled="settings.wait !== true" class="w-full" :model-value="outputMap[name] ?? ''" @update:model-value="(value) => setSetting('outputs', { ...outputMap, [name]: String(value) || undefined })">
|
||||
<NativeSelectOption value="">Do not publish</NativeSelectOption>
|
||||
<NativeSelectOption v-for="[key] in callerOutputs.filter(([, output]) => output.type === spec.type || spec.type === 'any' || output.type === 'any')" :key="key" :value="`outputs.${key}`">{{ key }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<OptionSelect class="w-full" :aria-label="`${name} output`" :disabled="settings.wait !== true" :model-value="outputMap[name] ?? ''" :options="[{ value: '', label: 'Do not publish' }, ...matching(callerOutputs, spec, 'outputs')]" @update:model-value="setSetting('outputs', { ...outputMap, [name]: $event || undefined })" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -301,13 +260,7 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
{{ label(field.key, field.schema) }}
|
||||
<CircleHelp v-if="field.schema.description" class="size-3 text-fg-subtle" />
|
||||
</div>
|
||||
<Textarea
|
||||
v-if="field.kind === 'text'"
|
||||
:model-value="text(field.key)"
|
||||
class="min-h-20 text-[13px]"
|
||||
@focus="focused = field.key"
|
||||
@update:model-value="setSetting(field.key, String($event))"
|
||||
/>
|
||||
<Textarea v-if="field.kind === 'text'" :model-value="text(field.key)" class="min-h-20 text-[13px]" @focus="focused = field.key" @update:model-value="setSetting(field.key, String($event))" />
|
||||
<Textarea
|
||||
v-else-if="field.kind === 'lines'"
|
||||
:model-value="Array.isArray(settings[field.key]) ? (settings[field.key] as string[]).join('\n') : ''"
|
||||
@@ -316,23 +269,16 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
@update:model-value="setSetting(field.key, String($event).split('\n').filter(Boolean))"
|
||||
/>
|
||||
<template v-else>
|
||||
<Textarea
|
||||
:model-value="asYaml(settings[field.key])"
|
||||
class="min-h-24 font-mono text-xs"
|
||||
placeholder="YAML"
|
||||
@change="setYamlSetting(field.key, ($event.target as HTMLTextAreaElement).value)"
|
||||
/>
|
||||
<Textarea :model-value="asYaml(settings[field.key])" class="min-h-24 font-mono text-xs" placeholder="YAML" @change="setYamlSetting(field.key, ($event.target as HTMLTextAreaElement).value)" />
|
||||
<span v-if="yamlErrors[field.key]" class="text-xs text-danger">{{ yamlErrors[field.key] }}</span>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<section class="space-y-2">
|
||||
<div class="text-xs font-medium text-muted-foreground">Flow</div>
|
||||
<p class="text-xs text-fg-muted">Leave the condition empty to always run. Use a field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true.</p>
|
||||
<section class="space-y-1.5">
|
||||
<p v-if="flowProblem" role="alert" class="text-xs text-danger">{{ flowProblem }}</p>
|
||||
<div class="divide-y divide-border rounded-md border border-border">
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Run only when</span>
|
||||
<span class="flex-1 text-[13px]" title="Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true">Run only when</span>
|
||||
<Input
|
||||
class="h-7 w-48 font-mono text-xs"
|
||||
placeholder="inputs.enabled"
|
||||
@@ -343,14 +289,7 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
</label>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">If it fails</span>
|
||||
<NativeSelect
|
||||
size="sm"
|
||||
:model-value="(step.on_failure as string) ?? ''"
|
||||
@update:model-value="(value) => setField('on_failure', String(value) || undefined)"
|
||||
>
|
||||
<NativeSelectOption value="">Park the task</NativeSelectOption>
|
||||
<NativeSelectOption value="continue">Continue</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<OptionSelect class="w-36" aria-label="If it fails" :model-value="(step.on_failure as string) ?? ''" :options="ON_FAILURE" @update:model-value="setField('on_failure', $event || undefined)" />
|
||||
</label>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Attempts</span>
|
||||
@@ -375,11 +314,6 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<footer class="flex items-center border-t border-border px-4 py-2.5">
|
||||
<Button type="button" variant="ghost" size="sm" class="text-danger" @click="emit('remove')"><Trash2 />Delete step</Button>
|
||||
<Button type="button" size="sm" class="ml-auto" @click="emit('close')">Done</Button>
|
||||
</footer>
|
||||
</aside>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user