diff --git a/web/app/(app)/workflows/[id]/page.tsx b/web/app/(app)/workflows/[id]/page.tsx index a42700e..e74c826 100644 --- a/web/app/(app)/workflows/[id]/page.tsx +++ b/web/app/(app)/workflows/[id]/page.tsx @@ -9,8 +9,7 @@ import { Button } from "@/components/ui"; import { EditWorkflowModal } from "@/components/workflows/EditWorkflowModal"; import { StepPickerModal } from "@/components/workflows/StepPickerModal"; -const inputClass = - "w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder-text-secondary/50 focus:border-signal focus:outline-none focus:ring-1 focus:ring-signal"; +const inputClass = "w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder-text-secondary/50 focus:border-signal focus:outline-none focus:ring-1 focus:ring-signal"; type DragPayload = { kind: "lib"; stepId: string } | { kind: "move"; from: number }; @@ -23,9 +22,6 @@ function AdhocBadge() { return ad-hoc; } - - - function snapshotOf(w: Workflow): string { return JSON.stringify({ name: w.name, @@ -87,8 +83,6 @@ export default function WorkflowBuilder() { } }, [loaded]); - - useEffect(() => { if (!secretGroups) return; secretGroups.forEach((g: SecretGroupSummary) => { @@ -104,17 +98,10 @@ export default function WorkflowBuilder() { setGroupKeys((prev) => ({ ...prev, [g.group]: [] })); }); }); - }, [secretGroups]); - - wfRef.current = wf; - - - - useEffect(() => { if (!wf || savedSnapshotRef.current === null) return; if (snapshotOf(wf) === savedSnapshotRef.current) return; @@ -122,10 +109,8 @@ export default function WorkflowBuilder() { save(); }, 800); return () => clearTimeout(t); - }, [wf]); - useEffect(() => { if (!lastSaved) return; const iv = setInterval(() => setTick((n) => n + 1), 15000); @@ -148,11 +133,7 @@ export default function WorkflowBuilder() { * NOTHING (a cleared field must not become a fleet-wide run), and multiple * tag keys AND together. Change one, change both. */ - const matched = (servers ?? []).filter( - (s) => - wf.target_server_ids.includes(s.server_id) || - (Object.keys(targetTags).length > 0 && Object.entries(targetTags).every(([k, v]) => s.tags?.[k] === v)), - ); + const matched = (servers ?? []).filter((s) => wf.target_server_ids.includes(s.server_id) || (Object.keys(targetTags).length > 0 && Object.entries(targetTags).every(([k, v]) => s.tags?.[k] === v))); const sortedSteps = [...wf.steps].sort((a, b) => a.order - b.order); const selectedRef = selected !== null ? sortedSteps[selected] : null; @@ -160,8 +141,6 @@ export default function WorkflowBuilder() { const selectedIdxInWf = selectedRef ? wf.steps.indexOf(selectedRef) : -1; const save = async () => { - - if (savingRef.current) return; const current = wfRef.current; if (!current) return; @@ -177,14 +156,9 @@ export default function WorkflowBuilder() { return; } if (wfRef.current && snapshotOf(wfRef.current) === snapshot) { - - savedSnapshotRef.current = snapshotOf(updated); setWf(updated); } else { - - - savedSnapshotRef.current = snapshot; } setLastSaved(new Date()); @@ -193,8 +167,7 @@ export default function WorkflowBuilder() { } finally { savingRef.current = false; setSaving(false); - - + if (wfRef.current && snapshotOf(wfRef.current) !== savedSnapshotRef.current) { setTimeout(() => save(), 0); } @@ -348,11 +321,8 @@ export default function WorkflowBuilder() {
{/* CENTER: canvas */}
-
-
@@ -365,11 +335,7 @@ export default function WorkflowBuilder() { a workflow touches; this panel only reports the result. */}

{wf.target_server_ids.length} named{" "} -

@@ -430,21 +396,14 @@ export default function WorkflowBuilder() { {lib && !ref.inline && } {ref.inline && }
-
-                                            {script.slice(0, 200)}
-                                        
+
{script.slice(0, 200)}
); })} {sortedSteps.length === 0 && ( - )} @@ -452,11 +411,7 @@ export default function WorkflowBuilder() { {/* RIGHT: inspector */} -