mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-05-20 02:12:14 +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">
|
<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>
|
||||||
@ -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;
|
|
||||||
}
|
}
|
||||||
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)
|
@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)
|
||||||
|
|||||||
@ -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 = ""
|
|
||||||
);
|
|
||||||
@ -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")"/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user