mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 18:59:47 +00:00
Added possibility to inform the entire system about changed settings
This commit is contained in:
parent
c12bfa5a25
commit
9d28d8379e
@ -1,4 +1,5 @@
|
|||||||
using AIStudio.Settings;
|
using AIStudio.Settings;
|
||||||
|
using AIStudio.Tools;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
@ -23,7 +24,12 @@ public partial class ConfigurationBase : ComponentBase
|
|||||||
public string OptionHelp { get; set; } = string.Empty;
|
public string OptionHelp { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Inject]
|
[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 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);
|
this.StateUpdate(updatedState);
|
||||||
await this.SettingsManager.StoreSettings();
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.InformAboutChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,6 +30,7 @@ public partial class ConfigurationSelect<T> : ConfigurationBase
|
|||||||
{
|
{
|
||||||
this.SelectionUpdate(updatedValue);
|
this.SelectionUpdate(updatedValue);
|
||||||
await this.SettingsManager.StoreSettings();
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.InformAboutChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetClass => $"{MARGIN_CLASS} rounded-lg";
|
private static string GetClass => $"{MARGIN_CLASS} rounded-lg";
|
||||||
|
@ -6,6 +6,7 @@ public enum Event
|
|||||||
|
|
||||||
// Common events:
|
// Common events:
|
||||||
STATE_HAS_CHANGED,
|
STATE_HAS_CHANGED,
|
||||||
|
CONFIGURATION_CHANGED,
|
||||||
|
|
||||||
// Update events:
|
// Update events:
|
||||||
USER_SEARCH_FOR_UPDATE,
|
USER_SEARCH_FOR_UPDATE,
|
||||||
|
Loading…
Reference in New Issue
Block a user