mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 06:13:48 +00:00
Introduced additive configuration handling for managed preview features (#667)
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
ed8bd9d25c
commit
6f76c845f1
10 files changed
+260
-40
No files matched your search
@@ -28,14 +28,14 @@ public record ConfigMeta<TClass, TValue> : ConfigMetaBase
|
||||
private Expression<Func<TClass, TValue>> PropertyExpression { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the configuration is managed by a plugin and is therefore locked.
|
||||
/// Indicates whether the configuration is locked by a configuration plugin.
|
||||
/// </summary>
|
||||
public bool IsLocked { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the plugin that manages this configuration. This is set when the configuration is locked.
|
||||
/// The ID of the plugin that locked this configuration.
|
||||
/// </summary>
|
||||
public Guid MangedByConfigPluginId { get; private set; }
|
||||
public Guid LockedByConfigPluginId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The default value for the configuration property. This is used when resetting the property to its default state.
|
||||
@@ -43,30 +43,74 @@ public record ConfigMeta<TClass, TValue> : ConfigMetaBase
|
||||
public required TValue Default { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Locks the configuration state, indicating that it is managed by a specific plugin.
|
||||
/// Indicates whether a plugin contribution is available.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">The ID of the plugin that is managing this configuration.</param>
|
||||
public void LockManagedState(Guid pluginId)
|
||||
public bool HasPluginContribution { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The additive value contribution provided by a configuration plugin.
|
||||
/// </summary>
|
||||
public TValue PluginContribution { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the plugin that provided the additive value contribution.
|
||||
/// </summary>
|
||||
public Guid PluginContributionByConfigPluginId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Locks the configuration state, indicating that it is controlled by a specific plugin.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">The ID of the plugin that is locking this configuration.</param>
|
||||
public void LockConfiguration(Guid pluginId)
|
||||
{
|
||||
this.IsLocked = true;
|
||||
this.MangedByConfigPluginId = pluginId;
|
||||
this.LockedByConfigPluginId = pluginId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the managed state of the configuration, allowing it to be modified again.
|
||||
/// Resets the locked state of the configuration, allowing it to be modified again.
|
||||
/// This will also reset the property to its default value.
|
||||
/// </summary>
|
||||
public void ResetManagedState()
|
||||
public void ResetLockedConfiguration()
|
||||
{
|
||||
this.IsLocked = false;
|
||||
this.MangedByConfigPluginId = Guid.Empty;
|
||||
this.LockedByConfigPluginId = Guid.Empty;
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks the configuration state without changing the current value.
|
||||
/// </summary>
|
||||
public void UnlockConfiguration()
|
||||
{
|
||||
this.IsLocked = false;
|
||||
this.LockedByConfigPluginId = Guid.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores an additive plugin contribution.
|
||||
/// </summary>
|
||||
public void SetPluginContribution(TValue value, Guid pluginId)
|
||||
{
|
||||
this.PluginContribution = value;
|
||||
this.PluginContributionByConfigPluginId = pluginId;
|
||||
this.HasPluginContribution = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the additive plugin contribution without changing the current value.
|
||||
/// </summary>
|
||||
public void ClearPluginContribution()
|
||||
{
|
||||
this.PluginContribution = default!;
|
||||
this.PluginContributionByConfigPluginId = Guid.Empty;
|
||||
this.HasPluginContribution = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the configuration property to its default value.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
private void Reset()
|
||||
{
|
||||
var configInstance = this.ConfigSelection.Compile().Invoke(SETTINGS_MANAGER.ConfigurationData);
|
||||
var memberExpression = this.PropertyExpression.GetMemberExpression();
|
||||
|
||||
Reference in new issue
Block a user