General migration to MudBlazor v7.x.x

This commit is contained in:
Thorsten Sommer 2024-07-23 19:53:02 +02:00
parent 0a03ab0aed
commit f7dd6b3074
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
14 changed files with 118 additions and 87 deletions

View File

@ -20,7 +20,7 @@
{ {
<MudPaper Class="pr-2 mt-3" Outlined="@true"> <MudPaper Class="pr-2 mt-3" Outlined="@true">
<MudText Typo="Typo.h6">Issues</MudText> <MudText Typo="Typo.h6">Issues</MudText>
<MudList Clickable="@true"> <MudList T="string">
@foreach (var issue in this.inputIssues) @foreach (var issue in this.inputIssues)
{ {
<MudListItem Icon="@Icons.Material.Filled.Error" IconColor="Color.Error"> <MudListItem Icon="@Icons.Material.Filled.Error" IconColor="Color.Error">

View File

@ -1,7 +1,7 @@
<MudList Clickable="@this.Clickable" Class="@this.Classes"> <MudList T="string" ReadOnly="@(!this.Clickable)" Class="@this.Classes">
@foreach(var item in this.Items) @foreach(var item in this.Items)
{ {
<MudListItem Icon="@this.Icon" Style="display: flex; align-items: flex-start;"> <MudListItem T="string" Icon="@this.Icon" Style="display: flex; align-items: flex-start;">
<MudText Typo="Typo.body1" Style="text-align: justify; hyphens: auto;"><b>@item.Header:</b> @item.Text</MudText> <MudText Typo="Typo.body1" Style="text-align: justify; hyphens: auto;"><b>@item.Header:</b> @item.Text</MudText>
</MudListItem> </MudListItem>
} }

View File

@ -18,5 +18,5 @@ public class TreeItemData : ITreeItem
public bool Expandable { get; init; } = true; public bool Expandable { get; init; } = true;
public HashSet<ITreeItem> Children { get; init; } = []; public IReadOnlyCollection<TreeItemData<ITreeItem>> Children { get; init; } = [];
} }

View File

@ -1,6 +1,6 @@
<MudTreeView T="ITreeItem" Items="@this.treeItems" MultiSelection="@false" Hover="@true" ExpandOnClick="@true"> <MudTreeView T="ITreeItem" Items="@this.treeItems" MultiSelection="@false" Hover="@true" ExpandOnClick="@true">
<ItemTemplate Context="item"> <ItemTemplate Context="item">
@switch (item) @switch (item.Value)
{ {
case TreeDivider: case TreeDivider:
<li style="min-height: 1em;"> <li style="min-height: 1em;">
@ -11,7 +11,7 @@
case TreeItemData treeItem: case TreeItemData treeItem:
@if (treeItem.Type is TreeItemType.CHAT) @if (treeItem.Type is TreeItemType.CHAT)
{ {
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item" CanExpand="@treeItem.Expandable" Items="@treeItem.Children" OnClick="() => this.LoadChat(treeItem.Path, true)"> <MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" CanExpand="@treeItem.Expandable" Items="@treeItem.Children" OnClick="() => this.LoadChat(treeItem.Path, true)">
<BodyContent> <BodyContent>
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%"> <div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
<MudText Style="justify-self: start;"> <MudText Style="justify-self: start;">
@ -44,7 +44,7 @@
} }
else if (treeItem.Type is TreeItemType.WORKSPACE) else if (treeItem.Type is TreeItemType.WORKSPACE)
{ {
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item" CanExpand="@treeItem.Expandable" Items="@treeItem.Children"> <MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" CanExpand="@treeItem.Expandable" Items="@treeItem.Children">
<BodyContent> <BodyContent>
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%"> <div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
<MudText Style="justify-self: start;">@treeItem.Text</MudText> <MudText Style="justify-self: start;">@treeItem.Text</MudText>
@ -63,7 +63,7 @@
} }
else else
{ {
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item" CanExpand="@treeItem.Expandable" Items="@treeItem.Children"> <MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" CanExpand="@treeItem.Expandable" Items="@treeItem.Children">
<BodyContent> <BodyContent>
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%"> <div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
<MudText Style="justify-self: start;">@treeItem.Text</MudText> <MudText Style="justify-self: start;">@treeItem.Text</MudText>

View File

@ -48,7 +48,7 @@ public partial class Workspaces : ComponentBase
} }
}; };
private readonly HashSet<ITreeItem> treeItems = new(); private readonly List<TreeItemData<ITreeItem>> treeItems = new();
#region Overrides of ComponentBase #region Overrides of ComponentBase
@ -70,33 +70,46 @@ public partial class Workspaces : ComponentBase
private async Task LoadTreeItems() private async Task LoadTreeItems()
{ {
this.treeItems.Clear(); this.treeItems.Clear();
this.treeItems.Add(new TreeItemData this.treeItems.Add(new TreeItemData<ITreeItem>
{ {
Depth = 0,
Branch = WorkspaceBranch.WORKSPACES,
Text = "Workspaces",
Icon = Icons.Material.Filled.Folder,
Expandable = true, Expandable = true,
Path = "root", Value = new TreeItemData
Children = await this.LoadWorkspaces(), {
Depth = 0,
Branch = WorkspaceBranch.WORKSPACES,
Text = "Workspaces",
Icon = Icons.Material.Filled.Folder,
Expandable = true,
Path = "root",
Children = await this.LoadWorkspaces(),
},
}); });
this.treeItems.Add(new TreeDivider()); this.treeItems.Add(new TreeItemData<ITreeItem>
this.treeItems.Add(new TreeItemData {
Expandable = false,
Value = new TreeDivider(),
});
this.treeItems.Add(new TreeItemData<ITreeItem>
{ {
Depth = 0,
Branch = WorkspaceBranch.TEMPORARY_CHATS,
Text = "Temporary chats",
Icon = Icons.Material.Filled.Timer,
Expandable = true, Expandable = true,
Path = "temp", Value = new TreeItemData
Children = await this.LoadTemporaryChats(), {
Depth = 0,
Branch = WorkspaceBranch.TEMPORARY_CHATS,
Text = "Temporary chats",
Icon = Icons.Material.Filled.Timer,
Expandable = true,
Path = "temp",
Children = await this.LoadTemporaryChats(),
},
}); });
} }
private async Task<HashSet<ITreeItem>> LoadTemporaryChats() private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadTemporaryChats()
{ {
var tempChildren = new HashSet<ITreeItem>(); var tempChildren = new List<TreeItemData<ITreeItem>>();
// //
// Search for workspace folders in the data directory: // Search for workspace folders in the data directory:
@ -115,15 +128,19 @@ public partial class Workspaces : ComponentBase
var chatNamePath = Path.Join(tempChatDirPath, "name"); var chatNamePath = Path.Join(tempChatDirPath, "name");
var chatName = await File.ReadAllTextAsync(chatNamePath, Encoding.UTF8); var chatName = await File.ReadAllTextAsync(chatNamePath, Encoding.UTF8);
tempChildren.Add(new TreeItemData tempChildren.Add(new TreeItemData<ITreeItem>
{ {
Type = TreeItemType.CHAT,
Depth = 1,
Branch = WorkspaceBranch.TEMPORARY_CHATS,
Text = chatName,
Icon = Icons.Material.Filled.Timer,
Expandable = false, Expandable = false,
Path = tempChatDirPath, Value = new TreeItemData
{
Type = TreeItemType.CHAT,
Depth = 1,
Branch = WorkspaceBranch.TEMPORARY_CHATS,
Text = chatName,
Icon = Icons.Material.Filled.Timer,
Expandable = false,
Path = tempChatDirPath,
},
}); });
} }
@ -140,9 +157,9 @@ public partial class Workspaces : ComponentBase
return await File.ReadAllTextAsync(workspaceNamePath, Encoding.UTF8); return await File.ReadAllTextAsync(workspaceNamePath, Encoding.UTF8);
} }
private async Task<HashSet<ITreeItem>> LoadWorkspaces() private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadWorkspaces()
{ {
var workspaces = new HashSet<ITreeItem>(); var workspaces = new List<TreeItemData<ITreeItem>>();
// //
// Search for workspace folders in the data directory: // Search for workspace folders in the data directory:
@ -161,26 +178,34 @@ public partial class Workspaces : ComponentBase
var workspaceNamePath = Path.Join(workspaceDirPath, "name"); var workspaceNamePath = Path.Join(workspaceDirPath, "name");
var workspaceName = await File.ReadAllTextAsync(workspaceNamePath, Encoding.UTF8); var workspaceName = await File.ReadAllTextAsync(workspaceNamePath, Encoding.UTF8);
workspaces.Add(new TreeItemData workspaces.Add(new TreeItemData<ITreeItem>
{ {
Type = TreeItemType.WORKSPACE,
Depth = 1,
Branch = WorkspaceBranch.WORKSPACES,
Text = workspaceName,
Icon = Icons.Material.Filled.Description,
Expandable = true, Expandable = true,
Path = workspaceDirPath, Value = new TreeItemData
Children = await this.LoadWorkspaceChats(workspaceDirPath), {
Type = TreeItemType.WORKSPACE,
Depth = 1,
Branch = WorkspaceBranch.WORKSPACES,
Text = workspaceName,
Icon = Icons.Material.Filled.Description,
Expandable = true,
Path = workspaceDirPath,
Children = await this.LoadWorkspaceChats(workspaceDirPath),
},
}); });
} }
workspaces.Add(new TreeButton(WorkspaceBranch.WORKSPACES, 1, "Add workspace",Icons.Material.Filled.LibraryAdd, this.AddWorkspace)); workspaces.Add(new TreeItemData<ITreeItem>
{
Expandable = false,
Value = new TreeButton(WorkspaceBranch.WORKSPACES, 1, "Add workspace",Icons.Material.Filled.LibraryAdd, this.AddWorkspace),
});
return workspaces; return workspaces;
} }
private async Task<HashSet<ITreeItem>> LoadWorkspaceChats(string workspacePath) private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadWorkspaceChats(string workspacePath)
{ {
var workspaceChats = new HashSet<ITreeItem>(); var workspaceChats = new List<TreeItemData<ITreeItem>>();
// Enumerate the workspace directory: // Enumerate the workspace directory:
foreach (var chatPath in Directory.EnumerateDirectories(workspacePath)) foreach (var chatPath in Directory.EnumerateDirectories(workspacePath))
@ -189,19 +214,28 @@ public partial class Workspaces : ComponentBase
var chatNamePath = Path.Join(chatPath, "name"); var chatNamePath = Path.Join(chatPath, "name");
var chatName = await File.ReadAllTextAsync(chatNamePath, Encoding.UTF8); var chatName = await File.ReadAllTextAsync(chatNamePath, Encoding.UTF8);
workspaceChats.Add(new TreeItemData workspaceChats.Add(new TreeItemData<ITreeItem>
{ {
Type = TreeItemType.CHAT,
Depth = 2,
Branch = WorkspaceBranch.WORKSPACES,
Text = chatName,
Icon = Icons.Material.Filled.Chat,
Expandable = false, Expandable = false,
Path = chatPath, Value = new TreeItemData
{
Type = TreeItemType.CHAT,
Depth = 2,
Branch = WorkspaceBranch.WORKSPACES,
Text = chatName,
Icon = Icons.Material.Filled.Chat,
Expandable = false,
Path = chatPath,
},
}); });
} }
workspaceChats.Add(new TreeButton(WorkspaceBranch.WORKSPACES, 2, "Add chat",Icons.Material.Filled.AddComment, () => this.AddChat(workspacePath))); workspaceChats.Add(new TreeItemData<ITreeItem>
{
Expandable = false,
Value = new TreeButton(WorkspaceBranch.WORKSPACES, 2, "Add chat",Icons.Material.Filled.AddComment, () => this.AddChat(workspacePath)),
});
return workspaceChats; return workspaceChats;
} }
@ -247,7 +281,7 @@ public partial class Workspaces : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Load Chat", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Load Chat", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return null; return null;
} }
@ -294,7 +328,7 @@ public partial class Workspaces : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Chat", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Chat", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
} }
@ -331,7 +365,7 @@ public partial class Workspaces : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<SingleInputDialog>("Rename Chat", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<SingleInputDialog>("Rename Chat", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
chat.Name = (dialogResult.Data as string)!; chat.Name = (dialogResult.Data as string)!;
@ -356,7 +390,7 @@ public partial class Workspaces : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<SingleInputDialog>("Rename Workspace", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<SingleInputDialog>("Rename Workspace", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
var alteredWorkspaceName = (dialogResult.Data as string)!; var alteredWorkspaceName = (dialogResult.Data as string)!;
@ -377,7 +411,7 @@ public partial class Workspaces : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<SingleInputDialog>("Add Workspace", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<SingleInputDialog>("Add Workspace", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
var workspaceId = Guid.NewGuid(); var workspaceId = Guid.NewGuid();
@ -408,7 +442,7 @@ public partial class Workspaces : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Workspace", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Workspace", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
Directory.Delete(workspacePath, true); Directory.Delete(workspacePath, true);
@ -430,7 +464,7 @@ public partial class Workspaces : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<WorkspaceSelectionDialog>("Move Chat to Workspace", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<WorkspaceSelectionDialog>("Move Chat to Workspace", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
var workspaceId = dialogResult.Data is Guid id ? id : default; var workspaceId = dialogResult.Data is Guid id ? id : default;
@ -475,7 +509,7 @@ public partial class Workspaces : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Create Chat", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Create Chat", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
} }

View File

@ -151,7 +151,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver
var dialogReference = await this.DialogService.ShowAsync<UpdateDialog>("Update", dialogParameters, DialogOptions.FULLSCREEN_NO_HEADER); var dialogReference = await this.DialogService.ShowAsync<UpdateDialog>("Update", dialogParameters, DialogOptions.FULLSCREEN_NO_HEADER);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
this.performingUpdate = true; this.performingUpdate = true;
@ -170,7 +170,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Leave Chat Page", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Leave Chat Page", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
{ {
context.PreventNavigation(); context.PreventNavigation();
return; return;

View File

@ -9,14 +9,14 @@
<MudText> <MudText>
The following list shows the versions of the MindWork AI Studio, the used compilers, build time, etc.: The following list shows the versions of the MindWork AI Studio, the used compilers, build time, etc.:
</MudText> </MudText>
<MudList Clickable="@true"> <MudList T="string">
<MudListItem Icon="@Icons.Material.Outlined.Chat" Text="@VersionApp"/> <MudListItem T="string" Icon="@Icons.Material.Outlined.Chat" Text="@VersionApp"/>
<MudListItem Icon="@Icons.Material.Outlined.Timer" Text="@BuildTime"/> <MudListItem T="string" Icon="@Icons.Material.Outlined.Timer" Text="@BuildTime"/>
<MudListItem Icon="@Icons.Material.Outlined.Build" Text="@VersionDotnetSdk"/> <MudListItem T="string" Icon="@Icons.Material.Outlined.Build" Text="@VersionDotnetSdk"/>
<MudListItem Icon="@Icons.Material.Outlined.Memory" Text="@VersionDotnetRuntime"/> <MudListItem T="string" Icon="@Icons.Material.Outlined.Memory" Text="@VersionDotnetRuntime"/>
<MudListItem Icon="@Icons.Material.Outlined.Build" Text="@VersionRust"/> <MudListItem T="string" Icon="@Icons.Material.Outlined.Build" Text="@VersionRust"/>
<MudListItem Icon="@Icons.Material.Outlined.Widgets" Text="@MudBlazorVersion"/> <MudListItem T="string" Icon="@Icons.Material.Outlined.Widgets" Text="@MudBlazorVersion"/>
<MudListItem Icon="@Icons.Material.Outlined.Memory" Text="@TauriVersion"/> <MudListItem T="string" Icon="@Icons.Material.Outlined.Memory" Text="@TauriVersion"/>
</MudList> </MudList>
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Update" OnClick="() => this.CheckForUpdate()"> <MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Update" OnClick="() => this.CheckForUpdate()">
Check for updates Check for updates

View File

@ -235,7 +235,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Chat", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Chat", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
} }
@ -297,7 +297,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
var confirmationDialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Unsaved Changes", confirmationDialogParameters, DialogOptions.FULLSCREEN); var confirmationDialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Unsaved Changes", confirmationDialogParameters, DialogOptions.FULLSCREEN);
var confirmationDialogResult = await confirmationDialogReference.Result; var confirmationDialogResult = await confirmationDialogReference.Result;
if (confirmationDialogResult.Canceled) if (confirmationDialogResult is null || confirmationDialogResult.Canceled)
return; return;
} }
@ -310,7 +310,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
var dialogReference = await this.DialogService.ShowAsync<WorkspaceSelectionDialog>("Move Chat to Workspace", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<WorkspaceSelectionDialog>("Move Chat to Workspace", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
var workspaceId = dialogResult.Data is Guid id ? id : default; var workspaceId = dialogResult.Data is Guid id ? id : default;

View File

@ -1,5 +1,3 @@
using AIStudio.Provider;
namespace AIStudio.Components.Pages.IconFinder; namespace AIStudio.Components.Pages.IconFinder;
public partial class AssistantIconFinder : AssistantBaseCore public partial class AssistantIconFinder : AssistantBaseCore

View File

@ -31,10 +31,10 @@ public partial class Settings : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>("Add Provider", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>("Add Provider", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
var addedProvider = (AIStudio.Settings.Provider)dialogResult.Data; var addedProvider = (AIStudio.Settings.Provider)dialogResult.Data!;
addedProvider = addedProvider with { Num = this.SettingsManager.ConfigurationData.NextProviderNum++ }; addedProvider = addedProvider with { Num = this.SettingsManager.ConfigurationData.NextProviderNum++ };
this.SettingsManager.ConfigurationData.Providers.Add(addedProvider); this.SettingsManager.ConfigurationData.Providers.Add(addedProvider);
@ -58,10 +58,10 @@ public partial class Settings : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>("Edit Provider", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>("Edit Provider", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
var editedProvider = (AIStudio.Settings.Provider)dialogResult.Data; var editedProvider = (AIStudio.Settings.Provider)dialogResult.Data!;
// Set the provider number if it's not set. This is important for providers // Set the provider number if it's not set. This is important for providers
// added before we started saving the provider number. // added before we started saving the provider number.
@ -81,7 +81,7 @@ public partial class Settings : ComponentBase
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Provider", dialogParameters, DialogOptions.FULLSCREEN); var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Provider", dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result; var dialogResult = await dialogReference.Result;
if (dialogResult.Canceled) if (dialogResult is null || dialogResult.Canceled)
return; return;
var providerInstance = provider.CreateProvider(); var providerInstance = provider.CreateProvider();

View File

@ -1,4 +1,3 @@
using AIStudio.Provider;
using AIStudio.Tools; using AIStudio.Tools;
namespace AIStudio.Components.Pages.TextSummarizer; namespace AIStudio.Components.Pages.TextSummarizer;

View File

@ -1,4 +1,3 @@
using AIStudio.Provider;
using AIStudio.Tools; using AIStudio.Tools;
namespace AIStudio.Components.Pages.Translator; namespace AIStudio.Components.Pages.Translator;

View File

@ -7,4 +7,5 @@
<MudThemeProvider /> <MudThemeProvider />
<MudDialogProvider /> <MudDialogProvider />
<MudPopoverProvider />
<MudSnackbarProvider /> <MudSnackbarProvider />

View File

@ -79,10 +79,10 @@
{ {
<MudPaper Class="pa-2 mt-3"> <MudPaper Class="pa-2 mt-3">
<MudText Typo="Typo.h6">Issues</MudText> <MudText Typo="Typo.h6">Issues</MudText>
<MudList Clickable="@true"> <MudList T="string">
@foreach (var issue in this.dataIssues) @foreach (var issue in this.dataIssues)
{ {
<MudListItem Icon="@Icons.Material.Filled.Error" IconColor="Color.Error"> <MudListItem T="string" Icon="@Icons.Material.Filled.Error" IconColor="Color.Error">
@issue @issue
</MudListItem> </MudListItem>
} }