mirror of
https://github.com/alexhopeoconnor/dnsmasq-webui.git
synced 2026-10-04 04:18:13 +10:00
- Move registration marker interfaces to Registration/Abstractions - Add feature folders with Abstractions subfolders: EffectiveConfig, Dnsmasq/Config, Dnsmasq/Hosts, Dnsmasq/Leases, Dnsmasq/Reload, Logs, Updates, UI/Settings, Common/Process - Place interfaces in each feature's Abstractions namespace; align implementation namespaces to folder paths - Update Program, extensions, controllers, hubs, helpers, components, and tests to use new namespaces - Remove old flat Services/Abstractions and root-level service files
39 lines
1.3 KiB
Plaintext
39 lines
1.3 KiB
Plaintext
@namespace DnsmasqWebUI.Components.Dnsmasq.EffectiveConfig
|
|
@using DnsmasqWebUI.Models.Dnsmasq
|
|
@using DnsmasqWebUI.Models.Dnsmasq.EffectiveConfig
|
|
@using DnsmasqWebUI.Infrastructure.Services.EffectiveConfig.Abstractions
|
|
|
|
@if (ShowModal)
|
|
{
|
|
<EffectiveConfigSaveModal PendingChanges="@PendingChanges" Status="@Status" Session="@Session" OnClose="@OnClose" OnSave="@HandleSave" OnReverted="@HandleReverted" />
|
|
}
|
|
|
|
@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 HandleReverted()
|
|
{
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|
|
}
|