ui(density): truncation sweep — Abbreviate + title on unbounded backend/free text (§1d Task 1)
This commit is contained in:
+15
-5
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user