From adfc70a0ead281579834c16fbf7375a17f6fa1bd Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 19 Feb 2026 20:30:24 +0100 Subject: [PATCH] Ensure DRY on the info page --- .../Components/ConfigInfoRow.razor | 10 + .../Components/ConfigInfoRow.razor.cs | 21 ++ .../Components/ConfigPluginInfoCard.razor | 25 +++ .../Components/ConfigPluginInfoCard.razor.cs | 32 +++ .../Components/EncryptionSecretInfo.razor | 15 ++ .../Components/EncryptionSecretInfo.razor.cs | 18 ++ .../Pages/Information.razor | 183 +++++++----------- 7 files changed, 188 insertions(+), 116 deletions(-) create mode 100644 app/MindWork AI Studio/Components/ConfigInfoRow.razor create mode 100644 app/MindWork AI Studio/Components/ConfigInfoRow.razor.cs create mode 100644 app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor create mode 100644 app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor.cs create mode 100644 app/MindWork AI Studio/Components/EncryptionSecretInfo.razor create mode 100644 app/MindWork AI Studio/Components/EncryptionSecretInfo.razor.cs diff --git a/app/MindWork AI Studio/Components/ConfigInfoRow.razor b/app/MindWork AI Studio/Components/ConfigInfoRow.razor new file mode 100644 index 00000000..349d407f --- /dev/null +++ b/app/MindWork AI Studio/Components/ConfigInfoRow.razor @@ -0,0 +1,10 @@ +
+ + + @this.Text + + @if (!string.IsNullOrWhiteSpace(this.CopyValue)) + { + + } +
\ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ConfigInfoRow.razor.cs b/app/MindWork AI Studio/Components/ConfigInfoRow.razor.cs new file mode 100644 index 00000000..3c702dd6 --- /dev/null +++ b/app/MindWork AI Studio/Components/ConfigInfoRow.razor.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Components; + +namespace AIStudio.Components; + +public partial class ConfigInfoRow : ComponentBase +{ + [Parameter] + public string Icon { get; set; } = Icons.Material.Filled.ArrowRightAlt; + + [Parameter] + public string Text { get; set; } = string.Empty; + + [Parameter] + public string CopyValue { get; set; } = string.Empty; + + [Parameter] + public string CopyTooltip { get; set; } = string.Empty; + + [Parameter] + public string Style { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor b/app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor new file mode 100644 index 00000000..c672b66a --- /dev/null +++ b/app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor @@ -0,0 +1,25 @@ + +
+ + + @this.HeaderText + +
+ + @foreach (var item in this.Items) + { + + } + + @if (this.ShowWarning) + { +
+ + @this.WarningText +
+ } +
\ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor.cs b/app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor.cs new file mode 100644 index 00000000..974c98f4 --- /dev/null +++ b/app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Components; + +namespace AIStudio.Components; + +public partial class ConfigPluginInfoCard : ComponentBase +{ + [Parameter] + public string HeaderIcon { get; set; } = Icons.Material.Filled.Extension; + + [Parameter] + public string HeaderText { get; set; } = string.Empty; + + [Parameter] + public IEnumerable Items { get; set; } = []; + + [Parameter] + public bool ShowWarning { get; set; } + + [Parameter] + public string WarningText { get; set; } = string.Empty; + + [Parameter] + public string Class { get; set; } = "pa-3 mt-2 mb-2"; +} + +public sealed record ConfigInfoRowItem( + string Icon, + string Text, + string CopyValue = "", + string CopyTooltip = "", + string Style = "" +); \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/EncryptionSecretInfo.razor b/app/MindWork AI Studio/Components/EncryptionSecretInfo.razor new file mode 100644 index 00000000..e05f9539 --- /dev/null +++ b/app/MindWork AI Studio/Components/EncryptionSecretInfo.razor @@ -0,0 +1,15 @@ + +
+ + @if (this.IsConfigured) + { + + @this.ConfiguredText + } + else + { + + @this.NotConfiguredText + } +
+
\ No newline at end of file diff --git a/app/MindWork AI Studio/Components/EncryptionSecretInfo.razor.cs b/app/MindWork AI Studio/Components/EncryptionSecretInfo.razor.cs new file mode 100644 index 00000000..5fa1a5dd --- /dev/null +++ b/app/MindWork AI Studio/Components/EncryptionSecretInfo.razor.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.Components; + +namespace AIStudio.Components; + +public partial class EncryptionSecretInfo : ComponentBase +{ + [Parameter] + public bool IsConfigured { get; set; } + + [Parameter] + public string ConfiguredText { get; set; } = string.Empty; + + [Parameter] + public string NotConfiguredText { get; set; } = string.Empty; + + [Parameter] + public string Class { get; set; } = "mt-2 mb-2"; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Pages/Information.razor b/app/MindWork AI Studio/Pages/Information.razor index 7e24d94b..e2848589 100644 --- a/app/MindWork AI Studio/Pages/Information.razor +++ b/app/MindWork AI Studio/Pages/Information.razor @@ -64,33 +64,19 @@ @foreach (var plug in this.configPlugins) { - -
- - @plug.Name -
-
- - @T("Configuration plugin ID:") @plug.Id - -
-
+ } - -
- - @if (PluginFactory.EnterpriseEncryption?.IsAvailable is true) - { - - @T("Encryption secret: is configured") - } - else - { - - @T("Encryption secret: is not configured") - } -
-
+
break; @@ -101,38 +87,24 @@ @foreach (var env in EnterpriseEnvironmentService.CURRENT_ENVIRONMENTS.Where(e => e.IsActive)) { - -
- - @T("Waiting for the configuration plugin...") -
-
- - @T("Enterprise configuration ID:") @env.ConfigurationId - -
-
- - @T("Configuration server:") @env.ConfigurationServerUrl - -
-
+ } - -
- - @if (PluginFactory.EnterpriseEncryption?.IsAvailable is true) - { - - @T("Encryption secret: is configured") - } - else - { - - @T("Encryption secret: is not configured") - } -
-
+
break; @@ -155,68 +127,47 @@ var matchingPlugin = this.FindManagedConfigurationPlugin(env.ConfigurationId); if (matchingPlugin is null) { - -
- - @T("Waiting for the configuration plugin...") -
-
- - @T("Enterprise configuration ID:") @env.ConfigurationId - -
-
- - @T("Configuration server:") @env.ConfigurationServerUrl - -
-
+ continue; } - -
- - @matchingPlugin.Name -
-
- - @T("Enterprise configuration ID:") @env.ConfigurationId - -
-
- - @T("Configuration server:") @env.ConfigurationServerUrl - -
-
- - @T("Configuration plugin ID:") @matchingPlugin.Id - -
- @if (this.IsManagedConfigurationIdMismatch(matchingPlugin, env.ConfigurationId)) - { -
- - @T("ID mismatch: the plugin ID differs from the enterprise configuration ID.") -
- } -
+ } - -
- - @if (PluginFactory.EnterpriseEncryption?.IsAvailable is true) - { - - @T("Encryption secret: is configured") - } - else - { - - @T("Encryption secret: is not configured") - } -
-
+ break; }