chore: tweak the delete dialog
All checks were successful
Caddy Manager CI build / docker (push) Successful in 2m52s
All checks were successful
Caddy Manager CI build / docker (push) Successful in 2m52s
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Globalization;
|
|||||||
using CaddyManager.Components.Pages.Generic;
|
using CaddyManager.Components.Pages.Generic;
|
||||||
using CaddyManager.Contracts.Caddy;
|
using CaddyManager.Contracts.Caddy;
|
||||||
using CaddyManager.Contracts.Docker;
|
using CaddyManager.Contracts.Docker;
|
||||||
|
using Humanizer;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using MudBlazor;
|
using MudBlazor;
|
||||||
|
|
||||||
@@ -75,20 +76,21 @@ public partial class CaddyReverseProxiesPage : ComponentBase
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private Task Delete()
|
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,
|
FullWidth = true,
|
||||||
MaxWidth = MaxWidth.ExtraSmall
|
MaxWidth = MaxWidth.ExtraSmall
|
||||||
}, parameters: new DialogParameters
|
}, parameters: new DialogParameters<ConfirmationDialog>
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"Message",
|
p => p.Message,
|
||||||
$"Are you sure you want to delete the selected {confWord}?"
|
$"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());
|
var response = CaddyService.DeleteCaddyConfigurations(_selectedCaddyConfigurations.ToList());
|
||||||
|
|
||||||
@@ -108,9 +110,9 @@ public partial class CaddyReverseProxiesPage : ComponentBase
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
{ "ConfirmText", "Yes" },
|
{ p => p.ConfirmText, "Yes" },
|
||||||
{ "ConfirmColor", Color.Error },
|
{ p => p.ConfirmColor, Color.Error },
|
||||||
{ "CancelText", "No" }
|
{ p => p.CancelText, "No" }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<MudDialog>
|
<MudDialog>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<MudText Typo="Typo.body1">@Message</MudText>
|
<MudText Typo="Typo.body1" Style="white-space: pre-wrap;">@Message</MudText>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<MudButton OnClick="Cancel">@CancelText</MudButton>
|
<MudButton OnClick="Cancel">@CancelText</MudButton>
|
||||||
|
|||||||
Reference in New Issue
Block a user