Add info page auto reload when config changes

This commit is contained in:
Thorsten Sommer 2026-03-23 13:33:59 +01:00
parent 5445c73b38
commit 3b63ed48d0
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 19 additions and 4 deletions

View File

@ -117,7 +117,10 @@ public partial class Information : MSGComponentBase
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
this.ApplyFilters([], [ Event.ENTERPRISE_ENVIRONMENTS_CHANGED ]);
await base.OnInitializedAsync(); await base.OnInitializedAsync();
this.RefreshEnterpriseConfigurationState();
this.osLanguage = await this.RustService.ReadUserLanguage(); this.osLanguage = await this.RustService.ReadUserLanguage();
this.logPaths = await this.RustService.GetLogPaths(); this.logPaths = await this.RustService.GetLogPaths();
@ -141,10 +144,8 @@ public partial class Information : MSGComponentBase
switch (triggeredEvent) switch (triggeredEvent)
{ {
case Event.PLUGINS_RELOADED: case Event.PLUGINS_RELOADED:
this.configPlugins = PluginFactory.AvailablePlugins case Event.ENTERPRISE_ENVIRONMENTS_CHANGED:
.Where(x => x.Type is PluginType.CONFIGURATION) this.RefreshEnterpriseConfigurationState();
.OfType<IAvailablePlugin>()
.ToList();
await this.InvokeAsync(this.StateHasChanged); await this.InvokeAsync(this.StateHasChanged);
break; break;
} }
@ -154,6 +155,16 @@ public partial class Information : MSGComponentBase
#endregion #endregion
private void RefreshEnterpriseConfigurationState()
{
this.configPlugins = PluginFactory.AvailablePlugins
.Where(x => x.Type is PluginType.CONFIGURATION)
.OfType<IAvailablePlugin>()
.ToList();
this.enterpriseEnvironments = EnterpriseEnvironmentService.CURRENT_ENVIRONMENTS.ToList();
}
private async Task DeterminePandocVersion() private async Task DeterminePandocVersion()
{ {
this.pandocInstallation = await Pandoc.CheckAvailabilityAsync(this.RustService, false); this.pandocInstallation = await Pandoc.CheckAvailabilityAsync(this.RustService, false);

View File

@ -11,6 +11,7 @@ public enum Event
STARTUP_PLUGIN_SYSTEM, STARTUP_PLUGIN_SYSTEM,
STARTUP_COMPLETED, STARTUP_COMPLETED,
STARTUP_ENTERPRISE_ENVIRONMENT, STARTUP_ENTERPRISE_ENVIRONMENT,
ENTERPRISE_ENVIRONMENTS_CHANGED,
PLUGINS_RELOADED, PLUGINS_RELOADED,
SHOW_ERROR, SHOW_ERROR,
SHOW_WARNING, SHOW_WARNING,

View File

@ -171,6 +171,9 @@ public sealed class EnterpriseEnvironmentService(ILogger<EnterpriseEnvironmentSe
var effectiveSnapshot = BuildNormalizedSnapshot(effectiveEnvironments); var effectiveSnapshot = BuildNormalizedSnapshot(effectiveEnvironments);
CURRENT_ENVIRONMENTS = effectiveEnvironments; CURRENT_ENVIRONMENTS = effectiveEnvironments;
HasValidEnterpriseSnapshot = true; HasValidEnterpriseSnapshot = true;
if (!previousSnapshot.SequenceEqual(effectiveSnapshot))
await MessageBus.INSTANCE.SendMessage<bool>(null, Event.ENTERPRISE_ENVIRONMENTS_CHANGED);
} }
catch (Exception e) catch (Exception e)
{ {