diff --git a/frontend/packages/dashboard/src/home.js b/frontend/packages/dashboard/src/home.js index 70b13dc6..0dead042 100644 --- a/frontend/packages/dashboard/src/home.js +++ b/frontend/packages/dashboard/src/home.js @@ -48,6 +48,19 @@ async function init() { ident.textContent = parts.join(' / '); ident.hidden = false; } + + // Rev line: absent when the flake ref isn't a local path pin (a bare + // `github:` url has no on-disk rev to canonicalize) — hidden rather + // than showing a placeholder in that case. + const rev = $('hive-rev'); + if (rev && state.hyperhive_rev) { + const short = state.hyperhive_rev.length > 16 + ? `…${state.hyperhive_rev.slice(-12)}` + : state.hyperhive_rev; + rev.textContent = `rev ${short}`; + rev.title = state.hyperhive_rev; + rev.hidden = false; + } } init(); diff --git a/frontend/packages/dashboard/src/index.html b/frontend/packages/dashboard/src/index.html index c6b98a8a..cabbc40a 100644 --- a/frontend/packages/dashboard/src/index.html +++ b/frontend/packages/dashboard/src/index.html @@ -30,6 +30,7 @@
+
diff --git a/hive-c0re/src/dashboard/state_snapshot.rs b/hive-c0re/src/dashboard/state_snapshot.rs index ff23cb98..14d96eb6 100644 --- a/hive-c0re/src/dashboard/state_snapshot.rs +++ b/hive-c0re/src/dashboard/state_snapshot.rs @@ -37,6 +37,13 @@ pub(super) struct StateSnapshot { /// "apply everything you've buffered". seq: u64, hostname: String, + /// Current rev of the pinned `hyperhive` flake input, resolved the + /// same way `get_agent_meta`'s per-agent `hyperhive_rev` is (see + /// `auto_update::current_flake_rev`). `None` when the flake ref + /// isn't a local path pin (e.g. a bare `github:` url) or the rev + /// can't be resolved. Feeds the dashboard start page so an operator + /// can tell what build a hive is running without shelling in. + hyperhive_rev: Option, any_stale: bool, containers: Vec, transients: Vec, @@ -382,6 +389,7 @@ pub(super) async fn api_state( axum::Json(StateSnapshot { seq, hostname, + hyperhive_rev: crate::auto_update::current_flake_rev(&state.coord.hyperhive_flake), any_stale, containers, transients,