Dashboard: confirm before Close session / Kill worker

Add a shared ConfirmDialog component and route Sessions, Workers, and
SessionDetails Close/Kill buttons through it. The dialog shows the
target session id and a color-matched confirm button (yellow Close,
red Kill); Cancel dismisses without invoking the admin service.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-05-24 07:17:32 -04:00
parent c5e7479ee4
commit 0e56b5befb
4 changed files with 223 additions and 28 deletions
@@ -0,0 +1,59 @@
@if (IsOpen)
{
<div class="modal-backdrop fade show"></div>
<div class="modal fade show" role="dialog" aria-modal="true" aria-labelledby="@TitleId" tabindex="-1" style="display: block;">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title h5" id="@TitleId">@Title</h2>
<button type="button" class="btn-close" aria-label="Close"
disabled="@IsBusy"
@onclick="OnCancel"></button>
</div>
<div class="modal-body">
<p class="mb-0">@Message</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary"
disabled="@IsBusy"
@onclick="OnCancel">
Cancel
</button>
<button type="button" class="btn @ConfirmButtonClass"
disabled="@IsBusy"
@onclick="OnConfirm">
@ConfirmLabel
</button>
</div>
</div>
</div>
</div>
}
@code {
private readonly string TitleId = $"confirm-dialog-{Guid.NewGuid():N}";
[Parameter]
public bool IsOpen { get; set; }
[Parameter]
public string Title { get; set; } = "Confirm";
[Parameter]
public string Message { get; set; } = string.Empty;
[Parameter]
public string ConfirmLabel { get; set; } = "Confirm";
[Parameter]
public string ConfirmButtonClass { get; set; } = "btn-primary";
[Parameter]
public bool IsBusy { get; set; }
[Parameter]
public EventCallback OnConfirm { get; set; }
[Parameter]
public EventCallback OnCancel { get; set; }
}