mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 23:18:00 +00:00
Added possibility to inform the entire system about changed settings
This commit is contained in:
4 files changed
+10
-1
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using AIStudio.Settings;
|
||||
using AIStudio.Tools;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
@@ -23,7 +24,12 @@ public partial class ConfigurationBase : ComponentBase
|
||||
public string OptionHelp { get; set; } = string.Empty;
|
||||
|
||||
[Inject]
|
||||
public SettingsManager SettingsManager { get; init; } = null!;
|
||||
protected SettingsManager SettingsManager { get; init; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageBus MessageBus { get; init; } = null!;
|
||||
|
||||
protected const string MARGIN_CLASS = "mb-6";
|
||||
|
||||
protected async Task InformAboutChange() => await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||
}
|
||||
@@ -35,5 +35,6 @@ public partial class ConfigurationOption : ConfigurationBase
|
||||
{
|
||||
this.StateUpdate(updatedState);
|
||||
await this.SettingsManager.StoreSettings();
|
||||
await this.InformAboutChange();
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ public partial class ConfigurationSelect<T> : ConfigurationBase
|
||||
{
|
||||
this.SelectionUpdate(updatedValue);
|
||||
await this.SettingsManager.StoreSettings();
|
||||
await this.InformAboutChange();
|
||||
}
|
||||
|
||||
private static string GetClass => $"{MARGIN_CLASS} rounded-lg";
|
||||
|
||||
@@ -6,6 +6,7 @@ public enum Event
|
||||
|
||||
// Common events:
|
||||
STATE_HAS_CHANGED,
|
||||
CONFIGURATION_CHANGED,
|
||||
|
||||
// Update events:
|
||||
USER_SEARCH_FOR_UPDATE,
|
||||
|
||||
Reference in new issue
Block a user