diff --git a/crates/forge-core/src/store/ci.rs b/crates/forge-core/src/store/ci.rs index a90e995..b4ab39d 100644 --- a/crates/forge-core/src/store/ci.rs +++ b/crates/forge-core/src/store/ci.rs @@ -507,6 +507,19 @@ impl Store { })) } + /// Stamps the runner's `last_seen_at`. A busy runner does not claim, so its job heartbeats keep + /// it from counting as offline. + pub async fn touch_runner(&self, id: &str) -> Result<()> { + let conn = self.inner.conn.lock().await; + conn.execute( + "UPDATE ci_runners SET last_seen_at = ?2 WHERE id = ?1", + (id.to_string(), now_stamp()), + ) + .await + .map_err(db_err)?; + Ok(()) + } + /// All runners, by name. pub async fn list_runners(&self) -> Result> { let conn = self.read_conn().await; diff --git a/crates/forge-web/assets/nav.js b/crates/forge-web/assets/nav.js index e2475ce..3882dab 100644 --- a/crates/forge-web/assets/nav.js +++ b/crates/forge-web/assets/nav.js @@ -1940,6 +1940,11 @@ var owner = det && det.closest('details.row-menu'); if (owner) { owner.open = false; } } + // Confirm popovers, like row menus, close on a click anywhere outside them. + var pop = t.closest('details.confirm-inline'); + document.querySelectorAll('details.confirm-inline[open]').forEach(function (d) { + if (d !== pop) { d.open = false; } + }); // Row action menus: one open at a time, closed by a click anywhere outside. var menu = t.closest('details.row-menu'); document.querySelectorAll('details.row-menu[open]').forEach(function (d) { @@ -1951,7 +1956,11 @@ // arrow keys move between the menu's items. document.addEventListener('keydown', function (e) { var menu = document.querySelector('details.row-menu[open]'); - if (!menu) { return; } + if (!menu) { + var lone = e.key === 'Escape' && document.querySelector('details.confirm-inline[open]'); + if (lone) { lone.open = false; var ls = lone.querySelector('summary'); if (ls) { ls.focus(); } e.preventDefault(); } + return; + } if (e.key === 'Escape') { var inner = menu.querySelector('details.confirm-inline[open]'); if (inner) { inner.open = false; var sm = inner.querySelector('summary'); if (sm) { sm.focus(); } } diff --git a/crates/forge-web/src/ci/api.rs b/crates/forge-web/src/ci/api.rs index 55068a7..c22fbaf 100644 --- a/crates/forge-web/src/ci/api.rs +++ b/crates/forge-web/src/ci/api.rs @@ -584,6 +584,9 @@ async fn heartbeat(cx: &Cx) -> topcoat::Result { let mut concurrency = None; let mut restart = None; if let Some(runner_id) = job.runner_id.as_deref() { + if let Err(e) = state.store.touch_runner(runner_id).await { + tracing::warn!(error = %e, "ci: runner last-seen not stored"); + } let said = headers(cx) .get(CONCURRENCY_HEADER) .and_then(|v| v.to_str().ok())