Refactor ConfigInfoRow to use ConfigInfoRowItem.

This commit is contained in:
Thorsten Sommer 2026-02-19 20:42:54 +01:00
parent adfc70a0ea
commit 6685fb8e1d
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
6 changed files with 34 additions and 45 deletions

View File

@ -1,10 +1,10 @@
<div style="display: flex; align-items: center; gap: 8px; @this.Style"> <div style="display: flex; align-items: center; gap: 8px; @this.Item.Style">
<MudIcon Icon="@this.Icon"/> <MudIcon Icon="@this.Item.Icon"/>
<span> <span>
@this.Text @this.Item.Text
</span> </span>
@if (!string.IsNullOrWhiteSpace(this.CopyValue)) @if (!string.IsNullOrWhiteSpace(this.Item.CopyValue))
{ {
<MudCopyClipboardButton TooltipMessage="@this.CopyTooltip" StringContent="@this.CopyValue"/> <MudCopyClipboardButton TooltipMessage="@this.Item.CopyTooltip" StringContent="@this.Item.CopyValue"/>
} }
</div> </div>

View File

@ -5,17 +5,5 @@ namespace AIStudio.Components;
public partial class ConfigInfoRow : ComponentBase public partial class ConfigInfoRow : ComponentBase
{ {
[Parameter] [Parameter]
public string Icon { get; set; } = Icons.Material.Filled.ArrowRightAlt; public ConfigInfoRowItem Item { get; set; } = new(Icons.Material.Filled.ArrowRightAlt, string.Empty, string.Empty, string.Empty, string.Empty);
[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;
} }

View File

@ -0,0 +1,9 @@
namespace AIStudio.Components;
public sealed record ConfigInfoRowItem(
string Icon,
string Text,
string CopyValue,
string CopyTooltip,
string Style = ""
);

View File

@ -8,11 +8,7 @@
@foreach (var item in this.Items) @foreach (var item in this.Items)
{ {
<ConfigInfoRow Icon="@item.Icon" <ConfigInfoRow Item="@item"/>
Text="@item.Text"
CopyValue="@item.CopyValue"
CopyTooltip="@item.CopyTooltip"
Style="@(item.Style)"/>
} }
@if (this.ShowWarning) @if (this.ShowWarning)

View File

@ -22,11 +22,3 @@ public partial class ConfigPluginInfoCard : ComponentBase
[Parameter] [Parameter]
public string Class { get; set; } = "pa-3 mt-2 mb-2"; 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 = ""
);

View File

