Clean up gateway status conditionals and logging bootstrap mode detection.
Simplify nested dashboard gateway status branches for readability and use a concise first-subcommand check when selecting early GUI logging mode.
This commit is contained in:
@@ -40,14 +40,19 @@ export function GatewayMenuPanel({
|
||||
statusSnapshot
|
||||
}: GatewayMenuPanelProps) {
|
||||
const gatewayOpen = gatewayState === 'open'
|
||||
const gatewayConnecting = gatewayState === 'connecting'
|
||||
const inferenceReady = gatewayOpen && inferenceStatus?.ready === true
|
||||
const connectionLabel = gatewayOpen ? 'Connected' : prettyState(gatewayState || 'offline')
|
||||
const connectionLabel = gatewayOpen
|
||||
? 'Connected'
|
||||
: gatewayConnecting
|
||||
? 'Connecting'
|
||||
: prettyState(gatewayState || 'offline')
|
||||
const inferenceLabel = gatewayOpen
|
||||
? inferenceStatus
|
||||
? inferenceReady
|
||||
? 'Inference ready'
|
||||
: 'Inference not ready'
|
||||
: 'Checking inference'
|
||||
? inferenceStatus?.ready
|
||||
? 'Inference ready'
|
||||
: inferenceStatus
|
||||
? 'Inference not ready'
|
||||
: 'Checking inference'
|
||||
: 'Disconnected'
|
||||
const platforms = Object.entries(statusSnapshot?.gateway_platforms || {}).sort(([l], [r]) => l.localeCompare(r))
|
||||
const recentLogs = logLines.slice(-5)
|
||||
|
||||
@@ -105,19 +105,21 @@ export function useStatusbarItems({
|
||||
}, [desktopActionTasks, previewServerRestartStatus, subagentsBySession, workingSessionIds])
|
||||
|
||||
const gatewayOpen = gatewayState === 'open'
|
||||
const gatewayConnecting = gatewayState === 'connecting'
|
||||
const inferenceReady = gatewayOpen && inferenceStatus?.ready === true
|
||||
const gatewayDegraded = gatewayOpen || gatewayConnecting
|
||||
const gatewayDetail = gatewayOpen
|
||||
? inferenceStatus
|
||||
? inferenceReady
|
||||
? 'ready'
|
||||
: 'needs setup'
|
||||
: 'checking'
|
||||
: gatewayState === 'connecting'
|
||||
? inferenceStatus?.ready
|
||||
? 'ready'
|
||||
: inferenceStatus
|
||||
? 'needs setup'
|
||||
: 'checking'
|
||||
: gatewayConnecting
|
||||
? 'connecting'
|
||||
: 'offline'
|
||||
const gatewayClassName = inferenceReady
|
||||
? undefined
|
||||
: gatewayOpen || gatewayState === 'connecting'
|
||||
: gatewayDegraded
|
||||
? 'text-amber-600 hover:text-amber-600'
|
||||
: 'text-destructive hover:text-destructive'
|
||||
|
||||
|
||||
+8
-9
@@ -240,15 +240,14 @@ except Exception:
|
||||
try:
|
||||
from hermes_logging import setup_logging as _setup_logging
|
||||
|
||||
_early_mode = "cli"
|
||||
for _arg in sys.argv[1:]:
|
||||
if _arg.startswith("-"):
|
||||
continue
|
||||
if _arg == "dashboard":
|
||||
_early_mode = "gui"
|
||||
break
|
||||
|
||||
_setup_logging(mode=_early_mode)
|
||||
_setup_logging(
|
||||
mode=(
|
||||
"gui"
|
||||
if next((arg for arg in sys.argv[1:] if not arg.startswith("-")), "")
|
||||
== "dashboard"
|
||||
else "cli"
|
||||
)
|
||||
)
|
||||
except Exception:
|
||||
pass # best-effort — don't crash the CLI if logging setup fails
|
||||
|
||||
|
||||
Reference in New Issue
Block a user