Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring
TypeScript diagramhomelabhomelab-infrastructure-observabilitynetworkproxmox-veself-hostedzigbeezwavezwave-js
feat: show in Settings when status checks are disabled server-side
Tom Vaisbort7d5623d59c41
diff --git a/FEATURES.md b/FEATURES.mdindex 682851f..4c196b2 100644--- a/FEATURES.md+++ b/FEATURES.md@@ -224,6 +224,7 @@ Nodes: `proxmox` (host) / `vm` / `lxc`, linked host→guest by a `virtual` edge.| `health` | GET `/health` |- Checks run on a timer (`STATUS_CHECKER_INTERVAL`, 60s by default) and stream to the UI over WebSocket, no refresh. The sidebar footer keeps a running online/offline tally.+- **Monitoring handled elsewhere?** Set `STATUS_CHECKER_ENABLED=false` in `.env`: Homelable then sends no status or service probes at all, approved devices no longer default to `ping`, and Settings shows the checks as disabled.---diff --git a/INSTALLATION.md b/INSTALLATION.mdindex a93eb0f..5d7a25f 100644--- a/INSTALLATION.md+++ b/INSTALLATION.md@@ -412,6 +412,11 @@ SCANNER_RANGES=["192.168.1.0/24"]# How often to check node status (seconds)STATUS_CHECKER_INTERVAL=60++# Set to false when another system (Prometheus, Uptime Kuma…) owns monitoring:+# no node or service checks run, approved devices get no default `ping`, and+# Settings shows the checks as disabled. Env-only (default true).+# STATUS_CHECKER_ENABLED=false```### OpenID Connect (optional)diff --git a/backend/app/api/routes/settings.py b/backend/app/api/routes/settings.pyindex e0a63a5..3f82774 100644--- a/backend/app/api/routes/settings.py+++ b/backend/app/api/routes/settings.py@@ -21,19 +21,30 @@ class AppSettings(BaseModel):service_check_interval: int = Field(default=300, ge=30)[email protected]("", response_model=AppSettings)-async def get_settings(_: str = Depends(get_current_user)) -> AppSettings:- return AppSettings(+class AppSettingsOut(AppSettings):+ # Read-only: STATUS_CHECKER_ENABLED is env-only, so the UI can show that+ # checks are switched off server-side instead of offering controls that do+ # nothing. Not accepted on POST (AppSettings ignores unknown fields).+ status_checker_enabled: bool = True+++def _out(payload: AppSettings) -> AppSettingsOut:+ return AppSettingsOut(**payload.model_dump(), status_checker_enabled=settings.status_checker_enabled)++[email protected]("", response_model=AppSettingsOut)+async def get_settings(_: str = Depends(get_current_user)) -> AppSettingsOut:+ return _out(AppSettings(interval_seconds=settings.status_checker_interval,service_check_enabled=settings.service_check_enabled,service_check_interval=settings.service_check_interval,- )+ ))[email protected]("", response_model=AppSettings)[email protected]("", response_model=AppSettingsOut)async def update_settings(payload: AppSettings, _: str = Depends(get_current_user)-) -> AppSettings:+) -> AppSettingsOut:try:settings.status_checker_interval = payload.interval_secondssettings.service_check_enabled = payload.service_check_enabled@@ -47,6 +58,6 @@ async def update_settings(set_service_checks_enabled(payload.service_check_enabled)if payload.service_check_enabled:reschedule_service_checks(payload.service_check_interval)- return payload+ return _out(payload)except Exception as exc:raise HTTPException(status_code=500, detail=str(exc)) from excdiff --git a/backend/tests/test_settings.py b/backend/tests/test_settings.pyindex 66d19eb..1cd0ec0 100644--- a/backend/tests/test_settings.py+++ b/backend/tests/test_settings.py@@ -368,3 +368,36 @@ def test_secret_key_length_is_checked_after_unwrapping():def test_quoted_oidc_client_secret_is_unwrapped():configured = _valid_oidc_settings(oidc_client_secret="'sup3r$ecret'")assert configured.oidc_client_secret == "sup3r$ecret"++[email protected]("enabled", [True, False])+async def test_get_settings_reports_the_status_checker_switch(client: AsyncClient, headers, enabled):+ with patch("app.api.routes.settings.settings") as mock_settings:+ mock_settings.status_checker_enabled = enabled+ mock_settings.status_checker_interval = 60+ mock_settings.service_check_enabled = True+ mock_settings.service_check_interval = 300+ res = await client.get("/api/v1/settings", headers=headers)+ assert res.status_code == 200+ assert res.json()["status_checker_enabled"] is enabled+++async def test_update_settings_cannot_change_the_env_only_switch(client: AsyncClient, headers):+ """STATUS_CHECKER_ENABLED is env-only: a POST carrying the field neither+ persists it nor echoes it back as changed."""+ with patch("app.api.routes.settings.settings") as mock_settings, \+ patch("app.api.routes.settings.reschedule_status_checks"), \+ patch("app.api.routes.settings.set_service_checks_enabled"):+ mock_settings.status_checker_enabled = False+ mock_settings.save_overrides = lambda: None+ res = await client.post(+ "/api/v1/settings",+ json={"interval_seconds": 60, "service_check_enabled": False,+ "service_check_interval": 300, "status_checker_enabled": True},+ headers=headers,+ )+ assert mock_settings.status_checker_enabled is False+ assert res.status_code == 200+ assert res.json()["status_checker_enabled"] is Falsediff --git a/frontend/src/api/client.ts b/frontend/src/api/client.tsindex 5ccd58c..4b88fc4 100644--- a/frontend/src/api/client.ts+++ b/frontend/src/api/client.ts@@ -260,9 +260,15 @@ export interface AppSettings {service_check_interval: number}+/** What the server returns: the editable settings plus the env-only+ * STATUS_CHECKER_ENABLED switch (absent on older backends = enabled). */+export interface AppSettingsResponse extends AppSettings {+ status_checker_enabled?: boolean+}+export const settingsApi = {- get: () => api.get<AppSettings>('/settings'),- save: (data: AppSettings) => api.post<AppSettings>('/settings', data),+ get: () => api.get<AppSettingsResponse>('/settings'),+ save: (data: AppSettings) => api.post<AppSettingsResponse>('/settings', data),}export interface ProxmoxConnection {diff --git a/frontend/src/components/modals/SettingsModal.tsx b/frontend/src/components/modals/SettingsModal.tsxindex f858070..be26825 100644--- a/frontend/src/components/modals/SettingsModal.tsx+++ b/frontend/src/components/modals/SettingsModal.tsx@@ -134,6 +134,9 @@ export function SettingsModal({ open, onClose }: SettingsModalProps) {const [interval, setIntervalValue] = useState(60)const [serviceCheckEnabled, setServiceCheckEnabled] = useState(false)const [serviceInterval, setServiceInterval] = useState(300)+ // STATUS_CHECKER_ENABLED=false on the server: no check job runs, so the+ // controls below would change nothing until it is switched back on.+ const [checkerEnabled, setCheckerEnabled] = useState(true)const [saving, setSaving] = useState(false)const [pmConfig, setPmConfig] = useState<ProxmoxConfigData | null>(null)const [pmSyncEnabled, setPmSyncEnabled] = useState(false)@@ -173,6 +176,7 @@ export function SettingsModal({ open, onClose }: SettingsModalProps) {setIntervalValue(res.data.interval_seconds)setServiceCheckEnabled(res.data.service_check_enabled)setServiceInterval(res.data.service_check_interval)+ setCheckerEnabled(res.data.status_checker_enabled !== false)}).catch(() => {/* use default */})proxmoxApi.getConfig()@@ -344,11 +348,19 @@ export function SettingsModal({ open, onClose }: SettingsModalProps) {{!STANDALONE && (<div className="space-y-1.5"><label className="text-xs text-muted-foreground">Status check interval (s)</label>- <div className="flex items-center gap-2">+ {!checkerEnabled && (+ <p className="text-[10px] text-[#e3b341] leading-tight">+ Status checks are disabled on the server (STATUS_CHECKER_ENABLED=false): nodes and+ services are not probed. These settings apply once it is switched back on.+ </p>+ )}+ <div className={checkerEnabled ? 'flex items-center gap-2' : 'flex items-center gap-2 opacity-50'}><inputtype="number"min={10}max={3600}+ disabled={!checkerEnabled}+ aria-label="Status check interval"value={interval}onChange={(e) => { const v = Number(e.target.value); if (!isNaN(v)) setIntervalValue(v) }}className="w-24 px-2 py-1 rounded-md text-xs font-mono bg-[#0d1117] border border-border text-foreground focus:outline-none focus:border-[#00d4ff]"@@ -364,19 +376,21 @@ export function SettingsModal({ open, onClose }: SettingsModalProps) {<inputtype="checkbox"checked={serviceCheckEnabled}+ disabled={!checkerEnabled}onChange={(e) => setServiceCheckEnabled(e.target.checked)}className="cursor-pointer accent-[#00d4ff]"aria-label="Toggle per-service status checks"/></label>- <div className={serviceCheckEnabled ? 'space-y-1.5' : 'space-y-1.5 opacity-50 pointer-events-none'}>+ <div className={serviceCheckEnabled && checkerEnabled ? 'space-y-1.5' : 'space-y-1.5 opacity-50 pointer-events-none'}><label className="text-xs text-muted-foreground">Service check interval (s)</label><div className="flex items-center gap-2"><inputtype="number"min={30}max={3600}+ disabled={!checkerEnabled}value={serviceInterval}onChange={(e) => { const v = Number(e.target.value); if (!isNaN(v)) setServiceInterval(v) }}className="w-24 px-2 py-1 rounded-md text-xs font-mono bg-[#0d1117] border border-border text-foreground focus:outline-none focus:border-[#00d4ff]"diff --git a/frontend/src/components/modals/__tests__/SettingsModal.test.tsx b/frontend/src/components/modals/__tests__/SettingsModal.test.tsxindex 8e4361f..95cac55 100644--- a/frontend/src/components/modals/__tests__/SettingsModal.test.tsx+++ b/frontend/src/components/modals/__tests__/SettingsModal.test.tsx@@ -132,6 +132,25 @@ describe('SettingsModal', () => {})})+ it('shows that status checks are off server-side and disables their controls', async () => {+ vi.mocked(settingsApi.get).mockResolvedValue({ data: { interval_seconds: 60, service_check_enabled: true, service_check_interval: 300, status_checker_enabled: false } } as never)+ render(<SettingsModal open onClose={vi.fn()} />)+ expect(await screen.findByText(/STATUS_CHECKER_ENABLED=false/)).toBeDefined()+ expect((screen.getByLabelText('Status check interval') as HTMLInputElement).disabled).toBe(true)+ expect((screen.getByLabelText('Toggle per-service status checks') as HTMLInputElement).disabled).toBe(true)+ expect((screen.getByLabelText('Service check interval') as HTMLInputElement).disabled).toBe(true)+ })++ it('leaves the check controls enabled when the server runs status checks', async () => {+ vi.mocked(settingsApi.get).mockResolvedValue({ data: { interval_seconds: 60, service_check_enabled: true, service_check_interval: 300, status_checker_enabled: true } } as never)+ render(<SettingsModal open onClose={vi.fn()} />)+ await waitFor(() => expect(settingsApi.get).toHaveBeenCalledOnce())+ await screen.findByDisplayValue('300')+ expect(screen.queryByText(/STATUS_CHECKER_ENABLED=false/)).toBeNull()+ expect((screen.getByLabelText('Status check interval') as HTMLInputElement).disabled).toBe(false)+ expect((screen.getByLabelText('Toggle per-service status checks') as HTMLInputElement).disabled).toBe(false)+ })+it('persists only sync fields (not connection config) on Save', async () => {vi.mocked(proxmoxApi.getConfig).mockResolvedValue({data: { host: 'pve', port: 8006, verify_tls: true, sync_enabled: true, sync_interval: 3600, token_configured: true },