diff --git a/bastion/src/bastion/src/routes/api.ts b/bastion/src/bastion/src/routes/api.ts index 9647893..be4ae3c 100644 --- a/bastion/src/bastion/src/routes/api.ts +++ b/bastion/src/bastion/src/routes/api.ts @@ -72,7 +72,18 @@ export function registerApiRoutes( const stageName = stage ?? "unknown"; const detailStr = detail ?? ""; - logger.info(`Progress: ${mac} ${stageName}${detailStr ? ` -- ${detailStr}` : ""}`); + const GREEN = "\x1b[0;32m"; + const YELLOW = "\x1b[1;33m"; + const RED = "\x1b[0;31m"; + const BOLD = "\x1b[1m"; + const RESET = "\x1b[0m"; + const icons: Record = { + partitioning: "◆", installing: "◆◆", "post-install": "◆◆◆", + complete: "✔", error: "✘", + }; + const icon = icons[stageName] ?? "·"; + const color = stageName === "complete" ? GREEN : stageName === "error" ? RED : YELLOW; + console.log(` ${color}${icon}${RESET} ${mac} ${BOLD}${stageName}${RESET}${detailStr ? ` -- ${detailStr}` : ""}`); state.update((s) => { const queueEntry = s.install_queue[mac]; @@ -100,7 +111,8 @@ export function registerApiRoutes( }; s.installed[mac] = installedInfo; - logger.info(`INSTALL COMPLETE: ${mac} -> ${installedInfo.hostname} (${ip})`); + const admin = state.load().installed[mac]?.role ? "michal" : "root"; + console.log(`\n \x1b[0;32m\x1b[1m ssh ${admin}@${ip}\x1b[0m\n`); } } });