@using AIStudio.Provider @using MudBlazor <MudDialog> <DialogContent> <MudForm @ref="@this.form" @bind-IsValid="@this.dataIsValid" @bind-Errors="@this.dataIssues"> <MudStack Row="@true" AlignItems="AlignItems.Center"> @* ReSharper disable once CSharpWarnings::CS8974 *@ <MudSelect @bind-Value="@this.DataProvider" Label="Provider" Class="mb-3" OpenIcon="@Icons.Material.Filled.AccountBalance" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.ValidatingProvider"> @foreach (Providers provider in Enum.GetValues(typeof(Providers))) { <MudSelectItem Value="@provider">@provider</MudSelectItem> } </MudSelect> <MudButton Disabled="@this.IsSelfHostedOrNone" Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@this.GetProviderCreationURL()" Target="_blank">Create account</MudButton> </MudStack> @* ReSharper disable once CSharpWarnings::CS8974 *@ <MudTextField T="string" @bind-Text="@this.dataAPIKey" Label="API Key" Disabled="@this.IsSelfHostedOrNone" Class="mb-3" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.VpnKey" AdornmentColor="Color.Info" InputType="InputType.Password" Validation="@this.ValidatingAPIKey" /> <MudTextField T="string" @bind-Text="@this.DataHostname" Label="Hostname" Disabled="@this.IsCloudProvider" Class="mb-3" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Dns" AdornmentColor="Color.Info" Validation="@this.ValidatingHostname" /> <MudStack Row="@true" AlignItems="AlignItems.Center"> <MudButton Disabled="@(!this.CanLoadModels)" Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.Refresh" OnClick="this.ReloadModels">Load</MudButton> <MudSelect Disabled="@this.IsSelfHostedOrNone" @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) { <MudSelectItem Value="@model">@model</MudSelectItem> } </MudSelect> </MudStack> @* ReSharper disable once CSharpWarnings::CS8974 *@ <MudTextField T="string" @bind-Text="@this.DataInstanceName" Label="Instance Name" Class="mb-3" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Lightbulb" AdornmentColor="Color.Info" Validation="@this.ValidatingInstanceName" UserAttributes="@INSTANCE_NAME_ATTRIBUTES" /> </MudForm> @if (this.dataIssues.Any()) { <MudPaper Class="pa-2 mt-3"> <MudText Typo="Typo.h6">Issues</MudText> <MudList Clickable="@true"> @foreach (var issue in this.dataIssues) { <MudListItem Icon="@Icons.Material.Filled.Error" IconColor="Color.Error"> @issue </MudListItem> } </MudList> </MudPaper> } </DialogContent> <DialogActions> <MudButton OnClick="@this.Cancel" Variant="Variant.Filled">Cancel</MudButton> <MudButton OnClick="@this.Store" Variant="Variant.Filled" Color="Color.Primary"> @if(this.IsEditing) { @:Update } else { @:Add } </MudButton> </DialogActions> </MudDialog>