feat(adminui): UNS-tree delete for Cluster + Enterprise (refuse-if-children, no rowversion)

This commit is contained in:
Joseph Doherty
2026-06-16 16:35:07 -04:00
parent 6a8020e7e7
commit 526eebb3bb
5 changed files with 349 additions and 3 deletions
@@ -332,6 +332,32 @@ public interface IUnsTreeService
/// <returns>Success, a concurrency failure, or a delete-failed failure.</returns>
Task<UnsMutationResult> DeleteEquipmentAsync(string equipmentId, byte[] rowVersion, CancellationToken ct = default);
/// <summary>
/// Deletes a server cluster. A missing row is treated as success (already gone). The delete is
/// refuse-if-children: a cluster that still owns nodes, namespaces, UNS areas, or driver
/// instances is left intact and a guidance message is returned (the same convention as
/// Area/Line/Equipment, and matching the existing cluster-settings "Delete cluster" behaviour).
/// The <see cref="Configuration.Entities.ServerCluster"/> entity carries no concurrency token,
/// so — unlike the Area/Line/Equipment deletes — this signature takes no <c>rowVersion</c>.
/// </summary>
/// <param name="clusterId">The cluster to delete.</param>
/// <param name="ct">A token to cancel the operation.</param>
/// <returns>Success, or a refuse-if-children failure naming what still references the cluster.</returns>
Task<UnsMutationResult> DeleteClusterAsync(string clusterId, CancellationToken ct = default);
/// <summary>
/// Deletes every cluster carrying the given <c>Enterprise</c> label. The enterprise is a tree
/// label (a string value on cluster rows), not a DB entity, so deleting it means deleting all of
/// its clusters. The operation is all-or-nothing: it first checks every matching cluster for
/// children; if <em>any</em> cluster still owns nodes, namespaces, UNS areas, or driver instances
/// the whole delete refuses (naming the first blocking cluster) and nothing is removed — there is
/// never a partial enterprise deletion. An enterprise with no matching clusters is a no-op success.
/// </summary>
/// <param name="enterpriseName">The <c>Enterprise</c> label whose clusters to delete.</param>
/// <param name="ct">A token to cancel the operation.</param>
/// <returns>Success, or a refuse-if-children failure naming the blocking cluster.</returns>
Task<UnsMutationResult> DeleteEnterpriseAsync(string enterpriseName, CancellationToken ct = default);
/// <summary>
/// Loads the drivers eligible to back a tag on the given equipment: drivers in the equipment's
/// cluster (<c>Equipment.UnsLine → UnsArea.ClusterId</c>) whose namespace is Equipment-kind