Mapping
@@ -120,8 +119,6 @@
private int _scopeRuleSiteId;
private string? _scopeRuleError;
- private ConfirmDialog _confirmDialog = default!;
-
protected override async Task OnInitializedAsync()
{
_sites = (await SiteRepository.GetAllSitesAsync()).ToList();
@@ -209,9 +206,10 @@
private async Task DeleteScopeRule(SiteScopeRule rule)
{
var siteName = _siteLookup.GetValueOrDefault(rule.SiteId)?.Name ?? $"Site {rule.SiteId}";
- var confirmed = await _confirmDialog.ShowAsync(
+ var confirmed = await Dialog.ConfirmAsync(
+ "Remove Scope Rule",
$"Remove scope rule for '{siteName}'?",
- "Remove Scope Rule");
+ danger: true);
if (!confirmed) return;
try
diff --git a/src/ScadaLink.CentralUI/Components/Pages/Admin/Sites.razor b/src/ScadaLink.CentralUI/Components/Pages/Admin/Sites.razor
index 8261e78..6b04d47 100644
--- a/src/ScadaLink.CentralUI/Components/Pages/Admin/Sites.razor
+++ b/src/ScadaLink.CentralUI/Components/Pages/Admin/Sites.razor
@@ -1,3 +1,4 @@
+@* Reference pattern for list pages: card grid (col-lg-6) + flex header + search filter + kebab dropdown + Bootstrap collapse for noisy detail + @key on iterated cards + "No X match the filter." inline + empty-state CTA. Mirror this when building new list pages. *@
@page "/admin/sites"
@using ScadaLink.Security
@using ScadaLink.Commons.Entities.Sites
@@ -11,6 +12,7 @@
@inject AuthenticationStateProvider AuthStateProvider
@inject NavigationManager NavigationManager
@inject IJSRuntime JS
+@inject IDialogService Dialog
@@ -41,7 +43,6 @@
-
@if (_loading)
{
@@ -173,7 +174,6 @@
private string _search = "";
private ToastNotification _toast = default!;
- private ConfirmDialog _confirmDialog = default!;
private IEnumerable
FilteredSites =>
string.IsNullOrWhiteSpace(_search)
@@ -213,9 +213,10 @@
private async Task DeleteSite(Site site)
{
- var confirmed = await _confirmDialog.ShowAsync(
+ var confirmed = await Dialog.ConfirmAsync(
+ "Delete Site",
$"Delete site '{site.Name}' ({site.SiteIdentifier})? This cannot be undone.",
- "Delete Site");
+ danger: true);
if (!confirmed) return;
diff --git a/src/ScadaLink.CentralUI/Components/Pages/Deployment/Topology.razor b/src/ScadaLink.CentralUI/Components/Pages/Deployment/Topology.razor
index 55262d1..5e8c0ca 100644
--- a/src/ScadaLink.CentralUI/Components/Pages/Deployment/Topology.razor
+++ b/src/ScadaLink.CentralUI/Components/Pages/Deployment/Topology.razor
@@ -19,11 +19,11 @@
@inject AuthenticationStateProvider AuthStateProvider
@inject NavigationManager NavigationManager
@inject IJSRuntime JSRuntime
+@inject IDialogService Dialog
@implements IDisposable
-
@@ -18,7 +19,6 @@
-
@if (_loading)
{
@@ -148,7 +148,6 @@
: _apiMethods.Where(m => m.Name?.Contains(_apiMethodSearch, StringComparison.OrdinalIgnoreCase) ?? false);
private ToastNotification _toast = default!;
- private ConfirmDialog _confirmDialog = default!;
protected override async Task OnInitializedAsync()
{
@@ -246,7 +245,7 @@
private async Task DeleteExtSys(ExternalSystemDefinition es)
{
- if (!await _confirmDialog.ShowAsync($"Delete '{es.Name}'?", "Delete External System")) return;
+ if (!await Dialog.ConfirmAsync("Delete External System", $"Delete '{es.Name}'?", danger: true)) return;
try { await ExternalSystemRepository.DeleteExternalSystemAsync(es.Id); await ExternalSystemRepository.SaveChangesAsync(); _toast.ShowSuccess("Deleted."); await LoadAllAsync(); }
catch (Exception ex) { _toast.ShowError(ex.Message); }
}
@@ -318,7 +317,7 @@
private async Task DeleteDbConn(DatabaseConnectionDefinition dc)
{
- if (!await _confirmDialog.ShowAsync($"Delete '{dc.Name}'?", "Delete DB Connection")) return;
+ if (!await Dialog.ConfirmAsync("Delete DB Connection", $"Delete '{dc.Name}'?", danger: true)) return;
try { await ExternalSystemRepository.DeleteDatabaseConnectionAsync(dc.Id); await ExternalSystemRepository.SaveChangesAsync(); _toast.ShowSuccess("Deleted."); await LoadAllAsync(); }
catch (Exception ex) { _toast.ShowError(ex.Message); }
}
@@ -399,7 +398,7 @@
private async Task DeleteNotifList(NotificationList list)
{
- if (!await _confirmDialog.ShowAsync($"Delete notification list '{list.Name}'?", "Delete")) return;
+ if (!await Dialog.ConfirmAsync("Delete", $"Delete notification list '{list.Name}'?", danger: true)) return;
try { await NotificationRepository.DeleteNotificationListAsync(list.Id); await NotificationRepository.SaveChangesAsync(); _toast.ShowSuccess("Deleted."); await LoadAllAsync(); }
catch (Exception ex) { _toast.ShowError(ex.Message); }
}
@@ -474,7 +473,7 @@
private async Task DeleteApiMethod(ApiMethod m)
{
- if (!await _confirmDialog.ShowAsync($"Delete API method '{m.Name}'?", "Delete")) return;
+ if (!await Dialog.ConfirmAsync("Delete", $"Delete API method '{m.Name}'?", danger: true)) return;
try { await InboundApiRepository.DeleteApiMethodAsync(m.Id); await InboundApiRepository.SaveChangesAsync(); _toast.ShowSuccess("Deleted."); await LoadAllAsync(); }
catch (Exception ex) { _toast.ShowError(ex.Message); }
}
diff --git a/src/ScadaLink.CentralUI/Components/Pages/Design/SharedScripts.razor b/src/ScadaLink.CentralUI/Components/Pages/Design/SharedScripts.razor
index 2557fe7..18630b7 100644
--- a/src/ScadaLink.CentralUI/Components/Pages/Design/SharedScripts.razor
+++ b/src/ScadaLink.CentralUI/Components/Pages/Design/SharedScripts.razor
@@ -8,6 +8,7 @@
@inject SharedScriptService SharedScriptService
@inject AuthenticationStateProvider AuthStateProvider
@inject NavigationManager NavigationManager
+@inject IDialogService Dialog
@@ -16,7 +17,6 @@
-
@if (_loading)
{
@@ -117,7 +117,6 @@
private string _search = "";
private ToastNotification _toast = default!;
- private ConfirmDialog _confirmDialog = default!;
private IEnumerable
FilteredScripts =>
string.IsNullOrWhiteSpace(_search)
@@ -148,8 +147,10 @@
private async Task DeleteScript(SharedScript script)
{
- var confirmed = await _confirmDialog.ShowAsync(
- $"Delete shared script '{script.Name}'?", "Delete Shared Script");
+ var confirmed = await Dialog.ConfirmAsync(
+ "Delete Shared Script",
+ $"Delete shared script '{script.Name}'?",
+ danger: true);
if (!confirmed) return;
try
diff --git a/src/ScadaLink.CentralUI/Components/Pages/Design/SmtpConfiguration.razor b/src/ScadaLink.CentralUI/Components/Pages/Design/SmtpConfiguration.razor
index ee57e44..e6dd7f4 100644
--- a/src/ScadaLink.CentralUI/Components/Pages/Design/SmtpConfiguration.razor
+++ b/src/ScadaLink.CentralUI/Components/Pages/Design/SmtpConfiguration.razor
@@ -12,7 +12,6 @@
-
@if (_loading)
{
@@ -128,7 +127,6 @@
private string? _formError;
private ToastNotification _toast = default!;
- private ConfirmDialog _confirmDialog = default!;
protected override async Task OnInitializedAsync()
{
diff --git a/src/ScadaLink.CentralUI/Components/Pages/Design/TemplateEdit.razor b/src/ScadaLink.CentralUI/Components/Pages/Design/TemplateEdit.razor
index 1754e1d..f0fa16e 100644
--- a/src/ScadaLink.CentralUI/Components/Pages/Design/TemplateEdit.razor
+++ b/src/ScadaLink.CentralUI/Components/Pages/Design/TemplateEdit.razor
@@ -11,10 +11,10 @@
@inject TemplateService TemplateService
@inject AuthenticationStateProvider AuthStateProvider
@inject NavigationManager NavigationManager
+@inject IDialogService Dialog
-