mirror of
https://github.com/alexhopeoconnor/dnsmasq-webui.git
synced 2026-10-22 13:57:50 +10:00
Cross-option validation: field keys, bogus-priv zones, edit UX
- Add FieldKeyForOption() using EffectiveConfigSections.GetSectionId so cross-option issues match UI field keys; tighten RFC1918 in-addr.arpa detection for bogus-priv vs server=. - GetMulti: pending change always wins; empty list when NewValue is not a string list (with tests). - EffectiveConfigSection: re-run cross-option when entering edit mode or continuing after save failure; allow opening save modal when only validation summary is present. - Toolbar: validation link aria-label describes opening the summary.
This commit is contained in:
+15
-1
@@ -155,6 +155,7 @@
|
||||
private void EnterEditMode()
|
||||
{
|
||||
Session.EnterEditMode();
|
||||
RefreshCrossOptionAfterEnteringEditMode();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
@@ -206,6 +207,15 @@
|
||||
Session.SetCrossOptionIssues(issues);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="IEffectiveConfigEditSession.EnterEditMode"/> clears cross-option issues; repopulate from disk + pending.
|
||||
/// </summary>
|
||||
private void RefreshCrossOptionAfterEnteringEditMode()
|
||||
{
|
||||
if (Status != null)
|
||||
RunCrossOptionEvaluator();
|
||||
}
|
||||
|
||||
private void OnRevertedFromSaveModal()
|
||||
{
|
||||
RunCrossOptionEvaluator();
|
||||
@@ -214,7 +224,10 @@
|
||||
|
||||
private void OpenSaveModal()
|
||||
{
|
||||
if (Session.PendingChanges.Count == 0) return;
|
||||
var hasPending = Session.PendingChanges.Count > 0;
|
||||
var hasValidation = Session.GetValidationSummary().Count > 0;
|
||||
if (!hasPending && !hasValidation)
|
||||
return;
|
||||
_showSaveModal = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
@@ -231,6 +244,7 @@
|
||||
Session.ExitEditModeDiscard();
|
||||
await OnSaveCompleted.InvokeAsync();
|
||||
Session.EnterEditMode();
|
||||
RefreshCrossOptionAfterEnteringEditMode();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@
|
||||
{
|
||||
<span class="text-danger fw-medium ec-toolbar-changes-link" role="button" tabindex="0"
|
||||
title="@ValidationErrorTooltip"
|
||||
aria-label="Open save dialog"
|
||||
aria-label="Open validation summary"
|
||||
@onclick="OnOpenSaveModal"
|
||||
@onkeydown="OnValidationLinkKeyDown">
|
||||
@ValidationErrorCount error(s)
|
||||
@@ -48,7 +48,7 @@
|
||||
{
|
||||
<span class="text-warning ec-toolbar-changes-link" role="button" tabindex="0"
|
||||
title="@ValidationWarningTooltip"
|
||||
aria-label="Open save dialog"
|
||||
aria-label="Open validation summary"
|
||||
@onclick="OnOpenSaveModal"
|
||||
@onkeydown="OnValidationLinkKeyDown">
|
||||
@ValidationWarningCount warning(s)
|
||||
|
||||
Reference in New Issue
Block a user