swarm-ui: show the swarm's name as the page title and top-left brand

New GET /api/swarm on swarm-controller, backed by
services.hyperhive.swarm.name (SWARM_CONTROLLER_NAME env var, same
optionalAttrs-gated-on-option-resolving shape queueEnv/forgeEnv/etc.
already use). swarm-ui's <Shell> fetches it once and sets both
document.title and the header's brand text; falls back to the
existing static "hyperhive swarm" label when the operator never set
a name or the fetch fails.

Extracted the swarm-queue connect block out of main() into its own
connect_status_reader() fn to keep main() under clippy's line-count
lint after adding the new field wiring — no behavior change, same
comments moved as-is.
This commit is contained in:
iris 2026-08-18 17:58:30 +02:00 committed by mara
commit 3643eccf22
3 changed files with 161 additions and 44 deletions

View file

@ -141,6 +141,14 @@ let
SWARM_CONTROLLER_AUTH_BRIDGE_URL = cfg.authBridgeUrl;
};
# The swarm's own display name, for `GET /api/swarm` (swarm-ui's chrome).
# Gated on the option resolving, not defaulted to an empty string: an
# operator who never named the swarm gets `name: null` from the
# endpoint, not a blank label rendered as if it meant something.
swarmNameEnv = lib.optionalAttrs (config.services.hyperhive.swarm.name != null) {
SWARM_CONTROLLER_NAME = config.services.hyperhive.swarm.name;
};
# Wrapped rather than documented: every one of these values is derived
# from an option this deployment already set, so making the operator
# re-supply them on the command line would be asking them to repeat the
@ -653,7 +661,8 @@ in
// queueEnv
// forgeEnv
// webhookEnv
// authBridgeEnv;
// authBridgeEnv
// swarmNameEnv;
};
# A systemd credential is a SNAPSHOT: it is materialised into `%d` once,