Improve device detail view
build / build-linux-amd64 (push) Successful in 1m53s

This commit is contained in:
2026-05-22 23:03:06 +02:00
parent aeee852835
commit 7b6526a2e8
3 changed files with 50 additions and 4 deletions
+8 -3
View File
@@ -1074,12 +1074,14 @@ fn render_device_row(
</a>
<button class="w-full text-left px-2 py-1 text-xs hover:bg-slate-800 rounded"
hx-get="/admin/pages/devices/{id}/detail"
hx-target="#devices-region" hx-swap="innerHTML">
hx-target="#devices-region" hx-swap="innerHTML"
hx-push-url="#devices/{id}">
{details}
</button>
<button class="w-full text-left px-2 py-1 text-xs hover:bg-slate-800 rounded"
hx-get="/admin/pages/devices/{id}/exec"
hx-target="#devices-region" hx-swap="innerHTML">
hx-target="#devices-region" hx-swap="innerHTML"
hx-push-url="#devices/{id}/exec">
{run_command}
</button>
<hr class="border-slate-700 my-1" />
@@ -1146,12 +1148,15 @@ pub async fn list_fragment(
/// "Back to devices" — refetches the devices table fragment via HTMX
/// and swaps it back into `#devices-region`. Used by the detail page.
/// `hx-push-url="#devices"` resets the address bar to the list-level
/// hash so a subsequent refresh lands on the list, not the detail.
fn back_button(lang: Lang) -> String {
format!(
r##"<button class="text-xs text-sky-300 hover:text-sky-200"
hx-get="/admin/pages/devices/list-fragment"
hx-target="#devices-region"
hx-swap="innerHTML">{label}</button>"##,
hx-swap="innerHTML"
hx-push-url="#devices">{label}</button>"##,
label = t(lang, "devices.back"),
)
}
+2 -1
View File
@@ -227,7 +227,8 @@ async fn render_page(
<h2 class="text-lg font-semibold">{heading} <code class="font-mono text-sky-300">{id}</code></h2>
<button class="text-xs text-sky-300 hover:text-sky-200"
hx-get="/admin/pages/devices/list-fragment"
hx-target="#devices-region" hx-swap="innerHTML">{back}</button>
hx-target="#devices-region" hx-swap="innerHTML"
hx-push-url="#devices">{back}</button>
</header>"##,
heading = t(lang, "exec.heading"),
id = html_escape(peer_id),