feat(centralui): Topology 'Deploy all…' on site and area nodes with confirm dialog, Force and summary toast (Gitea #40)

This commit is contained in:
Joseph Doherty
2026-10-22 14:16:08 -04:00
parent d71f61e71b
commit bcd087efe8
6 changed files with 314 additions and 4 deletions
@@ -0,0 +1,61 @@
@*
Body component for the Topology "Deploy all…" confirmation (Gitea #40), hosted by
IDialogService.ShowAsync. Shows how many instances the site/area subtree holds and
how many of those are Disabled (always skipped), and offers the Force switch that
also redeploys up-to-date instances. Closes with DeployAllResult; Cancel resolves
to null, so a cancel is distinguishable from a confirm (the MoveTemplateDialog /
TemplatePickerDialog contract).
*@
@using ZB.MOM.WW.ScadaBridge.CentralUI.Services
<div data-test="deploy-all-body">
<p class="mb-2">
Deploy all instances under <strong data-test="deploy-all-scope">@ScopeLabel</strong>?
</p>
<p class="mb-2 small" data-test="deploy-all-counts">
<span class="fw-semibold">@Total</span> instance@(Total == 1 ? "" : "s")
@if (Disabled > 0)
{
<span class="text-muted"> (@Disabled disabled &mdash; will be skipped)</span>
}
. Instances already running the current configuration are skipped.
</p>
<div class="form-check mb-1">
<input type="checkbox" class="form-check-input" id="deploy-all-force" data-test="deploy-all-force"
@bind="_force" />
<label class="form-check-label small" for="deploy-all-force">Force redeploy up-to-date instances</label>
</div>
<div class="form-text">
A redeploy resets an instance's static attribute overrides and clears its native alarm state.
Disabled instances are never deployed or re-enabled.
</div>
</div>
<div class="modal-footer px-0 pb-0 mt-3">
<div class="btn-group btn-group-sm" role="group">
<button class="btn btn-outline-secondary" type="button" data-test="deploy-all-cancel"
@onclick="() => Context.Cancel()">Cancel</button>
<button class="btn btn-primary" type="button" data-test="deploy-all-confirm"
@onclick="() => Context.Close(new DeployAllResult(_force))">Deploy all</button>
</div>
</div>
@code {
/// <summary>Supplied by <c>IDialogService.ShowAsync</c>; closes/cancels the modal.</summary>
[Parameter] public DialogContext<DeployAllResult> Context { get; set; } = default!;
/// <summary>Human label of the subtree being deployed, e.g. "site Plant" or "area Line A".</summary>
[Parameter] public string ScopeLabel { get; set; } = string.Empty;
/// <summary>Instances in the subtree.</summary>
[Parameter] public int Total { get; set; }
/// <summary>Of those, the Disabled ones a bulk deploy always skips.</summary>
[Parameter] public int Disabled { get; set; }
private bool _force;
/// <summary>Operator's confirmed choice; <c>null</c> from ShowAsync means Cancel.</summary>
/// <param name="Force">Also redeploy instances that are already up to date.</param>
public sealed record DeployAllResult(bool Force);
}