merge: ui(density) Task 1 — truncation sweep (Abbreviate + title on unbounded text)

This commit is contained in:
Joseph Doherty
2026-08-10 18:01:39 -04:00
19 changed files with 41 additions and 32 deletions
@@ -60,7 +60,7 @@
{
@foreach (var g in ldapGroups)
{
<span class="chip me-1 mono">@g</span>
<span class="chip me-1 mono" title="@g">@DisplayText.Abbreviate(g, 40)</span>
}
}
</span>
@@ -38,7 +38,7 @@ else
<div class="kv"><span class="k">Last success</span><span class="v">@(_status.LastSuccessUtc?.ToString("u") ?? "—")</span></div>
@if (!string.IsNullOrWhiteSpace(_status.LastError))
{
<div class="kv"><span class="k">Last error</span><span class="v text-danger small">@_status.LastError</span></div>
<div class="kv"><span class="k">Last error</span><span class="v text-danger small" title="@_status.LastError">@DisplayText.Abbreviate(_status.LastError, 80)</span></div>
}
</div>
</section>
@@ -81,7 +81,7 @@ else
<td><span class="chip @KindChipClass(e.TransitionKind)">@e.TransitionKind</span></td>
<td class="num">@e.Severity</td>
<td>@e.User</td>
<td>@e.Message</td>
<td title="@e.Message">@DisplayText.Abbreviate(e.Message, 80)</td>
@if (_canOperate)
{
@* DriverOperator-gated Acknowledge / Shelve / Unshelve. Each routes through
@@ -74,8 +74,8 @@ else
@foreach (var c in store.Certificates)
{
<tr>
<td><span class="mono small">@c.Subject</span></td>
<td><span class="mono small">@c.Issuer</span></td>
<td title="@c.Subject"><span class="mono small">@DisplayText.Abbreviate(c.Subject, 48)</span></td>
<td title="@c.Issuer"><span class="mono small">@DisplayText.Abbreviate(c.Issuer, 48)</span></td>
<td><span class="mono small">@DisplayText.Abbreviate(c.Thumbprint, 16)</span></td>
<td>@c.NotBefore.ToString("u")</td>
<td>@c.NotAfter.ToString("u")</td>
@@ -85,7 +85,7 @@ else
<span class="chip chip-idle me-1">@perm</span>
}
</td>
<td class="text-muted small">@(a.Notes ?? "")</td>
<td class="text-muted small" title="@(a.Notes ?? "")">@(string.IsNullOrEmpty(a.Notes) ? "" : DisplayText.Abbreviate(a.Notes, 60))</td>
<td><a href="/clusters/@ClusterId/acls/@a.NodeAclId" class="btn btn-sm btn-outline-primary">Edit</a></td>
</tr>
}
@@ -52,7 +52,8 @@ else
<td><span class="chip chip-idle">@a.EventType</span></td>
<td><span class="mono small">@(a.NodeId ?? "—")</span></td>
<td><span class="mono small">@(a.CorrelationId?.ToString("N")[..8] ?? "—")</span></td>
<td class="text-muted small" style="max-width:400px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">
<td class="text-muted small" title="@(a.DetailsJson ?? "")"
style="max-width:400px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">
@(a.DetailsJson ?? "")
</td>
</tr>
@@ -46,7 +46,7 @@ else
}
@if (!string.IsNullOrWhiteSpace(_cluster.Notes))
{
<div class="kv"><span class="k">Notes</span><span class="v">@_cluster.Notes</span></div>
<div class="kv"><span class="k">Notes</span><span class="v" title="@_cluster.Notes">@DisplayText.Abbreviate(_cluster.Notes, 120)</span></div>
}
</div>
@@ -97,9 +97,9 @@ else
{
<tr>
<td><span class="mono">@n.NodeId</span></td>
<td>@n.Host</td>
<td title="@n.Host">@DisplayText.Abbreviate(n.Host, 30)</td>
<td class="num">@n.OpcUaPort</td>
<td><span class="mono small">@n.ApplicationUri</span></td>
<td title="@n.ApplicationUri"><span class="mono small">@DisplayText.Abbreviate(n.ApplicationUri, 40)</span></td>
<td class="num">@n.ServiceLevelBase</td>
<td><a href="/clusters/@ClusterId/nodes/@n.NodeId" class="btn btn-sm btn-outline-primary">Edit</a></td>
</tr>
@@ -125,7 +125,7 @@ else
{
<tr>
<td><span class="mono">@n.NodeId</span></td>
<td><span class="mono small">@n.ApplicationUri</span></td>
<td title="@n.ApplicationUri"><span class="mono small">@DisplayText.Abbreviate(n.ApplicationUri, 40)</span></td>
<td class="num">@n.ServiceLevelBase</td>
<td class="text-muted small">
@if (n.ServiceLevelBase >= 200) { <text>Primary preference</text> }
@@ -89,7 +89,7 @@ else
<td><span class="chip @StatusChipClass(r.Status)">@StatusLabel(r.Status)</span></td>
<td>@(r.AppliedAtUtc?.ToString("u") ?? "—")</td>
<td>@(r.StartedAtUtc?.ToString("u") ?? "—")</td>
<td>@(r.FailureReason ?? "")</td>
<td title="@(r.FailureReason ?? "")">@(string.IsNullOrEmpty(r.FailureReason) ? "" : DisplayText.Abbreviate(r.FailureReason, 80))</td>
</tr>
}
</tbody>
@@ -21,7 +21,7 @@
<div class="kv"><span class="k">Enabled</span><span class="v">@(_options.Enabled ? "yes" : "no")</span></div>
<div class="kv"><span class="k">Server</span><span class="v mono">@_options.Server:@_options.Port</span></div>
<div class="kv"><span class="k">Transport</span><span class="v">@_options.Transport</span></div>
<div class="kv"><span class="k">SearchBase</span><span class="v mono small">@_options.SearchBase</span></div>
<div class="kv"><span class="k">SearchBase</span><span class="v mono small" title="@_options.SearchBase">@DisplayText.Abbreviate(_options.SearchBase, 48)</span></div>
@if (_options.Transport == ZB.MOM.WW.Auth.Abstractions.Ldap.LdapTransport.None && _options.AllowInsecure)
{
<div class="kv"><span class="k">Warning</span><span class="v"><span class="chip chip-alert">Plaintext credentials over LDAP — dev mode only</span></span></div>
@@ -62,7 +62,7 @@
@foreach (var r in _rows)
{
<tr>
<td><span class="mono">@r.LdapGroup</span></td>
<td title="@r.LdapGroup"><span class="mono">@DisplayText.Abbreviate(r.LdapGroup, 48)</span></td>
<td><span class="chip chip-idle">@r.Role</span></td>
<td><button class="btn btn-sm btn-outline-danger" @onclick="() => DeleteAsync(r.Id)" disabled="@_busy">Delete</button></td>
</tr>
@@ -93,7 +93,7 @@
@foreach (var kvp in _options.GroupToRole.OrderBy(k => k.Key, StringComparer.OrdinalIgnoreCase))
{
<tr>
<td><span class="mono">@kvp.Key</span></td>
<td title="@kvp.Key"><span class="mono">@DisplayText.Abbreviate(kvp.Key, 48)</span></td>
<td><span class="chip chip-idle">@kvp.Value</span></td>
</tr>
}
@@ -68,7 +68,7 @@ else
@if (!string.IsNullOrEmpty(e.AlarmId)) { <span class="ms-1">alarm=@e.AlarmId</span> }
@if (!string.IsNullOrEmpty(e.EquipmentId)) { <span class="ms-1">eq=@e.EquipmentId</span> }
</td>
<td><span class="mono small">@e.Message</span></td>
<td title="@e.Message"><span class="mono small">@DisplayText.Abbreviate(e.Message, 120)</span></td>
</tr>
}
</tbody>
@@ -38,7 +38,7 @@
}
else if (_error is not null)
{
<p class="mb-0" style="color:var(--bad)">SignalR error: @_error</p>
<p class="mb-0" style="color:var(--bad)" title="@_error">SignalR error: @DisplayText.Abbreviate(_error, 60)</p>
}
else if (_snapshot is null)
{
@@ -166,7 +166,7 @@
@if (_opResultMessage is not null)
{
<span class="chip @(_opResultOk ? "chip-ok" : "chip-bad")" style="font-size:0.8rem">@_opResultMessage</span>
<span class="chip @(_opResultOk ? "chip-ok" : "chip-bad")" style="font-size:0.8rem" title="@_opResultMessageFull">@_opResultMessage</span>
}
</div>
@@ -212,7 +212,11 @@
private bool _busyReconnect;
private bool _busyRestart;
private bool _showRestartConfirm;
// Display text for the op-result chip (truncated at the ShowOpResult choke point) plus the
// untruncated original, which rides the chip's title attribute so the full message stays
// reachable on hover.
private string? _opResultMessage;
private string? _opResultMessageFull;
private bool _opResultOk;
private System.Threading.Timer? _opResultClearTimer;
@@ -303,6 +307,7 @@
{
_busyReconnect = true;
_opResultMessage = null;
_opResultMessageFull = null;
StateHasChanged();
try
{
@@ -315,7 +320,7 @@
}
catch (Exception ex)
{
ShowOpResult(false, ex.Message.Length > 60 ? ex.Message[..60] + "…" : ex.Message);
ShowOpResult(false, ex.Message);
}
finally
{
@@ -329,6 +334,7 @@
_showRestartConfirm = false;
_busyRestart = true;
_opResultMessage = null;
_opResultMessageFull = null;
StateHasChanged();
try
{
@@ -341,7 +347,7 @@
}
catch (Exception ex)
{
ShowOpResult(false, ex.Message.Length > 60 ? ex.Message[..60] + "…" : ex.Message);
ShowOpResult(false, ex.Message);
}
finally
{
@@ -367,13 +373,17 @@
private void ShowOpResult(bool ok, string message)
{
_opResultOk = ok;
_opResultMessage = message;
// Single truncation choke point: callers pass the untruncated message, the chip renders the
// abbreviation and carries the original on its title attribute.
_opResultMessageFull = message;
_opResultMessage = DisplayText.Abbreviate(message, 60);
// Auto-clear the result chip after 8 s. System.Threading.Timer is used (not
// System.Timers.Timer) so DisposeAsync can drain any in-flight callback.
_opResultClearTimer?.Dispose();
_opResultClearTimer = new System.Threading.Timer(_ =>
{
_opResultMessage = null;
_opResultMessageFull = null;
InvokeAsync(StateHasChanged);
}, null, TimeSpan.FromSeconds(8), Timeout.InfiniteTimeSpan);
}
@@ -18,7 +18,7 @@
<div class="modal-footer">
@if (!string.IsNullOrEmpty(CurrentAddress))
{
<code class="me-auto mono">@CurrentAddress</code>
<code class="me-auto mono" title="@CurrentAddress">@DisplayText.Abbreviate(CurrentAddress, 60)</code>
}
<div class="btn-group" role="group">
<button type="button" class="btn btn-outline-secondary" @onclick="OnCloseAsync">Close</button>
@@ -72,7 +72,7 @@
<div class="mt-3">
<span class="text-muted small">Result:</span>
<code class="mono ms-2">@_built</code>
<code class="mono ms-2" title="@_built">@DisplayText.Abbreviate(_built, 64)</code>
</div>
@code {
@@ -106,7 +106,7 @@
}
else
{
<code class="mono ms-2">@_built</code>
<code class="mono ms-2" title="@_built">@DisplayText.Abbreviate(_built, 64)</code>
}
</div>
@@ -92,7 +92,7 @@
<div class="mt-3">
<span class="text-muted small">Result:</span>
<code class="mono ms-2">@_built</code>
<code class="mono ms-2" title="@_built">@DisplayText.Abbreviate(_built, 64)</code>
</div>
@code {
@@ -54,7 +54,7 @@
<div class="mt-3">
<span class="text-muted small">Result:</span>
<code class="mono ms-2">@_built</code>
<code class="mono ms-2" title="@_built">@DisplayText.Abbreviate(_built, 64)</code>
</div>
@code {
@@ -155,11 +155,9 @@ else
<span class="chip chip-ok">Browser open</span>
<button type="button" class="btn btn-outline-secondary btn-sm" @onclick="CloseBrowseAsync">Close</button>
}
@* Same open-error chip the five sibling pickers use: abbreviated inline, full text on title. *@
@if (_openError is not null) { <span class="chip chip-bad" title="@_openError">@DisplayText.Abbreviate(_openError, 60)</span> }
</div>
@if (_openError is not null)
{
<div class="text-danger small mt-2">@_openError</div>
}
@if (_token != Guid.Empty)
{
@@ -207,7 +205,7 @@ else
<div class="mt-3">
<span class="text-muted small">TagConfig:</span>
<code class="mono ms-2">@(_built.Length == 0 ? "—" : _built)</code>
<code class="mono ms-2" title="@_built">@DisplayText.Abbreviate(_built, 64)</code>
</div>
@code {
@@ -61,7 +61,7 @@
<div class="mt-3">
<span class="text-muted small">Result:</span>
<code class="mono ms-2">@_built</code>
<code class="mono ms-2" title="@_built">@DisplayText.Abbreviate(_built, 64)</code>
</div>
@code {