mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-05-19 18:12:15 +00:00
Refactor ConfigInfoRow to use ConfigInfoRowItem.
This commit is contained in:
parent
adfc70a0ea
commit
6685fb8e1d
@ -1,10 +1,10 @@
|
||||
<div style="display: flex; align-items: center; gap: 8px; @this.Style">
|
||||
<MudIcon Icon="@this.Icon"/>
|
||||
<div style="display: flex; align-items: center; gap: 8px; @this.Item.Style">
|
||||
<MudIcon Icon="@this.Item.Icon"/>
|
||||
<span>
|
||||
@this.Text
|
||||
@this.Item.Text
|
||||
</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>
|
||||
|
||||
@ -5,17 +5,5 @@ 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;
|
||||
public ConfigInfoRowItem Item { get; set; } = new(Icons.Material.Filled.ArrowRightAlt, string.Empty, string.Empty, string.Empty, string.Empty);
|
||||
}
|
||||
9
app/MindWork AI Studio/Components/ConfigInfoRowItem.cs
Normal file
9
app/MindWork AI Studio/Components/ConfigInfoRowItem.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace AIStudio.Components;
|
||||
|
||||
public sealed record ConfigInfoRowItem(
|
||||
string Icon,
|
||||
string Text,
|
||||
string CopyValue,
|
||||
string CopyTooltip,
|
||||
string Style = ""
|
||||
);
|
||||
@ -8,11 +8,7 @@
|
||||
|
||||
@foreach (var item in this.Items)
|
||||
{
|
||||
<ConfigInfoRow Icon="@item.Icon"
|
||||
Text="@item.Text"
|
||||
CopyValue="@item.CopyValue"
|
||||
CopyTooltip="@item.CopyTooltip"
|
||||
Style="@(item.Style)"/>
|
||||
<ConfigInfoRow Item="@item"/>
|
||||
}
|
||||
|
||||
@if (this.ShowWarning)
|
||||
@ -22,4 +18,4 @@
|
||||
<MudText Typo="Typo.subtitle2">@this.WarningText</MudText>
|
||||
</div>
|
||||
}
|
||||
</MudPaper>
|
||||
</MudPaper>
|
||||
|
||||
@ -22,11 +22,3 @@ public partial class ConfigPluginInfoCard : ComponentBase
|
||||
[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 = ""
|
||||
);
|
||||
@ -66,14 +66,14 @@
|
||||
{
|
||||
<ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.Extension"
|
||||
HeaderText="@plug.Name"
|
||||
Items="@(new[]
|
||||
{
|
||||
Items="@([
|
||||
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
|
||||
$"{T("Configuration plugin ID:")} {plug.Id}",
|
||||
plug.Id.ToString(),
|
||||
T("Copies the configuration plugin ID to the clipboard"))
|
||||
})"/>
|
||||
])"/>
|
||||
}
|
||||
|
||||
<EncryptionSecretInfo IsConfigured="@(PluginFactory.EnterpriseEncryption?.IsAvailable is true)"
|
||||
ConfiguredText="@T("Encryption secret: is configured")"
|
||||
NotConfiguredText="@T("Encryption secret: is not configured")"/>
|
||||
@ -89,19 +89,20 @@
|
||||
{
|
||||
<ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.HourglassBottom"
|
||||
HeaderText="@T("Waiting for the configuration plugin...")"
|
||||
Items="@(new[]
|
||||
{
|
||||
Items="@([
|
||||
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
|
||||
$"{T("Enterprise configuration ID:")} {env.ConfigurationId}",
|
||||
env.ConfigurationId.ToString(),
|
||||
T("Copies the config ID to the clipboard")),
|
||||
|
||||
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
|
||||
$"{T("Configuration server:")} {env.ConfigurationServerUrl}",
|
||||
env.ConfigurationServerUrl,
|
||||
T("Copies the server URL to the clipboard"),
|
||||
"margin-top: 4px;")
|
||||
})"/>
|
||||
])"/>
|
||||
}
|
||||
|
||||
<EncryptionSecretInfo IsConfigured="@(PluginFactory.EnterpriseEncryption?.IsAvailable is true)"
|
||||
ConfiguredText="@T("Encryption secret: is configured")"
|
||||
NotConfiguredText="@T("Encryption secret: is not configured")"/>
|
||||
@ -129,42 +130,45 @@
|
||||
{
|
||||
<ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.HourglassBottom"
|
||||
HeaderText="@T("Waiting for the configuration plugin...")"
|
||||
Items="@(new[]
|
||||
{
|
||||
Items="@([
|
||||
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
|
||||
$"{T("Enterprise configuration ID:")} {env.ConfigurationId}",
|
||||
env.ConfigurationId.ToString(),
|
||||
T("Copies the config ID to the clipboard")),
|
||||
|
||||
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
|
||||
$"{T("Configuration server:")} {env.ConfigurationServerUrl}",
|
||||
env.ConfigurationServerUrl,
|
||||
T("Copies the server URL to the clipboard"),
|
||||
"margin-top: 4px;")
|
||||
})"/>
|
||||
])"/>
|
||||
continue;
|
||||
}
|
||||
|
||||
<ConfigPluginInfoCard HeaderIcon="@Icons.Material.Filled.Extension"
|
||||
HeaderText="@matchingPlugin.Name"
|
||||
Items="@(new[]
|
||||
{
|
||||
Items="@([
|
||||
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
|
||||
$"{T("Enterprise configuration ID:")} {env.ConfigurationId}",
|
||||
env.ConfigurationId.ToString(),
|
||||
T("Copies the config ID to the clipboard")),
|
||||
|
||||
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
|
||||
$"{T("Configuration server:")} {env.ConfigurationServerUrl}",
|
||||
env.ConfigurationServerUrl,
|
||||
T("Copies the server URL to the clipboard"),
|
||||
"margin-top: 4px;"),
|
||||
|
||||
new ConfigInfoRowItem(Icons.Material.Filled.ArrowRightAlt,
|
||||
$"{T("Configuration plugin ID:")} {matchingPlugin.Id}",
|
||||
matchingPlugin.Id.ToString(),
|
||||
T("Copies the configuration plugin ID to the clipboard"),
|
||||
"margin-top: 4px;")
|
||||
})"
|
||||
])"
|
||||
ShowWarning="@this.IsManagedConfigurationIdMismatch(matchingPlugin, env.ConfigurationId)"
|
||||
WarningText="@T("ID mismatch: the plugin ID differs from the enterprise configuration ID.")"/>
|
||||
}
|
||||
|
||||
<EncryptionSecretInfo IsConfigured="@(PluginFactory.EnterpriseEncryption?.IsAvailable is true)"
|
||||
ConfiguredText="@T("Encryption secret: is configured")"
|
||||
NotConfiguredText="@T("Encryption secret: is not configured")"/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user