From 1ae0f4822d3bbb7e370faf3d4b99c3a1d249e5a2 Mon Sep 17 00:00:00 2001 From: Guilhem Date: Mon, 10 Nov 2025 12:01:42 +0100 Subject: [PATCH] clean --- backend/windmill-common/src/flows.rs | 13 + .../lib/components/graph/FlowGraphV2.svelte | 21 +- .../graph/SelectionBoundingBox.svelte | 20 +- .../lib/components/graph/groupNoteUtils.ts | 140 +---------- .../components/graph/noteManager.svelte.ts | 236 +++++++++--------- .../graph/renderers/nodes/NoteNode.svelte | 82 ++---- frontend/src/lib/components/graph/util.ts | 24 ++ openflow.openapi.yaml | 14 ++ 8 files changed, 219 insertions(+), 331 deletions(-) diff --git a/backend/windmill-common/src/flows.rs b/backend/windmill-common/src/flows.rs index 58a69c8fb9..093d4ccdad 100644 --- a/backend/windmill-common/src/flows.rs +++ b/backend/windmill-common/src/flows.rs @@ -196,6 +196,13 @@ pub struct FlowValue { pub notes: Option>, } +#[derive(Deserialize, Serialize, Debug, Clone)] +#[serde(rename_all = "lowercase")] +pub enum FlowNoteType { + Free, + Group, +} + #[derive(Deserialize, Serialize, Debug, Clone)] pub struct FlowNote { pub id: String, @@ -203,6 +210,12 @@ pub struct FlowNote { pub position: FlowNotePosition, pub size: FlowNoteSize, pub color: String, + #[serde(rename = "type")] + pub note_type: FlowNoteType, + #[serde(default)] + pub locked: bool, + #[serde(skip_serializing_if = "Option::is_none")] + pub contained_node_ids: Option>, } #[derive(Deserialize, Serialize, Debug, Clone)] diff --git a/frontend/src/lib/components/graph/FlowGraphV2.svelte b/frontend/src/lib/components/graph/FlowGraphV2.svelte index 7320b81f9a..acd4f04161 100644 --- a/frontend/src/lib/components/graph/FlowGraphV2.svelte +++ b/frontend/src/lib/components/graph/FlowGraphV2.svelte @@ -221,6 +221,9 @@ // Initialize note manager (now stateless) const noteManager = new NoteManager() + // Runtime text height tracking for notes (not stored in FlowNote) + let noteTextHeights = $state>({}) + // Selection manager - create one if not provided let actualSelectionManager = selectionManager || new SelectionManager() @@ -339,7 +342,8 @@ const groupNoteHeight = noteManager.getGroupNoteHeightForNode( notes ?? [], node.id, - initialNodes + initialNodes, + noteTextHeights ) if (groupNoteHeight > 0) { spacingMap.set(node.id, groupNoteHeight) @@ -527,9 +531,17 @@ nodes = [ ...finalNodes, - ...noteManager.convertToNodes(notes ?? [], finalNodes, (newNotes) => { - notes = newNotes - }) + ...noteManager.convertToNodes( + notes ?? [], + finalNodes, + noteTextHeights, + (newNotes) => { + notes = newNotes + }, + (noteId, height) => { + noteTextHeights[noteId] = height + } + ) ] edges = [ ...(assetNodesResult?.newAssetEdges ?? []), @@ -708,6 +720,7 @@ } $inspect('dbg notes & nodes', notes, nodes) + $inspect('dbg noteTextHeights', noteTextHeights) {#if insertable} diff --git a/frontend/src/lib/components/graph/SelectionBoundingBox.svelte b/frontend/src/lib/components/graph/SelectionBoundingBox.svelte index 32e3775fa1..ef0e708913 100644 --- a/frontend/src/lib/components/graph/SelectionBoundingBox.svelte +++ b/frontend/src/lib/components/graph/SelectionBoundingBox.svelte @@ -1,7 +1,7 @@