diff --git a/app/MindWork AI Studio/Components/Workspaces.razor.cs b/app/MindWork AI Studio/Components/Workspaces.razor.cs index 2a2164ba..46f44a96 100644 --- a/app/MindWork AI Studio/Components/Workspaces.razor.cs +++ b/app/MindWork AI Studio/Components/Workspaces.razor.cs @@ -56,7 +56,7 @@ public partial class Workspaces : MSGComponentBase protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); - this.ApplyFilters([], [ Event.AI_JOB_CHANGED, Event.AI_JOB_FINISHED, Event.CHAT_GENERATION_CHANGED ]); + this.ApplyFilters([], [ Event.AI_JOB_CHANGED, Event.AI_JOB_FINISHED, Event.CHAT_GENERATION_CHANGED, Event.WORKSPACE_CREATED ]); _ = this.LoadTreeItemsAsync(startPrefetch: true); } @@ -887,6 +887,10 @@ public partial class Workspaces : MSGComponentBase await this.ForceRefreshFromDiskAsync(); break; + case Event.WORKSPACE_CREATED: + await this.LoadTreeItemsAsync(startPrefetch: false); + break; + case Event.AI_JOB_CHANGED: case Event.AI_JOB_FINISHED: case Event.CHAT_GENERATION_CHANGED: diff --git a/app/MindWork AI Studio/Dialogs/WorkspaceSelectionDialog.razor b/app/MindWork AI Studio/Dialogs/WorkspaceSelectionDialog.razor index 3e0cee72..460b1bd6 100644 --- a/app/MindWork AI Studio/Dialogs/WorkspaceSelectionDialog.razor +++ b/app/MindWork AI Studio/Dialogs/WorkspaceSelectionDialog.razor @@ -19,11 +19,13 @@ { workspaces = []; private readonly string escapeHandlerId = $"workspace-selection-dialog-{Guid.NewGuid():N}"; private MudForm? createWorkspaceForm; + private MudTextField? newWorkspaceNameField; private DotNetObjectReference? dotNetReference; private Guid selectedWorkspace; private string newWorkspaceName = string.Empty; private bool isCreatingWorkspace; private bool showCreateWorkspaceForm; + private bool shouldFocusNewWorkspaceName; private string? createWorkspaceError; private string? createWorkspaceErrorName; @@ -57,6 +59,12 @@ public partial class WorkspaceSelectionDialog : MSGComponentBase await this.JsRuntime.InvokeVoidAsync("registerEscapeHandler", this.escapeHandlerId, this.dotNetReference); } + if (this.shouldFocusNewWorkspaceName && this.newWorkspaceNameField is not null) + { + this.shouldFocusNewWorkspaceName = false; + await this.newWorkspaceNameField.FocusAsync(); + } + await base.OnAfterRenderAsync(firstRender); } @@ -102,6 +110,7 @@ public partial class WorkspaceSelectionDialog : MSGComponentBase this.createWorkspaceErrorName = null; this.newWorkspaceName = string.Empty; this.showCreateWorkspaceForm = true; + this.shouldFocusNewWorkspaceName = true; } private async Task CreateWorkspaceAsync() @@ -153,6 +162,7 @@ public partial class WorkspaceSelectionDialog : MSGComponentBase this.newWorkspaceName = string.Empty; this.createWorkspaceForm?.ResetValidation(); this.showCreateWorkspaceForm = false; + this.shouldFocusNewWorkspaceName = false; } [JSInvokable]