@* Reusable confirm dialog for the /raw destructive operations (delete folder / driver / device /
tag-group / tag). Raises OnConfirm when the operator confirms; the caller runs the delete service
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)
{
}
@code {
/// Whether the dialog is shown (supports @bind-Visible).
[Parameter] public bool Visible { get; set; }
/// Two-way visibility callback.
[Parameter] public EventCallback VisibleChanged { get; set; }
/// The dialog title (e.g. "Delete driver").
[Parameter] public string Title { get; set; } = "Confirm";
/// The confirmation body message.
[Parameter] public string Message { get; set; } = "";
/// The confirm-button label.
[Parameter] public string ConfirmLabel { get; set; } = "Delete";
/// Raised when the operator confirms. The dialog awaits it, then self-closes.
[Parameter] public EventCallback OnConfirm { get; set; }
private bool _busy;
private async Task Confirm()
{
_busy = true;
try
{
await OnConfirm.InvokeAsync();
}
finally
{
_busy = false;
}
await Close();
}
private Task Cancel() => Close();
private async Task Close()
{
Visible = false;
await VisibleChanged.InvokeAsync(false);
}
}