Added triggers for configurations

This commit is contained in:
Thorsten Sommer 2024-06-01 17:37:17 +02:00
parent 906a09442d
commit d09198d60b
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,7 @@
@inherits ConfigurationBase
<MudField Label="@this.OptionDescription" Variant="Variant.Outlined" HelperText="@this.OptionHelp" Class="@MARGIN_CLASS">
<MudButton Variant="Variant.Filled" StartIcon="@this.TriggerIcon" OnClick="@this.Click">
@this.TriggerText
</MudButton>
</MudField>

View File

@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Components;
namespace AIStudio.Components;
public partial class ConfigurationTrigger : ConfigurationBase
{
[Parameter]
public string TriggerText { get; set; } = string.Empty;
[Parameter]
public string TriggerIcon { get; set; } = Icons.Material.Filled.AddBox;
[Parameter]
public Action OnClickSync { get; set; } = () => { };
[Parameter]
public Func<Task> OnClickAsync { get; set; } = () => Task.CompletedTask;
private async Task Click()
{
this.OnClickSync();
await this.OnClickAsync();
}
}