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