feat(ui): replace all native confirm() dialogs with styled ConfirmDialog
All checks were successful
Deploy to Production / Trigger production update (push) Successful in 8s
All checks were successful
Deploy to Production / Trigger production update (push) Successful in 8s
Add ConfirmDialogProvider + useConfirm hook (Promise-based API) so every window.confirm() in the app is replaced with a consistent themed modal. Replaced in 11 files (16 call-sites): - Settings: update panel action - Templates: delete template - Storages: delete storage - SSH Keys: delete key - Nodes: delete server - NodeNetworks: delete interface, apply pending, revert pending - HAResources: remove HA resource - SDNManager: apply SDN, delete zone/vnet, delete subnet - IPAM: release allocation, delete pool, cleanup orphans Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
} from '@/hooks/use-ipam';
|
||||
import type { IPAMNetwork, IPAMPool } from '@/types';
|
||||
import { toast } from 'sonner';
|
||||
import { useConfirm } from '@/components/shared/ConfirmDialog';
|
||||
|
||||
export default function IPAMNetworkDetailPage() {
|
||||
const { t } = useTranslation();
|
||||
@@ -223,6 +224,7 @@ const emptyPool = { name: '', pool_type: 'static', range_start: '', range_end: '
|
||||
|
||||
function PoolsCard({ networkId, pools }: { networkId: number; pools: IPAMPool[] }) {
|
||||
const { t } = useTranslation();
|
||||
const confirm = useConfirm();
|
||||
const createPool = useCreatePool();
|
||||
const updatePool = useUpdatePool();
|
||||
const deletePool = useDeletePool();
|
||||
@@ -259,8 +261,8 @@ function PoolsCard({ networkId, pools }: { networkId: number; pools: IPAMPool[]
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = (p: IPAMPool) => {
|
||||
if (!confirm(t('ipam.delete_pool_confirm', { name: p.name }))) return;
|
||||
const handleDelete = async (p: IPAMPool) => {
|
||||
if (!await confirm(t('ipam.delete_pool_confirm', { name: p.name }))) return;
|
||||
deletePool.mutate(p.id, {
|
||||
onSuccess: () => toast.success(t('ipam.pool_deleted')),
|
||||
onError: (e: Error) => toast.error(e.message),
|
||||
|
||||
Reference in New Issue
Block a user