Auto-enable button to reload models, when necessary data was provided

This commit is contained in:
Thorsten Sommer 2024-05-19 19:42:15 +02:00
parent 25853bab86
commit b485da7aa9
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 3 additions and 1 deletions

View File

@ -38,7 +38,7 @@
/>
<MudStack Row="@true" AlignItems="AlignItems.Center">
<MudButton Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.Refresh" OnClick="this.ReloadModels">Reload</MudButton>
<MudButton Disabled="@(!this.CanLoadModels)" Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.Refresh" OnClick="this.ReloadModels">Reload</MudButton>
<MudSelect @bind-Value="@this.DataModel" Label="Model" Class="mb-3" OpenIcon="@Icons.Material.Filled.FaceRetouchingNatural" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.ValidatingModel">
@foreach (var model in this.availableModels)
{

View File

@ -208,6 +208,8 @@ public partial class ProviderDialog : ComponentBase
private void Cancel() => this.MudDialog.Cancel();
private bool CanLoadModels => !string.IsNullOrWhiteSpace(this.dataAPIKey) && this.DataProvider != Providers.NONE && !string.IsNullOrWhiteSpace(this.DataInstanceName);
private async Task ReloadModels()
{
var provider = this.DataProvider.CreateProvider(this.DataInstanceName);