feat(adminui): create-new-script from the inline virtual-tag panel

This commit is contained in:
Joseph Doherty
2026-06-16 16:44:14 -04:00
parent 526eebb3bb
commit c98625fd9f
4 changed files with 192 additions and 1 deletions
@@ -418,6 +418,19 @@ public interface IUnsTreeService
/// <returns>The scripts projected to <c>(ScriptId, Display)</c> pairs.</returns>
Task<IReadOnlyList<(string ScriptId, string Display)>> LoadScriptsAsync(CancellationToken ct = default);
/// <summary>
/// Creates a new, empty C# script row so the inline virtual-tag panel can bind a brand-new script
/// without leaving the modal. The <c>ScriptId</c> is system-generated (<c>SC-</c> + the first 12 hex
/// chars of a fresh <see cref="Guid"/>, mirroring the Script-edit page's convention); the source is
/// blank, the <c>SourceHash</c> is the SHA-256 of that blank source (so it stays consistent with the
/// inline save), and the language is <c>CSharp</c>. A whitespace-only name falls back to a default.
/// The new id is returned via <see cref="UnsMutationResult.CreatedId"/> so the caller can bind it.
/// </summary>
/// <param name="name">The operator-friendly script name; whitespace falls back to a default.</param>
/// <param name="ct">A token to cancel the operation.</param>
/// <returns>Success carrying the generated <c>SC-…</c> id in <see cref="UnsMutationResult.CreatedId"/>.</returns>
Task<UnsMutationResult> CreateScriptAsync(string name, CancellationToken ct = default);
/// <summary>
/// Creates a new equipment-bound virtual tag (plan decision #2 — virtual tags are always scoped
/// to an equipment). Fails if the equipment does not exist, if no script is chosen, if neither a