@ -66,14 +66,14 @@
{ {
<ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.Extension" <ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.Extension"
HeaderText="@plug.Name" HeaderText="@plug.Name"
Items="@(new[] Items="@([
{
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt, new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
$"{T("Configuration plugin ID:")} {plug.Id}", $"{T("Configuration plugin ID:")} {plug.Id}",
plug.Id.ToString(), plug.Id.ToString(),
T("Copies the configuration plugin ID to the clipboard")) T("Copies the configuration plugin ID to the clipboard"))
})"/> ])"/>
} }
<EncryptionSecretInfo IsConfigured="@(PluginFactory.EnterpriseEncryption?.IsAvailable is true)" <EncryptionSecretInfo IsConfigured="@(PluginFactory.EnterpriseEncryption?.IsAvailable is true)"
ConfiguredText="@T("Encryption secret: is configured")" ConfiguredText="@T("Encryption secret: is configured")"
NotConfiguredText="@T("Encryption secret: is not configured")"/> NotConfiguredText="@T("Encryption secret: is not configured")"/>
@ -89,19 +89,20 @@
{ {
<ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.HourglassBottom" <ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.HourglassBottom"
HeaderText="@T("Waiting for the configuration plugin...")" HeaderText="@T("Waiting for the configuration plugin...")"
Items="@(new[] Items="@([
{
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt, new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
$"{T("Enterprise configuration ID:")} {env.ConfigurationId}", $"{T("Enterprise configuration ID:")} {env.ConfigurationId}",
env.ConfigurationId.ToString(), env.ConfigurationId.ToString(),
T("Copies the config ID to the clipboard")), T("Copies the config ID to the clipboard")),
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt, new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
$"{T("Configuration server:")} {env.ConfigurationServerUrl}", $"{T("Configuration server:")} {env.ConfigurationServerUrl}",
env.ConfigurationServerUrl, env.ConfigurationServerUrl,
T("Copies the server URL to the clipboard"), T("Copies the server URL to the clipboard"),
"margin-top: 4px;") "margin-top: 4px;")
})"/> ])"/>
} }
<EncryptionSecretInfo IsConfigured="@(PluginFactory.EnterpriseEncryption?.IsAvailable is true)" <EncryptionSecretInfo IsConfigured="@(PluginFactory.EnterpriseEncryption?.IsAvailable is true)"
ConfiguredText="@T("Encryption secret: is configured")" ConfiguredText="@T("Encryption secret: is configured")"
NotConfiguredText="@T("Encryption secret: is not configured")"/> NotConfiguredText="@T("Encryption secret: is not configured")"/>
@ -129,42 +130,45 @@
{ {
<ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.HourglassBottom" <ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.HourglassBottom"
HeaderText="@T("Waiting for the configuration plugin...")" HeaderText="@T("Waiting for the configuration plugin...")"
Items="@(new[] Items="@([
{
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt, new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
$"{T("Enterprise configuration ID:")} {env.ConfigurationId}", $"{T("Enterprise configuration ID:")} {env.ConfigurationId}",
env.ConfigurationId.ToString(), env.ConfigurationId.ToString(),
T("Copies the config ID to the clipboard")), T("Copies the config ID to the clipboard")),
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt, new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
$"{T("Configuration server:")} {env.ConfigurationServerUrl}", $"{T("Configuration server:")} {env.ConfigurationServerUrl}",
env.ConfigurationServerUrl, env.ConfigurationServerUrl,
T("Copies the server URL to the clipboard"), T("Copies the server URL to the clipboard"),
"margin-top: 4px;") "margin-top: 4px;")
})"/> ])"/>
continue; continue;
} }
<ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.Extension" <ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.Extension"
HeaderText="@matchingPlugin.Name" HeaderText="@matchingPlugin.Name"
Items="@(new[] Items="@([
{
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt, new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
$"{T("Enterprise configuration ID:")} {env.ConfigurationId}", $"{T("Enterprise configuration ID:")} {env.ConfigurationId}",
env.ConfigurationId.ToString(), env.ConfigurationId.ToString(),
T("Copies the config ID to the clipboard")), T("Copies the config ID to the clipboard")),
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt, new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
$"{T("Configuration server:")} {env.ConfigurationServerUrl}", $"{T("Configuration server:")} {env.ConfigurationServerUrl}",
env.ConfigurationServerUrl, env.ConfigurationServerUrl,
T("Copies the server URL to the clipboard"), T("Copies the server URL to the clipboard"),
"margin-top: 4px;"), "margin-top: 4px;"),
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt, new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
$"{T("Configuration plugin ID:")} {matchingPlugin.Id}", $"{T("Configuration plugin ID:")} {matchingPlugin.Id}",
matchingPlugin.Id.ToString(), matchingPlugin.Id.ToString(),
T("Copies the configuration plugin ID to the clipboard"), T("Copies the configuration plugin ID to the clipboard"),
"margin-top: 4px;") "margin-top: 4px;")
})" ])"
ShowWarning="@this.IsManagedConfigurationIdMismatch(matchingPlugin, env.ConfigurationId)" ShowWarning="@this.IsManagedConfigurationIdMismatch(matchingPlugin, env.ConfigurationId)"
WarningText="@T("ID mismatch: the plugin ID differs from the enterprise configuration ID.")"/> WarningText="@T("ID mismatch: the plugin ID differs from the enterprise configuration ID.")"/>
} }
<EncryptionSecretInfo IsConfigured="@(PluginFactory.EnterpriseEncryption?.IsAvailable is true)" <EncryptionSecretInfo IsConfigured="@(PluginFactory.EnterpriseEncryption?.IsAvailable is true)"
ConfiguredText="@T("Encryption secret: is configured")" ConfiguredText="@T("Encryption secret: is configured")"
NotConfiguredText="@T("Encryption secret: is not configured")"/> NotConfiguredText="@T("Encryption secret: is not configured")"/>