mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-08-20 11:12:55 +00:00
Refactored about page to streamline environment usage and added plugin reload handling
This commit is contained in:
parent
eca0d33da3
commit
6a62a69a07
@ -1,4 +1,5 @@
|
||||
@attribute [Route(Routes.ABOUT)]
|
||||
@using AIStudio.Tools.Services
|
||||
@inherits MSGComponentBase
|
||||
|
||||
<div class="inner-scrolling-context">
|
||||
@ -24,7 +25,7 @@
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.Memory" Text="@TauriVersion"/>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.Translate" Text="@this.OSLanguage"/>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Outlined.Business">
|
||||
@switch (this.currentEnvironment.IsActive)
|
||||
@switch (EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.IsActive)
|
||||
{
|
||||
case false when this.configPlug is null:
|
||||
<MudText Typo="Typo.body1">
|
||||
@ -55,16 +56,16 @@
|
||||
<MudText Typo="Typo.body1" Class="mt-2 mb-2">
|
||||
<div style="display: flex; align-items: center; gap: 8px;">
|
||||
<MudIcon Icon="@Icons.Material.Filled.ArrowRightAlt"/>
|
||||
<span>@T("Enterprise configuration ID:") @this.currentEnvironment.ConfigurationId</span>
|
||||
<MudCopyClipboardButton TooltipMessage="@T("Copies the config ID to the clipboard")" StringContent=@this.currentEnvironment.ConfigurationId.ToString()/>
|
||||
<span>@T("Enterprise configuration ID:") @EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.ConfigurationId</span>
|
||||
<MudCopyClipboardButton TooltipMessage="@T("Copies the config ID to the clipboard")" StringContent=@EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.ConfigurationId.ToString()/>
|
||||
</div>
|
||||
</MudText>
|
||||
|
||||
<MudText Typo="Typo.body1" Class="mt-2 mb-2">
|
||||
<div style="display: flex; align-items: center; gap: 8px;">
|
||||
<MudIcon Icon="@Icons.Material.Filled.ArrowRightAlt"/>
|
||||
<span>@T("Configuration server:") @this.currentEnvironment.ConfigurationServerUrl</span>
|
||||
<MudCopyClipboardButton TooltipMessage="@T("Copies the server URL to the clipboard")" StringContent=@this.currentEnvironment.ConfigurationServerUrl/>
|
||||
<span>@T("Configuration server:") @EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.ConfigurationServerUrl</span>
|
||||
<MudCopyClipboardButton TooltipMessage="@T("Copies the server URL to the clipboard")" StringContent=@EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.ConfigurationServerUrl/>
|
||||
</div>
|
||||
</MudText>
|
||||
</MudCollapse>
|
||||
@ -78,16 +79,16 @@
|
||||
<MudText Typo="Typo.body1" Class="mt-2 mb-2 ml-4">
|
||||
<div style="display: flex; align-items: center; gap: 8px;">
|
||||
<MudIcon Icon="@Icons.Material.Filled.ArrowRightAlt"/>
|
||||
<span>@T("Enterprise configuration ID:") @this.currentEnvironment.ConfigurationId</span>
|
||||
<MudCopyClipboardButton TooltipMessage="@T("Copies the config ID to the clipboard")" StringContent=@this.currentEnvironment.ConfigurationId.ToString()/>
|
||||
<span>@T("Enterprise configuration ID:") @EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.ConfigurationId</span>
|
||||
<MudCopyClipboardButton TooltipMessage="@T("Copies the config ID to the clipboard")" StringContent=@EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.ConfigurationId.ToString()/>
|
||||
</div>
|
||||
</MudText>
|
||||
|
||||
<MudText Typo="Typo.body1" Class="mt-2 mb-2 ml-4">
|
||||
<div style="display: flex; align-items: center; gap: 8px;">
|
||||
<MudIcon Icon="@Icons.Material.Filled.ArrowRightAlt"/>
|
||||
<span>@T("Configuration server:") @this.currentEnvironment.ConfigurationServerUrl</span>
|
||||
<MudCopyClipboardButton TooltipMessage="@T("Copies the server URL to the clipboard")" StringContent=@this.currentEnvironment.ConfigurationServerUrl/>
|
||||
<span>@T("Configuration server:") @EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.ConfigurationServerUrl</span>
|
||||
<MudCopyClipboardButton TooltipMessage="@T("Copies the server URL to the clipboard")" StringContent=@EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.ConfigurationServerUrl/>
|
||||
</div>
|
||||
</MudText>
|
||||
|
||||
|
@ -58,12 +58,10 @@ public partial class About : MSGComponentBase
|
||||
|
||||
private GetLogPathsResponse logPaths;
|
||||
|
||||
private bool showEnterpriseConfigDetails = false;
|
||||
private bool showEnterpriseConfigDetails;
|
||||
|
||||
private IPluginMetadata? configPlug = PluginFactory.AvailablePlugins.FirstOrDefault(x => x.Type is PluginType.CONFIGURATION);
|
||||
|
||||
private EnterpriseEnvironment currentEnvironment = EnterpriseEnvironmentService.CURRENT_ENVIRONMENT;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the enterprise configuration has details that can be shown/hidden.
|
||||
/// Returns true if there are details available, false otherwise.
|
||||
@ -72,7 +70,7 @@ public partial class About : MSGComponentBase
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.currentEnvironment.IsActive switch
|
||||
return EnterpriseEnvironmentService.CURRENT_ENVIRONMENT.IsActive switch
|
||||
{
|
||||
// Case 1: No enterprise config and no plugin - no details available
|
||||
false when this.configPlug is null => false,
|
||||
@ -105,6 +103,23 @@ public partial class About : MSGComponentBase
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides of MSGComponentBase
|
||||
|
||||
protected override async Task ProcessIncomingMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data) where T : default
|
||||
{
|
||||
switch (triggeredEvent)
|
||||
{
|
||||
case Event.PLUGINS_RELOADED:
|
||||
this.configPlug = PluginFactory.AvailablePlugins.FirstOrDefault(x => x.Type is PluginType.CONFIGURATION);
|
||||
await this.InvokeAsync(this.StateHasChanged);
|
||||
break;
|
||||
}
|
||||
|
||||
await base.ProcessIncomingMessage(sendingComponent, triggeredEvent, data);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private async Task DeterminePandocVersion()
|
||||
{
|
||||
this.pandocInstallation = await Pandoc.CheckAvailabilityAsync(this.RustService, false);
|
||||
@ -153,10 +168,6 @@ public partial class About : MSGComponentBase
|
||||
|
||||
private void ToggleEnterpriseConfigDetails()
|
||||
{
|
||||
// can configPlug and currentEnvironment change?
|
||||
this.configPlug = PluginFactory.AvailablePlugins.FirstOrDefault(x => x.Type is PluginType.CONFIGURATION);
|
||||
this.currentEnvironment = EnterpriseEnvironmentService.CURRENT_ENVIRONMENT;
|
||||
|
||||
this.showEnterpriseConfigDetails = !this.showEnterpriseConfigDetails;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user