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 @@