From 62e9609fe8da6c5edee840e8c90de8077f9dcf11 Mon Sep 17 00:00:00 2001
From: mathieu
Date: Sat, 16 May 2026 02:45:33 +0200
Subject: [PATCH] feat(hosts): add delete confirmation modal on hosts list page
Replace the direct dispatch on the Delete button with a pending_delete
signal (id + name). A DeleteHostModal identical to the one in host detail
opens for confirmation before the action is dispatched. The modal closes
automatically after a successful deletion.
Co-Authored-By: Claude Sonnet 4.6
---
src/client/hosts.rs | 67 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 64 insertions(+), 3 deletions(-)
diff --git a/src/client/hosts.rs b/src/client/hosts.rs
index 00b2e5a..5cc8494 100644
--- a/src/client/hosts.rs
+++ b/src/client/hosts.rs
@@ -27,6 +27,47 @@ const PER_PAGE_OPTIONS: &[(i64, &str)] = &[
(0, "All"),
];
+// ─── Delete host modal ────────────────────────────────────────────────────────
+
+#[component]
+fn DeleteHostModal(
+ host_name: String,
+ host_id: i64,
+ delete_action: ServerAction,
+ pending_delete: RwSignal
}>
@@ -276,6 +317,7 @@ fn HostTable(
{rows.into_iter().map(|host| {
let id = host.id;
+ let delete_name = host.name.clone();
view! {