diff --git a/src/ScadaLink.CentralUI/Components/Pages/Deployment/Instances.razor b/src/ScadaLink.CentralUI/Components/Pages/Deployment/Instances.razor index 371087b..1ed59f1 100644 --- a/src/ScadaLink.CentralUI/Components/Pages/Deployment/Instances.razor +++ b/src/ScadaLink.CentralUI/Components/Pages/Deployment/Instances.razor @@ -75,100 +75,69 @@ - - - - - - - - - - - - - - @if (_filteredInstances.Count == 0) + + + @switch (node.Kind) { - - - + case InstanceNodeKind.Site: + @node.Label + break; + case InstanceNodeKind.Area: + @node.Label + break; + case InstanceNodeKind.Instance: + @node.Label + @node.Instance!.State + @if (node.Instance!.State != InstanceState.NotDeployed) + { + + @(node.IsStale ? "Stale" : "Current") + + } + break; } - @foreach (var inst in _pagedInstances) + + + @if (node.Kind == InstanceNodeKind.Instance) { - - - - - - - - - - } - -
Instance NameTemplateSiteAreaStatusStalenessActions
No instances match the current filters.
@inst.UniqueName@GetTemplateName(inst.TemplateId)@GetSiteName(inst.SiteId)@(inst.AreaId.HasValue ? GetAreaName(inst.AreaId.Value) : "—") - @inst.State - - @{ - var isStale = _stalenessMap.GetValueOrDefault(inst.Id); - } - @if (inst.State == InstanceState.NotDeployed) - { - - } - else if (isStale) - { - Stale - } - else - { - Current - } - - - @if (inst.State == InstanceState.Enabled) - { - - } - else if (inst.State == InstanceState.Disabled) - { - - } - - - -
- - @* Pagination *@ - @if (_totalPages > 1) - { - - } -
+ else if (inst.State == InstanceState.Disabled) + { + + } + + + + + } + + + No instances match the current filters. + + + +
@_filteredInstances.Count instance(s) total
@@ -230,9 +199,13 @@ return authState.User.FindFirst("Username")?.Value ?? "unknown"; } + record InstanceTreeNode(string Key, string Label, InstanceNodeKind Kind, + List Children, Instance? Instance = null, + bool IsStale = false); + enum InstanceNodeKind { Site, Area, Instance } + private List _allInstances = new(); private List _filteredInstances = new(); - private List _pagedInstances = new(); private List _sites = new(); private List