From 0bc81bbe407f451cb7a6af988df3747ca9053516 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 7 Mar 2026 04:54:51 -0800 Subject: [PATCH] feat(tenants): add delete button to tenant list page Each tenant row now has a Delete button with confirmation dialog. Previously delete was only accessible from the detail page which had no navigation link from the list. Co-Authored-By: Claude Sonnet 4.6 --- .../src/app/(admin)/tenants/page.tsx | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/it0-web-admin/src/app/(admin)/tenants/page.tsx b/it0-web-admin/src/app/(admin)/tenants/page.tsx index 1b4afe1..4e4320a 100644 --- a/it0-web-admin/src/app/(admin)/tenants/page.tsx +++ b/it0-web-admin/src/app/(admin)/tenants/page.tsx @@ -73,6 +73,7 @@ export default function TenantsPage() { const [showCreate, setShowCreate] = useState(false); const [expandedId, setExpandedId] = useState(null); const [editingId, setEditingId] = useState(null); + const [deletingId, setDeletingId] = useState(null); const [editPlan, setEditPlan] = useState('free'); const [editQuota, setEditQuota] = useState({ maxServers: 0, @@ -115,6 +116,12 @@ export default function TenantsPage() { onSuccess: invalidate, }); + const deleteMutation = useMutation({ + mutationFn: (id: string) => + apiClient(`/api/v1/admin/tenants/${id}`, { method: 'DELETE' }), + onSuccess: () => { invalidate(); setDeletingId(null); }, + }); + /* ---- helpers ---- */ function resetCreateForm() { setShowCreate(false); @@ -335,6 +342,12 @@ export default function TenantsPage() { > {expandedId === tenant.id ? t('actions.hideQuotas') : t('actions.quotas')} + )} @@ -367,6 +380,32 @@ export default function TenantsPage() { )} + + {/* Delete confirmation dialog */} + {deletingId && ( +
+
+

{t('deleteDialog.title')}

+

{t('deleteDialog.message')}

+
+ + +
+
+
+ )} ); }