diff --git a/src/client/application_detail.rs b/src/client/application_detail.rs index 4f3fef0..0e21c6a 100644 --- a/src/client/application_detail.rs +++ b/src/client/application_detail.rs @@ -7,7 +7,7 @@ // - Delete button : confirmation modal, then navigates back to /applications use leptos::prelude::*; -use leptos_router::hooks::{use_navigate, use_params_map}; +use leptos_router::hooks::{use_navigate, use_params_map, use_query_map}; use crate::api::applications::{ AddPortToApplication, DeleteApplication, RemovePortFromApplication, @@ -66,6 +66,16 @@ pub fn ApplicationDetailPage() -> impl IntoView { .unwrap_or(0) }; + let query = use_query_map(); + let back_url = move || { + query.read().get("back") + .map(|s| s.to_string()) + .unwrap_or_else(|| "/applications".to_string()) + }; + let back_label = move || { + if back_url().starts_with("/hosts/") { "← Host" } else { "← Applications" } + }; + let update_action = ServerAction::::new(); let add_port_action = ServerAction::::new(); let remove_port_action = ServerAction::::new(); @@ -182,7 +192,9 @@ pub fn ApplicationDetailPage() -> impl IntoView { view! { // ── Page header ─────────────────────────────────── diff --git a/src/client/host_detail.rs b/src/client/host_detail.rs index 84958c8..14e25b0 100644 --- a/src/client/host_detail.rs +++ b/src/client/host_detail.rs @@ -385,7 +385,10 @@ pub fn HostDetailPage() -> impl IntoView { let app_id = app.id; view! {
- {app.name} + + {app.name} +