refactor(adminui): strip alias/relay machinery from UnsTreeService + EquipmentPage; Galaxy tags use standard TagModal

This commit is contained in:
Joseph Doherty
2026-06-12 21:28:13 -04:00
parent ca2698949b
commit 5dfb797817
6 changed files with 6 additions and 1803 deletions
@@ -175,12 +175,6 @@ public interface IUnsTreeService
/// <returns>The tag's edit projection, or <c>null</c> when missing.</returns>
Task<TagEditDto?> LoadTagAsync(string tagId, CancellationToken ct = default);
/// <summary>Load a Galaxy alias tag for editing (FullName parsed from TagConfig). Null if not found.</summary>
/// <param name="tagId">The alias tag to load.</param>
/// <param name="ct">A token to cancel the load.</param>
/// <returns>The alias tag's edit projection, or <c>null</c> when missing.</returns>
Task<AliasTagEditDto?> LoadAliasTagAsync(string tagId, CancellationToken ct = default);
/// <summary>
/// Loads a single equipment-bound virtual tag projected for editing, or <c>null</c> if it no longer
/// exists. Reads untracked and captures the current concurrency token for last-write-wins saves.
@@ -350,13 +344,6 @@ public interface IUnsTreeService
/// where <c>DriverType</c> lets the TagModal dispatch to a per-driver-type typed config editor.</returns>
Task<IReadOnlyList<(string DriverInstanceId, string Display, string DriverType)>> LoadTagDriversForEquipmentAsync(string equipmentId, CancellationToken ct = default);
/// <summary>Galaxy gateway driver instances (DriverType "GalaxyMxGateway") in the equipment's
/// cluster, for the alias address picker. Tuple = (DriverInstanceId, Display, DriverConfig).
/// <c>Display</c> is intentionally <c>"{DriverInstanceId} — {Name}"</c> (no DriverType suffix)
/// because every returned driver is a Galaxy gateway — do not add the type suffix.</summary>
Task<IReadOnlyList<(string DriverInstanceId, string Display, string DriverConfig)>>
LoadGalaxyGatewaysForEquipmentAsync(string equipmentId, CancellationToken ct = default);
/// <summary>
/// Creates a new equipment-bound tag. <c>FolderPath</c> is always <c>null</c> (decision #110 —
/// the tree only edits equipment-bound tags). Fails on a duplicate <c>TagId</c>, invalid
@@ -385,33 +372,6 @@ public interface IUnsTreeService
/// <returns>Success, a missing-row failure, a guard failure, or a concurrency failure.</returns>
Task<UnsMutationResult> UpdateTagAsync(string tagId, TagInput input, byte[] rowVersion, CancellationToken ct = default);
/// <summary>
/// Creates a new Galaxy alias tag on an equipment: an ordinary equipment-bound <c>Tag</c> bound to a
/// <c>GalaxyMxGateway</c> driver, with <c>FolderPath</c> null and a <c>{"FullName":…}</c> TagConfig
/// carrying the picked Galaxy reference. Fails on a duplicate <c>TagId</c>, an empty Galaxy reference,
/// an unknown equipment, a driver that is not a Galaxy gateway in the equipment's cluster, or a name
/// already used on the equipment.
/// </summary>
/// <param name="equipmentId">The owning equipment.</param>
/// <param name="input">The operator-editable alias fields (id, name, gateway, type, access, reference).</param>
/// <param name="ct">A token to cancel the operation.</param>
/// <returns>Success, or one of the guard failures.</returns>
Task<UnsMutationResult> CreateAliasTagAsync(string equipmentId, AliasTagInput input, CancellationToken ct = default);
/// <summary>
/// Updates a Galaxy alias tag's gateway binding, name, data type, access level, and Galaxy reference
/// (the <c>{"FullName":…}</c> TagConfig). The owning <c>EquipmentId</c> and the null <c>FolderPath</c>
/// are preserved. Re-runs the empty-reference and Galaxy-gateway-in-cluster guards against the alias's
/// existing equipment, and enforces name uniqueness on that equipment excluding this tag. Uses
/// last-write-wins optimistic concurrency on <see cref="Configuration.Entities.Tag.RowVersion"/>.
/// </summary>
/// <param name="tagId">The alias tag to update.</param>
/// <param name="input">The new operator-editable alias fields.</param>
/// <param name="rowVersion">The concurrency token the caller last read.</param>
/// <param name="ct">A token to cancel the operation.</param>
/// <returns>Success, a missing-row failure, a guard failure, or a concurrency failure.</returns>
Task<UnsMutationResult> UpdateAliasTagAsync(string tagId, AliasTagInput input, byte[] rowVersion, CancellationToken ct = default);
/// <summary>
/// Deletes a tag. A missing row is treated as success (already gone). Uses last-write-wins
/// optimistic concurrency on <see cref="Configuration.Entities.Tag.RowVersion"/>.
@@ -554,15 +514,4 @@ public interface IUnsTreeService
/// <param name="ct">A token to cancel the operation.</param>
/// <returns>Success, a concurrency failure, or a delete-failed failure.</returns>
Task<UnsMutationResult> DeleteScriptedAlarmAsync(string scriptedAlarmId, byte[] rowVersion, CancellationToken ct = default);
/// <summary>Convert pure-relay VirtualTags (body == return ctx.GetTag("X").Value;) to Galaxy alias
/// Tags. <paramref name="equipmentId"/> null = fleet-wide; otherwise scoped to that equipment.
/// <paramref name="dryRun"/> = true previews without mutating. FleetAdmin-gated at the call site.
/// Operates on the editable config (does not publish).</summary>
/// <param name="equipmentId">The equipment to scope to; <c>null</c> sweeps every equipment.</param>
/// <param name="dryRun"><c>true</c> previews the conversion without mutating the config.</param>
/// <param name="ct">A token to cancel the operation.</param>
/// <returns>The per-relay converted and skipped lists, plus whether the pass was applied.</returns>
Task<RelayConversionResult> ConvertRelayVirtualTagsToAliasesAsync(
string? equipmentId, bool dryRun, CancellationToken ct = default);
}