Skip to content
Merged
10 changes: 10 additions & 0 deletions app/MindWork AI Studio/Components/ConfigInfoRow.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div style="display: flex; align-items: center; gap: 8px; @this.Item.Style">
<MudIcon Icon="@this.Item.Icon"/>
<span>
@this.Item.Text
</span>
@if (!string.IsNullOrWhiteSpace(this.Item.CopyValue))
{
<MudCopyClipboardButton TooltipMessage="@this.Item.CopyTooltip" StringContent="@this.Item.CopyValue"/>
}
</div>
9 changes: 9 additions & 0 deletions app/MindWork AI Studio/Components/ConfigInfoRow.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Microsoft.AspNetCore.Components;

namespace AIStudio.Components;

public partial class ConfigInfoRow : ComponentBase
{
[Parameter]
public ConfigInfoRowItem Item { get; set; } = new(Icons.Material.Filled.ArrowRightAlt, string.Empty, string.Empty, string.Empty, string.Empty);
}
9 changes: 9 additions & 0 deletions app/MindWork AI Studio/Components/ConfigInfoRowItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace AIStudio.Components;

public sealed record ConfigInfoRowItem(
string Icon,
string Text,
string CopyValue,
string CopyTooltip,
string Style = ""
);
21 changes: 21 additions & 0 deletions app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<MudPaper Outlined="true" Class="@this.Class">
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
<MudIcon Icon="@this.HeaderIcon" Size="Size.Small"/>
<MudText Typo="Typo.subtitle2">
@this.HeaderText
</MudText>
</div>

@foreach (var item in this.Items)
{
<ConfigInfoRow Item="@item"/>
}

@if (this.ShowWarning)
{
<div style="display: flex; align-items: center; gap: 8px; margin-top: 4px;">
<MudIcon Icon="@Icons.Material.Filled.Warning" Size="Size.Small" Color="Color.Warning"/>
<MudText Typo="Typo.subtitle2">@this.WarningText</MudText>
</div>
}
</MudPaper>
24 changes: 24 additions & 0 deletions app/MindWork AI Studio/Components/ConfigPluginInfoCard.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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<ConfigInfoRowItem> 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";
}
15 changes: 15 additions & 0 deletions app/MindWork AI Studio/Components/EncryptionSecretInfo.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<MudText Typo="Typo.body1" Class="@this.Class">
<div style="display: flex; align-items: center; gap: 8px;">
<MudIcon Icon="@Icons.Material.Filled.ArrowRightAlt"/>
@if (this.IsConfigured)
{
<MudIcon Icon="@Icons.Material.Filled.CheckCircle" Color="Color.Success" Size="Size.Small"/>
<span>@this.ConfiguredText</span>
}
else
{
<MudIcon Icon="@Icons.Material.Filled.Cancel" Color="Color.Error" Size="Size.Small"/>
<span>@this.NotConfiguredText</span>
}
</div>
</MudText>
18 changes: 18 additions & 0 deletions app/MindWork AI Studio/Components/EncryptionSecretInfo.razor.cs
Original file line number Diff line number Diff line change
@@ -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";
}
22 changes: 21 additions & 1 deletion app/MindWork AI Studio/Layout/MainLayout.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,28 @@ await this.InvokeAsync(async () =>
.CheckDeferredMessages<EnterpriseEnvironment>(Event.STARTUP_ENTERPRISE_ENVIRONMENT)
.Where(env => env != default)
.ToList();

var failedDeferredConfigIds = new HashSet<Guid>();
foreach (var env in enterpriseEnvironments)
await PluginFactory.TryDownloadingConfigPluginAsync(env.ConfigurationId, env.ConfigurationServerUrl);
{
var wasDownloadSuccessful = await PluginFactory.TryDownloadingConfigPluginAsync(env.ConfigurationId, env.ConfigurationServerUrl);
if (!wasDownloadSuccessful)
{
failedDeferredConfigIds.Add(env.ConfigurationId);
this.Logger.LogWarning("Failed to download deferred enterprise configuration '{ConfigId}' during startup. Keeping managed plugins unchanged.", env.ConfigurationId);
}
}

if (EnterpriseEnvironmentService.HasValidEnterpriseSnapshot)
{
var activeConfigIds = EnterpriseEnvironmentService.CURRENT_ENVIRONMENTS
.Select(env => env.ConfigurationId)
.ToHashSet();

PluginFactory.RemoveUnreferencedManagedConfigurationPlugins(activeConfigIds);
if (failedDeferredConfigIds.Count > 0)
this.Logger.LogWarning("Deferred startup updates failed for {FailedCount} enterprise configuration(s). Those configurations were kept unchanged.", failedDeferredConfigIds.Count);
}

// Initialize the enterprise encryption service for decrypting API keys:
await PluginFactory.InitializeEnterpriseEncryption(this.RustService);
Expand Down
Loading