feat: per-service status checks with offline colouring
Adds optional live status checking per service (not just per node), requested as a follow-up to issue #196. Backend: - New check_service / check_services: HTTP(S) GET for web services, TCP connect otherwise; UDP and port-less non-web services stay 'unknown'. - New scheduler job 'service_checks', independent interval (default 300s), added/removed live via set_service_checks_enabled. - Settings gain service_check_enabled + service_check_interval (>=30s), persisted to scan_config.json. New WS message type 'service_status'. Frontend: - Live per-service status overlay in canvasStore (not persisted, so it never round-trips through canvas save), fed by the WS message. - DetailPanel + canvas node service rows: offline service turns red (#f85149), otherwise keeps its category colour. - SettingsModal: toggle + interval input (default 300s / 5 min). Off by default — no behaviour change until enabled. ha-relevant: yes
This commit is contained in:
@@ -204,8 +204,8 @@ describe('api/client', () => {
|
||||
it('settingsApi get/save', () => {
|
||||
mod.settingsApi.get()
|
||||
expect(api.get).toHaveBeenCalledWith('/settings')
|
||||
mod.settingsApi.save({ interval_seconds: 30 })
|
||||
expect(api.post).toHaveBeenCalledWith('/settings', { interval_seconds: 30 })
|
||||
mod.settingsApi.save({ interval_seconds: 30, service_check_enabled: true, service_check_interval: 600 })
|
||||
expect(api.post).toHaveBeenCalledWith('/settings', { interval_seconds: 30, service_check_enabled: true, service_check_interval: 600 })
|
||||
})
|
||||
|
||||
it('zigbeeApi.testConnection/importNetwork/importToPending', () => {
|
||||
|
||||
@@ -90,9 +90,15 @@ export const scanApi = {
|
||||
saveConfig: (data: { ranges: string[] }) => api.post('/scan/config', data),
|
||||
}
|
||||
|
||||
export interface AppSettings {
|
||||
interval_seconds: number
|
||||
service_check_enabled: boolean
|
||||
service_check_interval: number
|
||||
}
|
||||
|
||||
export const settingsApi = {
|
||||
get: () => api.get<{ interval_seconds: number }>('/settings'),
|
||||
save: (data: { interval_seconds: number }) => api.post<{ interval_seconds: number }>('/settings', data),
|
||||
get: () => api.get<AppSettings>('/settings'),
|
||||
save: (data: AppSettings) => api.post<AppSettings>('/settings', data),
|
||||
}
|
||||
|
||||
export const designsApi = {
|
||||
|
||||
Reference in New Issue
Block a user