Apply spellchecking to the instance name field

This commit is contained in:
Thorsten Sommer 2024-06-01 20:00:17 +02:00
parent f7d0cfa102
commit db3379b4eb
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@
AdornmentIcon="@Icons.Material.Filled.Lightbulb"
AdornmentColor="Color.Info"
Validation="@this.ValidatingInstanceName"
UserAttributes="@INSTANCE_NAME_ATTRIBUTES"
/>
@* ReSharper disable once CSharpWarnings::CS8974 *@

View File

@ -56,6 +56,8 @@ public partial class ProviderDialog : ComponentBase
[Inject]
private IJSRuntime JsRuntime { get; set; } = null!;
private static readonly Dictionary<string, object?> INSTANCE_NAME_ATTRIBUTES = new();
/// <summary>
/// The list of used instance names. We need this to check for uniqueness.
/// </summary>
@ -76,6 +78,9 @@ public partial class ProviderDialog : ComponentBase
protected override async Task OnInitializedAsync()
{
// Configure the spellchecking for the instance name input:
this.SettingsManager.InjectSpellchecking(INSTANCE_NAME_ATTRIBUTES);
// Load the used instance names:
this.UsedInstanceNames = this.SettingsManager.ConfigurationData.Providers.Select(x => x.InstanceName.ToLowerInvariant()).ToList();