feat(ui): edit retry backoff and needs on the canvas
This commit is contained in:
1 parent
0f0795e6f1
commit
68d0fe9055
3 files changed
+120
-74
No files matched your search
@@ -4,6 +4,7 @@ import { CircleHelp, Trash2, X } from "@lucide/vue";
|
||||
import { parse, stringify } from "yaml";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
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";
|
||||
@@ -59,6 +60,11 @@ function write(next: StepRecord): void {
|
||||
function setField(key: string, value: unknown): void {
|
||||
write({ ...step.value, [key]: value });
|
||||
}
|
||||
// Retry is one object: a field edit merges into it so attempts and backoff do
|
||||
// not clobber each other, and clearing both drops the key.
|
||||
function setRetry(next: { attempts?: number; backoff?: string }): void {
|
||||
setField("retry", { ...(step.value.retry as object), ...next });
|
||||
}
|
||||
function setSetting(key: string, value: unknown): void {
|
||||
write({ ...step.value, settings: { ...settings.value, [key]: value } });
|
||||
}
|
||||
@@ -246,7 +252,15 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
placeholder="1"
|
||||
class="h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]"
|
||||
:value="(step.retry as { attempts?: number } | undefined)?.attempts ?? ''"
|
||||
@input="setField('retry', ($event.target as HTMLInputElement).value === '' ? undefined : { ...(step.retry as object), attempts: Number(($event.target as HTMLInputElement).value) })"
|
||||
@input="setRetry({ attempts: ($event.target as HTMLInputElement).value === '' ? undefined : Number(($event.target as HTMLInputElement).value) })"
|
||||
/>
|
||||
</label>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Retry backoff</span>
|
||||
<DurationInput
|
||||
:model-value="(step.retry as { backoff?: string } | undefined)?.backoff ?? ''"
|
||||
:units="['s', 'm', 'h']"
|
||||
@update:model-value="setRetry({ backoff: $event || undefined })"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -59,6 +59,17 @@ const MODES = [
|
||||
{ value: "none", label: "None", hint: "Scratch workspace, no clone" },
|
||||
];
|
||||
const repository = computed(() => text("repository") || "required");
|
||||
|
||||
// needs is the workflow's declared harness requirements: captures (a stage
|
||||
// returns structured output through capture tools) and the largest gate-retry
|
||||
// budget any stage declares.
|
||||
const needs = computed<{ captures?: boolean; gate_retries?: number }>(() => {
|
||||
const value = workflowField(props.yaml, "needs");
|
||||
return value && typeof value === "object" ? (value as { captures?: boolean; gate_retries?: number }) : {};
|
||||
});
|
||||
function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
|
||||
set("needs", next);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -152,6 +163,27 @@ const repository = computed(() => text("repository") || "required");
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="space-y-1.5">
|
||||
<div class="text-xs font-medium text-muted-foreground">Run needs</div>
|
||||
<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]" title="A stage returns structured output through capture tools.">Captures</span>
|
||||
<Switch :model-value="needs.captures === true" @update:model-value="setNeeds({ ...needs, captures: $event || undefined })" />
|
||||
</label>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]" title="The largest gate-retry budget any stage declares.">Gate retries</span>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
placeholder="0"
|
||||
class="h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]"
|
||||
:value="needs.gate_retries ?? ''"
|
||||
@input="setNeeds({ ...needs, gate_retries: ($event.target as HTMLInputElement).value === '' ? undefined : Number(($event.target as HTMLInputElement).value) })"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="space-y-1.5">
|
||||
<div class="flex items-center text-xs font-medium text-muted-foreground">
|
||||
Starts when
|
||||
|
||||
Reference in new issue
Block a user