chore: tweak the delete dialog
All checks were successful
Caddy Manager CI build / docker (push) Successful in 2m52s

This commit is contained in:
2025-07-10 21:59:39 +07:00
parent 84e70b724a
commit 199ab601d5
2 changed files with 12 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ using System.Globalization;
using CaddyManager.Components.Pages.Generic;
using CaddyManager.Contracts.Caddy;
using CaddyManager.Contracts.Docker;
using Humanizer;
using Microsoft.AspNetCore.Components;
using MudBlazor;
@@ -75,20 +76,21 @@ public partial class CaddyReverseProxiesPage : ComponentBase
/// </summary>
private Task Delete()
{
var confWord = _selectedCaddyConfigurations.Count > 1 ? "configurations" : "configuration";
var confWord = "configuration".ToQuantity(_selectedCaddyConfigurations.Count, ShowQuantityAs.None);
return DialogService.ShowAsync<ConfirmationDialog>($"Delete {confWord}", options: new DialogOptions
return DialogService.ShowAsync<ConfirmationDialog>($"Delete {_selectedCaddyConfigurations.Count} {confWord}", options: new DialogOptions
{
FullWidth = true,
MaxWidth = MaxWidth.ExtraSmall
}, parameters: new DialogParameters
}, parameters: new DialogParameters<ConfirmationDialog>
{
{
"Message",
$"Are you sure you want to delete the selected {confWord}?"
p => p.Message,
$"Are you sure to delete the selected {confWord}?\n\n" +
$"{string.Join("\n", _selectedCaddyConfigurations.Select(c => $"\t{c}"))}"
},
{
"OnConfirm", EventCallback.Factory.Create(this, () =>
p => p.OnConfirm, EventCallback.Factory.Create(this, () =>
{
var response = CaddyService.DeleteCaddyConfigurations(_selectedCaddyConfigurations.ToList());
@@ -108,9 +110,9 @@ public partial class CaddyReverseProxiesPage : ComponentBase
}
})
},
{ "ConfirmText", "Yes" },
{ "ConfirmColor", Color.Error },
{ "CancelText", "No" }
{ p => p.ConfirmText, "Yes" },
{ p => p.ConfirmColor, Color.Error },
{ p => p.CancelText, "No" }
});
}

View File

@@ -1,6 +1,6 @@
<MudDialog>
<DialogContent>
<MudText Typo="Typo.body1">@Message</MudText>
<MudText Typo="Typo.body1" Style="white-space: pre-wrap;">@Message</MudText>
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">@CancelText</MudButton>