fix(adminui): preserve edited alarm fields on Galaxy address re-pick

This commit is contained in:
Joseph Doherty
2026-06-19 02:02:06 -04:00
parent f81fa76809
commit 2dd723e195
3 changed files with 105 additions and 8 deletions
@@ -43,4 +43,19 @@ public static class TagConfigJson
if (value is null) { o.Remove(name); return; }
o[name] = JsonValue.Create(value is Enum e ? e.ToString() : value);
}
/// <summary>
/// Merges a freshly-picked Galaxy reference (<c>tag_name.AttributeName</c>) into <paramref name="json"/>
/// by setting ONLY the canonical PascalCase <c>FullName</c> key — every other key is preserved verbatim.
/// This is the Galaxy address re-pick seam: re-picking an address must update the bound attribute WITHOUT
/// discarding fields the operator already edited independently of the address — ESPECIALLY a hand-authored
/// <c>alarm</c> object (and root history/array intent, scaling, etc.). Null/blank/malformed input starts
/// from a bare <c>{"FullName":...}</c> object.
/// </summary>
public static string SetFullName(string? json, string fullName)
{
var o = ParseOrNew(json);
o["FullName"] = JsonValue.Create(fullName);
return Serialize(o);
}
}