From b5cac31d082a7e2c2652ac9b35680878a332c52a Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 2 Nov 2024 22:46:16 +0100 Subject: [PATCH] Allow expanding all root nodes (default by now) --- .../Components/Workspaces.razor | 8 +++--- .../Components/Workspaces.razor.cs | 27 ++++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/MindWork AI Studio/Components/Workspaces.razor b/app/MindWork AI Studio/Components/Workspaces.razor index da8f503b..3046577d 100644 --- a/app/MindWork AI Studio/Components/Workspaces.razor +++ b/app/MindWork AI Studio/Components/Workspaces.razor @@ -1,4 +1,4 @@ - + @switch (item.Value) { @@ -11,7 +11,7 @@ case TreeItemData treeItem: @if (treeItem.Type is TreeItemType.CHAT) { - +
@@ -44,7 +44,7 @@ } else if (treeItem.Type is TreeItemType.WORKSPACE) { - +
@treeItem.Text @@ -63,7 +63,7 @@ } else { - +
@treeItem.Text diff --git a/app/MindWork AI Studio/Components/Workspaces.razor.cs b/app/MindWork AI Studio/Components/Workspaces.razor.cs index fcb845e2..48d77e22 100644 --- a/app/MindWork AI Studio/Components/Workspaces.razor.cs +++ b/app/MindWork AI Studio/Components/Workspaces.razor.cs @@ -35,6 +35,9 @@ public partial class Workspaces : ComponentBase [Parameter] public Func LoadedChatWasChanged { get; set; } = () => Task.CompletedTask; + [Parameter] + public bool ExpandRootNodes { get; set; } = true; + private const Placement WORKSPACE_ITEM_TOOLTIP_PLACEMENT = Placement.Bottom; public static readonly Guid WORKSPACE_ID_BIAS = Guid.Parse("82050a4e-ee92-43d7-8ee5-ab512f847e02"); @@ -73,9 +76,9 @@ public partial class Workspaces : ComponentBase private async Task LoadTreeItems() { - this.treeItems.Clear(); - this.treeItems.Add(new TreeItemData + var workspacesNode = new TreeItemData { + Expanded = this.ExpandRootNodes, Expandable = true, Value = new TreeItemData { @@ -87,16 +90,11 @@ public partial class Workspaces : ComponentBase Path = "root", Children = await this.LoadWorkspaces(), }, - }); + }; - this.treeItems.Add(new TreeItemData - { - Expandable = false, - Value = new TreeDivider(), - }); - - this.treeItems.Add(new TreeItemData + var tempChatNode = new TreeItemData { + Expanded = this.ExpandRootNodes, Expandable = true, Value = new TreeItemData { @@ -108,7 +106,16 @@ public partial class Workspaces : ComponentBase Path = "temp", Children = await this.LoadTemporaryChats(), }, + }; + + this.treeItems.Clear(); + this.treeItems.Add(workspacesNode); + this.treeItems.Add(new TreeItemData + { + Expandable = false, + Value = new TreeDivider(), }); + this.treeItems.Add(tempChatNode); } private async Task>> LoadTemporaryChats()