mirror of
https://github.com/alexhopeoconnor/dnsmasq-webui.git
synced 2026-10-03 22:12:00 +10:00
- Add IEffectiveConfigEditSession + EffectiveConfigEditSession - Add EffectiveConfigUiContext for option help / readonly popover / commit intents - Extract OptionHelpController, ReadonlyPopoverController, EffectiveConfigSaveFlow, EffectiveConfigToolbar, EffectiveConfigPanels, CopyableCodeLine, OptionHelpLabel, ReadonlyBadge, EffectiveConfigValueDisplayBase - Remove redundant named CascadingValues (IsEditMode, ActiveFieldKey, ManagedFilePath) - Remove unused ManagedFilePath cascading parameter from EffectiveConfigFieldDisplay - Fix save modal stacking: add EffectiveConfigSaveModal.razor.css (dialog above backdrop) - Pending changes displayed before save; hover-close fix for option help and readonly popover
34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
@namespace DnsmasqWebUI.Components.Dnsmasq.EffectiveConfig
|
|
@using DnsmasqWebUI.Models.Dnsmasq
|
|
@using DnsmasqWebUI.Models.Dnsmasq.EffectiveConfig
|
|
@using DnsmasqWebUI.Infrastructure.Services.Abstractions
|
|
|
|
@if (ShowModal)
|
|
{
|
|
<EffectiveConfigSaveModal PendingChanges="@PendingChanges" Status="@Status" OnClose="@OnClose" OnSave="@HandleSave" />
|
|
}
|
|
|
|
@code {
|
|
[Parameter] public bool ShowModal { get; set; }
|
|
[Parameter] public IReadOnlyList<PendingEffectiveConfigChange> PendingChanges { get; set; } = null!;
|
|
[Parameter] public DnsmasqServiceStatus? Status { get; set; }
|
|
[Parameter] public EventCallback OnClose { get; set; }
|
|
[Parameter] public EventCallback OnSaveCompleted { get; set; }
|
|
[Parameter] public IEffectiveConfigEditSession Session { get; set; } = null!;
|
|
|
|
private async Task HandleSave()
|
|
{
|
|
if (Session.PendingChanges.Count == 0) return;
|
|
try
|
|
{
|
|
await Session.ApplyAsync();
|
|
await OnClose.InvokeAsync();
|
|
await OnSaveCompleted.InvokeAsync();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
// TODO: show error to user (e.g. toast or modal message)
|
|
}
|
|
}
|
|
}
|