diff --git a/app/MindWork AI Studio/Pages/Information.razor b/app/MindWork AI Studio/Pages/Information.razor index a859a142..8875581c 100644 --- a/app/MindWork AI Studio/Pages/Information.razor +++ b/app/MindWork AI Studio/Pages/Information.razor @@ -85,7 +85,7 @@ @T("AI Studio runs with an enterprise configuration and configuration servers. The configuration plugins are not yet available.") - @foreach (var env in EnterpriseEnvironmentService.CURRENT_ENVIRONMENTS.Where(e => e.IsActive)) + @foreach (var env in this.enterpriseEnvironments.Where(e => e.IsActive)) { } - @foreach (var env in EnterpriseEnvironmentService.CURRENT_ENVIRONMENTS.Where(e => e.IsActive)) + @foreach (var env in this.enterpriseEnvironments.Where(e => e.IsActive)) { var matchingPlugin = this.FindManagedConfigurationPlugin(env.ConfigurationId); if (matchingPlugin is null) diff --git a/app/MindWork AI Studio/Pages/Information.razor.cs b/app/MindWork AI Studio/Pages/Information.razor.cs index 1f3d946e..9fd37802 100644 --- a/app/MindWork AI Studio/Pages/Information.razor.cs +++ b/app/MindWork AI Studio/Pages/Information.razor.cs @@ -75,14 +75,16 @@ public partial class Information : MSGComponentBase .Where(x => x.Type is PluginType.CONFIGURATION) .OfType() .ToList(); + + private List enterpriseEnvironments = EnterpriseEnvironmentService.CURRENT_ENVIRONMENTS.ToList(); private sealed record DatabaseDisplayInfo(string Label, string Value); private readonly List databaseDisplayInfo = new(); - private static bool HasAnyActiveEnvironment => EnterpriseEnvironmentService.CURRENT_ENVIRONMENTS.Any(e => e.IsActive); + private bool HasAnyActiveEnvironment => this.enterpriseEnvironments.Any(e => e.IsActive); - private bool HasAnyLoadedEnterpriseConfigurationPlugin => EnterpriseEnvironmentService.CURRENT_ENVIRONMENTS + private bool HasAnyLoadedEnterpriseConfigurationPlugin => this.enterpriseEnvironments .Where(e => e.IsActive) .Any(env => this.FindManagedConfigurationPlugin(env.ConfigurationId) is not null); @@ -94,7 +96,7 @@ public partial class Information : MSGComponentBase { get { - return HasAnyActiveEnvironment switch + return this.HasAnyActiveEnvironment switch { // Case 1: No enterprise config and no plugin - no details available false when this.configPlugins.Count == 0 => false, diff --git a/app/MindWork AI Studio/Tools/Services/EnterpriseEnvironmentService.cs b/app/MindWork AI Studio/Tools/Services/EnterpriseEnvironmentService.cs index 0d2f2aa1..708993d0 100644 --- a/app/MindWork AI Studio/Tools/Services/EnterpriseEnvironmentService.cs +++ b/app/MindWork AI Studio/Tools/Services/EnterpriseEnvironmentService.cs @@ -8,6 +8,8 @@ public sealed class EnterpriseEnvironmentService(ILogger BuildNormalizedSnapshot(IEnumerable environments) + { + return environments + .Where(environment => environment.IsActive) + .Select(environment => new EnterpriseEnvironmentSnapshot( + environment.ConfigurationId, + NormalizeServerUrl(environment.ConfigurationServerUrl), + environment.ETag?.ToString())) + .OrderBy(environment => environment.ConfigurationId) + .ToList(); + } + + private static string NormalizeServerUrl(string serverUrl) + { + return serverUrl.Trim().TrimEnd('/'); + } } \ No newline at end of file