diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js index 7789f9f..66872b6 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js @@ -3163,7 +3163,10 @@ function scheduleReconnect(delayMs = 1000) { async function pollFreshSnapshot() { try { - const resp = await fetch("/status", { cache: "no-store" }); + const statusUrl = lastActiveRigId + ? `/status?rig_id=${encodeURIComponent(lastActiveRigId)}` + : "/status"; + const resp = await fetch(statusUrl, { cache: "no-store" }); if (!resp.ok) return; const data = await resp.json(); render(data); diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/api.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/api.rs index d49f2f7..1e408e4 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/api.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/api.rs @@ -135,13 +135,27 @@ impl SessionRigManager { pub type SharedSessionRigManager = Arc; +#[derive(serde::Deserialize)] +pub struct StatusQuery { + pub rig_id: Option, +} + #[get("/status")] pub async fn status_api( + query: web::Query, state: web::Data>, clients: web::Data>, context: web::Data>, ) -> Result { - let state = wait_for_view(state.get_ref().clone()).await?; + // Prefer the per-rig watch channel when a rig_id is specified, + // falling back to the global state watch. + let rx = query + .rig_id + .as_deref() + .filter(|s| !s.is_empty()) + .and_then(|rid| context.rig_state_rx(rid)) + .unwrap_or_else(|| state.get_ref().clone()); + let state = wait_for_view(rx).await?; let json = serde_json::to_string(&state).map_err(actix_web::error::ErrorInternalServerError)?; let json = inject_frontend_meta( &json,