From 1b55b1354165ef26426a997232e8124d27c63ac6 Mon Sep 17 00:00:00 2001 From: mathieu Date: Sat, 16 May 2026 02:53:40 +0200 Subject: [PATCH] feat(applications): replace inline add form with modal and add name filter Co-Authored-By: Claude Sonnet 4.6 --- src/client/applications.rs | 178 ++++++++++++++++++++++++++----------- 1 file changed, 127 insertions(+), 51 deletions(-) diff --git a/src/client/applications.rs b/src/client/applications.rs index be0c60d..e5cd526 100644 --- a/src/client/applications.rs +++ b/src/client/applications.rs @@ -1,7 +1,8 @@ // client/applications.rs — Applications list page // // Displays all applications with: -// - Add form : inline form to create an application by name +// - Add button : opens a modal to create an application by name +// - Filter bar : name substring filter (client-side) // - Table : application name + number of associated hosts // - Delete : confirmation modal before deletion @@ -13,6 +14,61 @@ use crate::api::applications::{ get_applications_with_counts, }; +// ─── Add application modal ──────────────────────────────────────────────────── + +#[component] +fn AddApplicationModal( + create_action: ServerAction, + show_modal: RwSignal, +) -> impl IntoView { + Effect::new(move |_| { + if let Some(Ok(_)) = create_action.value().get() { + show_modal.set(false); + } + }); + + view! { + + }.into_any() +} + // ─── Delete confirmation modal ──────────────────────────────────────────────── #[component] @@ -68,10 +124,15 @@ pub fn ApplicationsPage() -> impl IntoView { let create_action = ServerAction::::new(); let delete_action = ServerAction::::new(); + let show_modal = RwSignal::new(false); + // Some(app) = delete modal open for that app; None = closed. let pending_delete: RwSignal> = RwSignal::new(None); - // Close the modal automatically after a successful deletion. + // Name filter (client-side — list is typically small) + let name_filter = RwSignal::new(String::new()); + + // Close the delete modal automatically after a successful deletion. Effect::new(move |_| { if let Some(Ok(_)) = delete_action.value().get() { pending_delete.set(None); @@ -85,7 +146,22 @@ pub fn ApplicationsPage() -> impl IntoView { view! {
-

"Applications"

+ + // ── Page header ─────────────────────────────────────────────────── + + + // ── Add modal ───────────────────────────────────────────────────── + {move || show_modal.get().then(|| view! { + + })} // ── Delete modal ────────────────────────────────────────────────── {move || pending_delete.get().map(|app| view! { @@ -96,31 +172,22 @@ pub fn ApplicationsPage() -> impl IntoView { /> })} - // ── Add form ────────────────────────────────────────────────────── -
-

"Add an application"

- -
+ }.into_any() + } + } })}