- @* Hosts *@
-
-
-
-
-
-
- -
- addn-hosts:
- @if (Status.AddnHostsPaths?.Count > 0)
- {
- var srcList = Status.EffectiveConfigSources?.AddnHostsPaths;
- if (srcList != null && srcList.Count == Status.AddnHostsPaths.Count)
- {
- @foreach (var entry in srcList)
- {
- @entry.Path @(entry.Source?.IsReadOnly == true ? " (readonly)" : "")
- }
- }
- else
- {
- var deduped = (Status.AddnHostsPaths ?? Array.Empty()).Distinct().ToList();
- @(deduped.Count == 1 ? deduped[0] : string.Join(", ", deduped))
- }
- }
- else { (none) }
-
- @if (Status.ManagedHostsFilePath != null) { - Managed hosts file (editable): @Status.ManagedHostsFilePath @(Status.ManagedHostsPathExists ? "✓" : "(not created yet)")
}
- @if (Status.SystemHostsPath != null) { - System hosts (read-only): @Status.SystemHostsPath @(Status.SystemHostsPathExists ? "✓" : "(missing)")
}
-
-
-
-
-
- @if (Status.EffectiveConfig != null)
+ @{
+ var descriptors = EffectiveConfigFieldBuilder.BuildFieldDescriptors(Status);
+ var sections = new[]
+ {
+ (EffectiveConfigFieldBuilder.SectionHosts, "Hosts"),
+ (EffectiveConfigFieldBuilder.SectionResolver, "Resolver / DNS"),
+ (EffectiveConfigFieldBuilder.SectionDhcp, "DHCP"),
+ (EffectiveConfigFieldBuilder.SectionCache, "Cache"),
+ (EffectiveConfigFieldBuilder.SectionProcess, "Process & networking")
+ };
+ }
+ @foreach (var (sectionId, title) in sections)
{
- var ec = Status.EffectiveConfig;
- var src = Status.EffectiveConfigSources;
-
- @* Resolver / DNS *@
-
-
-
-
-
-
-
-
-
-
- "0 (no DNS listener)", _ => ec.Port.Value.ToString() })" Source="@(src?.Port)" />
- @if (ec.ServerLocalValues?.Count > 0) { }
- @if (ec.AddressValues?.Count > 0) { }
- @if (ec.ResolvFiles?.Count > 0) { }
-
-
-
-
-
- @* DHCP *@
-
-
-
-
-
-
-
-
- @if (ec.DhcpLeaseMax.HasValue) { }
- @if (ec.DhcpTtl.HasValue) { }
- @if (ec.DhcpRanges?.Count > 0) { }
- @if (ec.DhcpHostLines?.Count > 0) { }
- @if (ec.DhcpOptionLines?.Count > 0) { }
-
-
-
-
-
- @* Cache *@
-
-
-
-
-
- @if (ec.CacheSize.HasValue) { }
- @if (ec.LocalTtl.HasValue) { }
-
- @if (ec.NegTtl.HasValue) { }
- @if (ec.MaxTtl.HasValue) { }
- @if (ec.MaxCacheTtl.HasValue) { }
- @if (ec.MinCacheTtl.HasValue) { }
-
-
-
-
-
- @* Process & networking *@
-
-
-
-
-
-
-
- @if (ec.Interfaces?.Count > 0) { }
- @if (ec.ListenAddresses?.Count > 0) { }
- @if (ec.ExceptInterfaces?.Count > 0) { }
- @if (ec.PidFilePath != null) { }
- @if (ec.User != null) { }
- @if (ec.Group != null) { }
- @if (ec.LogFacility != null) { }
-
-
-
-
+ var sectionDescriptors = descriptors.Where(d => d.SectionId == sectionId).ToList();
+ if (sectionDescriptors.Count > 0)
+ {
+
+ }
}
}
@@ -146,33 +34,11 @@
private bool IsOpen(string id) => _openPanels.Contains(id);
- private void TogglePanel(string id)
+ private void OnSectionToggle(string id)
{
if (_openPanels.Contains(id))
_openPanels.Remove(id);
else
_openPanels.Add(id);
}
-
- private static MarkupString RenderMultiValueList(IReadOnlyList