Compare commits

..
2 changed files with 15 additions and 1 deletions

View file

@ -2586,8 +2586,14 @@ window.marked = marked;
// one place. Returns the wrapping `<label class="schedule-field">`
// ready to append to the form.
function buildTargetChips({ idPrefix, fieldName, checked, extraNames = [] }) {
// Derive the manager's actual name from live state rather than
// hardcoding it — surface it first so it always appears before agents.
const managerContainer = Array.from(containersState.values()).find((c) => c.is_manager);
const managerName = managerContainer?.name;
const candidates = ['operator'];
if (managerName) candidates.push(managerName);
const containerNames = Array.from(containersState.values())
.filter((c) => !c.is_manager)
.map((c) => c.name)
.filter((n) => n !== 'operator')
.sort();
@ -2892,7 +2898,10 @@ window.marked = marked;
const out = [];
const push = (n) => { if (!seen.has(n)) { seen.add(n); out.push(n); } };
push('operator');
const managerContainer = Array.from(containersState.values()).find((c) => c.is_manager);
if (managerContainer) push(managerContainer.name);
const containerNames = Array.from(containersState.values())
.filter((c) => !c.is_manager)
.map((c) => c.name)
.filter((n) => n !== 'operator')
.sort();

View file

@ -12,7 +12,7 @@ use rusqlite::Connection;
use serde::{Deserialize, Serialize};
use crate::coordinator::Coordinator;
use crate::lifecycle::{self, AGENT_PREFIX};
use crate::lifecycle::{self, AGENT_PREFIX, MANAGER_NAME};
/// An agent-declared extra navigation link surfaced on the dashboard card.
/// Written by the `hive-dashboard-links` NixOS oneshot into
@ -34,6 +34,10 @@ pub struct ContainerView {
/// not serialized to API responses since the dashboard no longer displays it.
#[serde(skip)]
pub container: String,
/// True when this is the manager agent. Informational — not used
/// to gate any server-side actions. Computed from `name ==
/// MANAGER_NAME` so it doesn't add new state.
pub is_manager: bool,
pub port: u16,
pub running: bool,
pub needs_update: bool,
@ -164,6 +168,7 @@ pub async fn build_all(coord: &Coordinator) -> Vec<ContainerView> {
(false, None, None, false, None, None)
};
out.push(ContainerView {
is_manager: logical == MANAGER_NAME,
port: lifecycle::agent_web_port(&logical),
running,
container: c.clone(),