Improve admin field names and generation-safe dialog lifecycle
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
@if (ShowEllipsis)
|
||||
{
|
||||
<span class="ctx-ellipsis-wrap">
|
||||
<button type="button" class="ctx-ellipsis" title="More actions"
|
||||
<button type="button" class="ctx-ellipsis" title="@TriggerLabel" aria-label="@TriggerLabel"
|
||||
aria-haspopup="true" aria-expanded="@_open" @ref="_ellipsisRef" @onclick="OpenAt">
|
||||
⋯@* ⋯ MIDLINE HORIZONTAL ELLIPSIS *@
|
||||
</button>
|
||||
@@ -56,6 +56,9 @@
|
||||
/// <summary>Render the "⋯" trigger button (keyboard/touch fallback).</summary>
|
||||
[Parameter] public bool ShowEllipsis { get; set; } = true;
|
||||
|
||||
/// <summary>Contextual accessible name and tooltip for the native menu trigger.</summary>
|
||||
[Parameter] public string TriggerLabel { get; set; } = "More actions";
|
||||
|
||||
private bool _open;
|
||||
private double _x;
|
||||
private double _y;
|
||||
|
||||
+4
-3
@@ -25,9 +25,9 @@
|
||||
{
|
||||
<div class="row g-3 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Driver name</label>
|
||||
<input class="form-control form-control-sm mono" @bind="_name" placeholder="line3-modbus" />
|
||||
<div class="form-text">A RawPath segment — letters, digits, dash, underscore.</div>
|
||||
<TechField Label="Driver name" For="@_nameId" Hint="A RawPath segment — letters, digits, dash, underscore." HintId="@(_nameId + "-hint")">
|
||||
<input id="@_nameId" class="form-control form-control-sm mono" @bind="_name" placeholder="line3-modbus" aria-describedby="@(_nameId + "-hint")" />
|
||||
</TechField>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
/// <summary>Raised after a successful create/update so the tree can refresh.</summary>
|
||||
[Parameter] public EventCallback OnSaved { get; set; }
|
||||
|
||||
private readonly string _nameId = "driver-name-" + Guid.NewGuid().ToString("N");
|
||||
private bool _isNew;
|
||||
private string _driverType = "";
|
||||
private string _name = "";
|
||||
|
||||
+10
-6
@@ -14,12 +14,14 @@
|
||||
<div style="padding:1rem">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Run timeout (ms)</label>
|
||||
<InputNumber @bind-Value="_form.RunTimeoutMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
|
||||
<div class="form-text">
|
||||
Per-evaluation deadline for a calculated tag's script. Blank = the driver default (2000 ms).
|
||||
A script exceeding it is abandoned and the tag publishes Bad.
|
||||
</div>
|
||||
<TechField Label="Run timeout (ms)" For="@_timeoutId" HintId="@(_timeoutId + "-hint")"
|
||||
Hint="Per-evaluation deadline for a calculated tag's script. Blank = the driver default (2000 ms). A script exceeding it is abandoned and the tag publishes Bad.">
|
||||
<InputNumber id="@_timeoutId" DisplayName="Run timeout" @bind-Value="_form.RunTimeoutMs" @bind-Value:after="EmitAsync" class="form-control form-control-sm"
|
||||
aria-describedby="@(_timeoutId + "-hint " + _timeoutId + "-error")" />
|
||||
<div id="@(_timeoutId + "-error")" class="field-error">
|
||||
@if (_editContext is not null) { <ValidationMessage For="@(() => _form.RunTimeoutMs)" /> }
|
||||
</div>
|
||||
</TechField>
|
||||
</div>
|
||||
</div>
|
||||
<p class="form-text mt-3 mb-0">
|
||||
@@ -32,6 +34,8 @@
|
||||
<DriverResilienceSection ResilienceConfig="@ResilienceConfig" ResilienceConfigChanged="OnResilienceChanged" />
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private EditContext? _editContext { get; set; }
|
||||
private readonly string _timeoutId = "calculation-timeout-" + Guid.NewGuid().ToString("N");
|
||||
/// <summary>The driver-level DriverConfig JSON.</summary>
|
||||
[Parameter] public string DriverConfigJson { get; set; } = "{}";
|
||||
/// <summary>Fired (camelCase-serialized) whenever a field changes — enables @bind-DriverConfigJson.</summary>
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
@inject IJSRuntime JS
|
||||
@implements IAsyncDisposable
|
||||
|
||||
@if (Visible)
|
||||
{
|
||||
var closeGeneration = _generation;
|
||||
<div class="modal-backdrop fade show" style="display:block"></div>
|
||||
<div id="@_id" class="modal fade show" tabindex="-1" role="dialog" aria-modal="true"
|
||||
aria-labelledby="@(_id + "-title")" aria-describedby="@(string.IsNullOrWhiteSpace(Description) ? null : _id + "-description")"
|
||||
aria-busy="@(Busy ? "true" : "false")" style="display:block">
|
||||
<div class="modal-dialog @DialogClass" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 id="@(_id + "-title")" class="modal-title h5">@if (TitleContent is not null) { @TitleContent } else { @Title }</h2>
|
||||
<button type="button" class="btn-close" aria-label="Close @Title" disabled="@Busy" @onclick="() => RequestCloseFromDom(closeGeneration)"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@if (!string.IsNullOrWhiteSpace(Description))
|
||||
{
|
||||
<p id="@(_id + "-description")" class="mb-0">@Description</p>
|
||||
}
|
||||
@ChildContent
|
||||
</div>
|
||||
@if (Footer is not null)
|
||||
{
|
||||
<div class="modal-footer">@Footer</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
/// <summary>Whether this overlay is presented.</summary>
|
||||
[Parameter] public bool Visible { get; set; }
|
||||
/// <summary>The accessible dialog title.</summary>
|
||||
[Parameter] public string Title { get; set; } = "Dialog";
|
||||
/// <summary>Optional title markup; its text must retain the dialog's domain name.</summary>
|
||||
[Parameter] public RenderFragment? TitleContent { get; set; }
|
||||
/// <summary>Optional plain description linked to the modal container.</summary>
|
||||
[Parameter] public string? Description { get; set; }
|
||||
/// <summary>Optional existing Bootstrap dialog size/scroll modifiers.</summary>
|
||||
[Parameter] public string? DialogClass { get; set; }
|
||||
/// <summary>The body content.</summary>
|
||||
[Parameter] public RenderFragment? ChildContent { get; set; }
|
||||
/// <summary>The caller's action controls.</summary>
|
||||
[Parameter] public RenderFragment? Footer { get; set; }
|
||||
/// <summary>Prevents close while an operation is still in flight.</summary>
|
||||
[Parameter] public bool Busy { get; set; }
|
||||
/// <summary>The caller's existing close/cancel path; also rejects a second simultaneous overlay.</summary>
|
||||
[Parameter] public EventCallback OnClose { get; set; }
|
||||
|
||||
/// <summary>Optional nonconfidential editor/confirmation identity; changing it starts a fresh presentation.</summary>
|
||||
[Parameter] public object? Target { get; set; }
|
||||
|
||||
private readonly SemaphoreSlim _lifecycle = new(1, 1);
|
||||
private readonly string _id = "ot-modal-" + Guid.NewGuid().ToString("N");
|
||||
private DotNetObjectReference<ModalFrame>? _reference;
|
||||
private bool _active;
|
||||
private long _activeGeneration;
|
||||
private bool _disposed;
|
||||
private bool _lastVisible;
|
||||
private object? _lastTarget;
|
||||
private bool _needsOpen;
|
||||
private bool _closePending;
|
||||
private long _generation;
|
||||
private Task? _disposeTask;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (_lastVisible == Visible && Equals(_lastTarget, Target)) return;
|
||||
_lastVisible = Visible;
|
||||
_lastTarget = Target;
|
||||
++_generation;
|
||||
_needsOpen = Visible;
|
||||
_closePending = false;
|
||||
}
|
||||
|
||||
/// <summary>Closes only the current idle presentation, never a reopened target via a stale native event.</summary>
|
||||
[JSInvokable]
|
||||
public Task RequestCloseFromDom(long generation) => InvokeAsync(async () =>
|
||||
{
|
||||
if (_disposed || !Visible || Busy || _closePending || generation != _generation) return;
|
||||
_closePending = true;
|
||||
try { await OnClose.InvokeAsync(); }
|
||||
finally { if (generation == _generation) _closePending = false; }
|
||||
});
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await _lifecycle.WaitAsync();
|
||||
long rejectedGeneration = -1;
|
||||
try
|
||||
{
|
||||
if (_disposed) return;
|
||||
var generation = _generation;
|
||||
if (!Visible)
|
||||
{
|
||||
if (_reference is not null) await JS.InvokeVoidAsync("otDialog.deactivate", _id);
|
||||
_active = false;
|
||||
return;
|
||||
}
|
||||
if (_active && _activeGeneration != generation)
|
||||
{
|
||||
await JS.InvokeVoidAsync("otDialog.deactivate", _id, _activeGeneration);
|
||||
_active = false;
|
||||
}
|
||||
if (_disposed || !Visible || generation != _generation) return;
|
||||
if (!_active || _needsOpen)
|
||||
{
|
||||
_needsOpen = false;
|
||||
_reference ??= DotNetObjectReference.Create(this);
|
||||
var accepted = await JS.InvokeAsync<bool>("otDialog.activate", _id, _reference, generation, Busy);
|
||||
// A hide/target switch/dispose can occur while the browser reply is pending.
|
||||
// Clean only that old native generation before a queued render opens the next.
|
||||
if (_disposed || !Visible || generation != _generation)
|
||||
{
|
||||
if (accepted) await JS.InvokeVoidAsync("otDialog.deactivate", _id, generation);
|
||||
return;
|
||||
}
|
||||
_active = accepted;
|
||||
_activeGeneration = generation;
|
||||
if (!accepted) rejectedGeneration = generation;
|
||||
}
|
||||
else await JS.InvokeVoidAsync("otDialog.update", _id, generation, Busy);
|
||||
}
|
||||
catch (JSDisconnectedException) { }
|
||||
catch (JSException) { }
|
||||
catch (InvalidOperationException) { } // Static SSR cannot invoke JavaScript.
|
||||
finally { _lifecycle.Release(); }
|
||||
// Never hold the lifecycle gate while invoking a caller that can render/dispose us.
|
||||
if (rejectedGeneration == _generation) await RequestCloseFromDom(rejectedGeneration);
|
||||
}
|
||||
|
||||
public ValueTask DisposeAsync() => new(_disposeTask ??= DisposeCoreAsync());
|
||||
|
||||
private async Task DisposeCoreAsync()
|
||||
{
|
||||
_disposed = true;
|
||||
++_generation;
|
||||
await _lifecycle.WaitAsync();
|
||||
try
|
||||
{
|
||||
if (_reference is not null) await JS.InvokeVoidAsync("otDialog.deactivate", _id);
|
||||
}
|
||||
catch (JSDisconnectedException) { }
|
||||
catch (JSException) { }
|
||||
catch (InvalidOperationException) { }
|
||||
finally { _active = false; _reference?.Dispose(); _lifecycle.Release(); }
|
||||
}
|
||||
}
|
||||
@@ -3,32 +3,23 @@
|
||||
call and surfaces any UnsMutationResult.Error (a blocked delete names its blocker) via a follow-up
|
||||
message. Markup mirrors the other /raw modal shells. *@
|
||||
|
||||
@if (Visible)
|
||||
{
|
||||
<div class="modal-backdrop fade show" style="display:block"></div>
|
||||
<div class="modal fade show" tabindex="-1" role="dialog" style="display:block">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">@Title</h5>
|
||||
<button type="button" class="btn-close" aria-label="Close" @onclick="Cancel"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="mb-0">@Message</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-outline-secondary" @onclick="Cancel" disabled="@_busy">Cancel</button>
|
||||
<button type="button" class="btn btn-danger" @onclick="Confirm" disabled="@_busy">
|
||||
@if (_busy) { <span class="spinner-border spinner-border-sm me-1"></span> }
|
||||
@ConfirmLabel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@implements IDisposable
|
||||
|
||||
@{
|
||||
var presentation = _generation;
|
||||
var confirmAction = OnConfirm;
|
||||
}
|
||||
<ModalFrame Visible="@Visible" Title="@Title" Description="@Message" Target="@presentation" Busy="@_busy" OnClose="() => Cancel(presentation)">
|
||||
<Footer>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-outline-secondary" data-initial-focus="true" @onclick="() => Cancel(presentation)" disabled="@_busy">Cancel</button>
|
||||
<button type="button" class="btn btn-danger" @onclick="() => Confirm(presentation, confirmAction)" disabled="@_busy">
|
||||
@if (_busy) { <span class="spinner-border spinner-border-sm me-1" aria-hidden="true"></span> }
|
||||
@ConfirmLabel
|
||||
</button>
|
||||
</div>
|
||||
</Footer>
|
||||
</ModalFrame>
|
||||
|
||||
@code {
|
||||
/// <summary>Whether the dialog is shown (supports <c>@bind-Visible</c>).</summary>
|
||||
@@ -49,27 +40,61 @@
|
||||
/// <summary>Raised when the operator confirms. The dialog awaits it, then self-closes.</summary>
|
||||
[Parameter] public EventCallback OnConfirm { get; set; }
|
||||
|
||||
private bool _busy;
|
||||
/// <summary>Optional nonconfidential row identity when different targets share the same title/message.</summary>
|
||||
[Parameter] public object? Target { get; set; }
|
||||
|
||||
private async Task Confirm()
|
||||
private bool _busy;
|
||||
private bool _disposed;
|
||||
private bool _lastVisible;
|
||||
private string? _lastTitle;
|
||||
private string? _lastMessage;
|
||||
private object? _lastTarget;
|
||||
private long _generation;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (_disposed) return;
|
||||
if (_lastVisible == Visible && string.Equals(_lastTitle, Title, StringComparison.Ordinal)
|
||||
&& string.Equals(_lastMessage, Message, StringComparison.Ordinal) && Equals(_lastTarget, Target)) return;
|
||||
_lastVisible = Visible;
|
||||
_lastTitle = Title;
|
||||
_lastMessage = Message;
|
||||
_lastTarget = Target;
|
||||
++_generation;
|
||||
_busy = false; // Another target's already-dispatched operation continues independently.
|
||||
}
|
||||
|
||||
private async Task Confirm(long generation, EventCallback action)
|
||||
{
|
||||
if (_disposed || !Visible || generation != _generation || _busy) return;
|
||||
_busy = true;
|
||||
try
|
||||
{
|
||||
await OnConfirm.InvokeAsync();
|
||||
await action.InvokeAsync();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_busy = false;
|
||||
if (generation == _generation) _busy = false;
|
||||
}
|
||||
await Close();
|
||||
if (generation == _generation) await Close(generation);
|
||||
}
|
||||
|
||||
private Task Cancel() => Close();
|
||||
private Task Cancel(long generation) => !_disposed && generation == _generation && !_busy ? Close(generation) : Task.CompletedTask;
|
||||
|
||||
private async Task Close()
|
||||
private async Task Close(long generation)
|
||||
{
|
||||
if (_disposed || !Visible || generation != _generation) return;
|
||||
Visible = false;
|
||||
_lastVisible = false;
|
||||
++_generation; // Invalidate this render's controls even before a parent parameter pass.
|
||||
await VisibleChanged.InvokeAsync(false);
|
||||
}
|
||||
/// <summary>Invalidates old UI callbacks without cancelling an already-dispatched caller operation.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
_disposed = true;
|
||||
++_generation;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
NodeName="@_msgNodeName" OnClose="CloseMessage" />
|
||||
|
||||
@code {
|
||||
private readonly string _labelScope = "raw-control-" + Guid.NewGuid().ToString("N") + "-";
|
||||
/// <summary>The top-level Raw nodes to render (the enterprise roots from <c>LoadRootsAsync</c>).</summary>
|
||||
[Parameter, EditorRequired] public IReadOnlyList<RawNode> Roots { get; set; } = default!;
|
||||
|
||||
@@ -189,7 +190,7 @@
|
||||
break;
|
||||
default:
|
||||
<div @key="row.Key" class="small py-1" style="@($"padding-left:{row.Depth * 18}px")">
|
||||
<button type="button" class="btn btn-sm btn-link p-0" @onclick="@(() => ShowMore(row.Node))">
|
||||
<button type="button" class="btn btn-sm btn-link p-0" aria-label="@($"Show {Math.Min(row.Remaining, RawTreeRows.DefaultPageSize)} more ({row.Remaining} not shown) under {row.Node.DisplayName}")" @onclick="@(() => ShowMore(row.Node))">
|
||||
Show @Math.Min(row.Remaining, RawTreeRows.DefaultPageSize) more
|
||||
(@row.Remaining not shown)
|
||||
</button>
|
||||
@@ -211,7 +212,8 @@
|
||||
@if (hasExpander)
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-link p-0 tree-twist"
|
||||
@onclick="@(() => ToggleAsync(node))">
|
||||
aria-label="@($"{(node.Expanded ? "Collapse" : "Expand")} {node.DisplayName}")" aria-expanded="@(node.Expanded ? "true" : "false")"
|
||||
aria-busy="@(node.Loading ? "true" : null)" @onclick="@(() => ToggleAsync(node))">
|
||||
@(node.Expanded ? "▼" : "▶")
|
||||
</button>
|
||||
}
|
||||
@@ -222,7 +224,7 @@
|
||||
|
||||
@if (items.Count > 0)
|
||||
{
|
||||
<ContextMenu Items="items" ShowEllipsis="true">
|
||||
<ContextMenu Items="items" ShowEllipsis="true" TriggerLabel="@($"More actions for {node.DisplayName}")">
|
||||
@RenderRowBody(node, muted)
|
||||
</ContextMenu>
|
||||
}
|
||||
@@ -239,12 +241,12 @@
|
||||
<span class="d-inline-flex align-items-center gap-1">
|
||||
@if (PickerMode && node.Kind == RawNodeKind.Tag)
|
||||
{
|
||||
<input type="checkbox" class="form-check-input me-1"
|
||||
checked="@IsTagSelected(node)"
|
||||
<input type="checkbox" class="form-check-input me-1" aria-labelledby="@(_labelScope + Convert.ToHexString(System.Text.Encoding.UTF8.GetBytes(node.Key)))"
|
||||
title="@($"{node.Kind} {node.Key}")" checked="@IsTagSelected(node)"
|
||||
@onchange="@(e => ToggleTagSelection(node, e.Value is true))" />
|
||||
}
|
||||
<span aria-hidden="true">@KindIcon(node.Kind)</span>
|
||||
<span class="mono small @(muted ? "text-muted" : "")">@node.DisplayName</span>
|
||||
<span id="@(_labelScope + Convert.ToHexString(System.Text.Encoding.UTF8.GetBytes(node.Key)))" class="mono small @(muted ? "text-muted" : "")">@node.DisplayName</span>
|
||||
@if (muted)
|
||||
{
|
||||
<span class="chip chip-idle ms-1" style="font-size:0.65rem">disabled</span>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="toast show mb-2" role="alert">
|
||||
<div class="toast-header @GetHeaderClass(toast.Type)">
|
||||
<strong class="me-auto">@toast.Title</strong>
|
||||
<button type="button" class="btn-close btn-close-white" @onclick="() => Dismiss(toast)"></button>
|
||||
<button type="button" class="btn-close btn-close-white" aria-label="@($"Dismiss {toast.Title}")" @onclick="() => Dismiss(toast)"></button>
|
||||
</div>
|
||||
<div class="toast-body">@toast.Message</div>
|
||||
</div>
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
@if (hasExpander)
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-link p-0 tree-twist"
|
||||
@onclick="@(() => OnToggleExpand.InvokeAsync(node))">
|
||||
aria-label="@($"{(childrenShown ? "Collapse" : "Expand")} {node.DisplayName}")" aria-expanded="@(childrenShown ? "true" : "false")"
|
||||
aria-busy="@(node.Loading ? "true" : null)" @onclick="@(() => OnToggleExpand.InvokeAsync(node))">
|
||||
@(childrenShown ? "▼" : "▶")
|
||||
</button>
|
||||
}
|
||||
@@ -88,46 +89,46 @@
|
||||
case UnsNodeKind.Enterprise:
|
||||
// Deletes every cluster carrying this enterprise label (refuse-if-children).
|
||||
<button type="button" class="btn btn-sm btn-outline-danger ms-2"
|
||||
@onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
aria-label="@($"Delete {node.DisplayName}")" @onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
break;
|
||||
|
||||
case UnsNodeKind.Cluster:
|
||||
// "⚙ settings" is genuine navigation and stays a link, so the two actions on
|
||||
// either side of it are not adjacent and each carries its own margin.
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ms-2"
|
||||
@onclick="@(() => OnAddChild.InvokeAsync(node))">+ Area</button>
|
||||
<a class="btn btn-sm btn-link p-0 ms-2" href="@($"/clusters/{node.ClusterId}")">⚙ settings</a>
|
||||
aria-label="@($"+ Area under {node.DisplayName}")" @onclick="@(() => OnAddChild.InvokeAsync(node))">+ Area</button>
|
||||
<a class="btn btn-sm btn-link p-0 ms-2" aria-label="@($"Settings for {node.DisplayName}")" href="@($"/clusters/{node.ClusterId}")">⚙ settings</a>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger ms-2"
|
||||
@onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
aria-label="@($"Delete {node.DisplayName}")" @onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
break;
|
||||
|
||||
case UnsNodeKind.Area:
|
||||
<div class="btn-group btn-group-sm ms-2" role="group">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary"
|
||||
@onclick="@(() => OnAddChild.InvokeAsync(node))">+ Line</button>
|
||||
aria-label="@($"+ Line under {node.DisplayName}")" @onclick="@(() => OnAddChild.InvokeAsync(node))">+ Line</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary"
|
||||
@onclick="@(() => OnEdit.InvokeAsync(node))">Edit</button>
|
||||
aria-label="@($"Edit {node.DisplayName}")" @onclick="@(() => OnEdit.InvokeAsync(node))">Edit</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
@onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
aria-label="@($"Delete {node.DisplayName}")" @onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
</div>
|
||||
break;
|
||||
|
||||
case UnsNodeKind.Line:
|
||||
<div class="btn-group btn-group-sm ms-2" role="group">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary"
|
||||
@onclick="@(() => OnAddChild.InvokeAsync(node))">+ Equipment</button>
|
||||
aria-label="@($"+ Equipment under {node.DisplayName}")" @onclick="@(() => OnAddChild.InvokeAsync(node))">+ Equipment</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary"
|
||||
@onclick="@(() => OnEdit.InvokeAsync(node))">Edit</button>
|
||||
aria-label="@($"Edit {node.DisplayName}")" @onclick="@(() => OnEdit.InvokeAsync(node))">Edit</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
@onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
aria-label="@($"Delete {node.DisplayName}")" @onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
</div>
|
||||
break;
|
||||
|
||||
case UnsNodeKind.Equipment:
|
||||
// "Open" is genuine navigation to the equipment detail page and stays a link.
|
||||
<a class="btn btn-sm btn-link p-0 ms-2" href="@($"/uns/equipment/{node.EntityId}")">Open</a>
|
||||
<a class="btn btn-sm btn-link p-0 ms-2" aria-label="@($"Open {node.DisplayName}")" href="@($"/uns/equipment/{node.EntityId}")">Open</a>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger ms-2"
|
||||
@onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
aria-label="@($"Delete {node.DisplayName}")" @onclick="@(() => OnDelete.InvokeAsync(node))">Delete</button>
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user