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

View File

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

View File

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