mirror of
				https://github.com/MindWorkAI/AI-Studio.git
				synced 2025-10-31 00:20:21 +00:00 
			
		
		
		
	Allow expanding all root nodes (default by now)
This commit is contained in:
		
							parent
							
								
									71634ea566
								
							
						
					
					
						commit
						b5cac31d08
					
				| @ -1,4 +1,4 @@ | ||||
| <MudTreeView T="ITreeItem" Items="@this.treeItems" SelectionMode="SelectionMode.SingleSelection" Hover="@true" ExpandOnClick="@true"> | ||||
| <MudTreeView T="ITreeItem" Items="@this.treeItems" SelectionMode="SelectionMode.SingleSelection" Hover="@true" ExpandOnClick="@true" Class="ma-3"> | ||||
|     <ItemTemplate Context="item"> | ||||
|         @switch (item.Value) | ||||
|         { | ||||
| @ -11,7 +11,7 @@ | ||||
|             case TreeItemData treeItem: | ||||
|                 @if (treeItem.Type is TreeItemType.CHAT) | ||||
|                 { | ||||
|                     <MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" CanExpand="@treeItem.Expandable" Items="@treeItem.Children" OnClick="() => this.LoadChat(treeItem.Path, true)"> | ||||
|                     <MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@treeItem.Children" OnClick="() => this.LoadChat(treeItem.Path, true)"> | ||||
|                         <BodyContent> | ||||
|                             <div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%"> | ||||
|                                 <MudText Style="justify-self: start;"> | ||||
| @ -44,7 +44,7 @@ | ||||
|                 } | ||||
|                 else if (treeItem.Type is TreeItemType.WORKSPACE) | ||||
|                 { | ||||
|                     <MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" CanExpand="@treeItem.Expandable" Items="@treeItem.Children"> | ||||
|                     <MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@treeItem.Children"> | ||||
|                         <BodyContent> | ||||
|                             <div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%"> | ||||
|                                 <MudText Style="justify-self: start;">@treeItem.Text</MudText> | ||||
| @ -63,7 +63,7 @@ | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     <MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" CanExpand="@treeItem.Expandable" Items="@treeItem.Children"> | ||||
|                     <MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@treeItem.Children"> | ||||
|                         <BodyContent> | ||||
|                             <div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%"> | ||||
|                                 <MudText Style="justify-self: start;">@treeItem.Text</MudText> | ||||
|  | ||||
| @ -35,6 +35,9 @@ public partial class Workspaces : ComponentBase | ||||
|     [Parameter] | ||||
|     public Func<Task> 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<ITreeItem> | ||||
|         var workspacesNode = new TreeItemData<ITreeItem> | ||||
|         { | ||||
|             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<ITreeItem> | ||||
|         { | ||||
|             Expandable = false, | ||||
|             Value = new TreeDivider(), | ||||
|         }); | ||||
|          | ||||
|         this.treeItems.Add(new TreeItemData<ITreeItem> | ||||
|         var tempChatNode = new TreeItemData<ITreeItem> | ||||
|         { | ||||
|             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<ITreeItem> | ||||
|         { | ||||
|             Expandable = false, | ||||
|             Value = new TreeDivider(), | ||||
|         }); | ||||
|         this.treeItems.Add(tempChatNode); | ||||
|     } | ||||
| 
 | ||||
|     private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadTemporaryChats() | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user