Conditionally render enterprise configuration details button in the about page

This commit is contained in:
Thorsten Sommer 2025-08-09 21:25:37 +02:00
parent 98e2796604
commit 2f47cc69a7
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 34 additions and 6 deletions

View File

@ -102,12 +102,15 @@
break;
}
<MudButton StartIcon="@(this.showConfigDetails ? Icons.Material.Filled.ExpandLess : Icons.Material.Filled.ExpandMore)"
Size="Size.Small"
Variant="Variant.Text"
OnClick="@this.ToggleEnterpriseConfigDetails">
@(this.showConfigDetails ? T("Hide Details") : T("Show Details"))
</MudButton>
@if (this.HasEnterpriseConfigurationDetails)
{
<MudButton StartIcon="@(this.showEnterpriseConfigDetails ? Icons.Material.Filled.ExpandLess : Icons.Material.Filled.ExpandMore)"
Size="Size.Small"
Variant="Variant.Text"
OnClick="@this.ToggleEnterpriseConfigDetails">
@(this.showEnterpriseConfigDetails ? T("Hide Details") : T("Show Details"))
</MudButton>
}
</MudListItem>
</MudList>
<MudStack Row="true">

View File

@ -63,6 +63,31 @@ public partial class About : MSGComponentBase
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.
/// </summary>
private bool HasEnterpriseConfigurationDetails
{
get
{
return this.currentEnvironment.IsActive switch
{
// Case 1: No enterprise config and no plugin - no details available
false when this.configPlug is null => false,
// Case 2: Enterprise config with plugin but no central management - has details
false => true,
// Case 3: Enterprise config active but no plugin - has details
true when this.configPlug is null => true,
// Case 4: Enterprise config active with plugin - has details
true => true
};
}
}
#region Overrides of ComponentBase