feat(api, web): enhance health check and domain management features
Build, Test, and Push CFDM Docker Image / test (push) Successful in 3m3s
Build, Test, and Push CFDM Docker Image / build-and-push (push) Successful in 1m48s
Build, Test, and Push CFDM Docker Image / update-wiki (push) Successful in 6s
Build, Test, and Push CFDM Docker Image / create-release (push) Has been skipped
Build, Test, and Push CFDM Docker Image / test (push) Successful in 3m3s
Build, Test, and Push CFDM Docker Image / build-and-push (push) Successful in 1m48s
Build, Test, and Push CFDM Docker Image / update-wiki (push) Successful in 6s
Build, Test, and Push CFDM Docker Image / create-release (push) Has been skipped
- Integrated domain monitoring routes and bulk update functionality for domains in the API. - Improved health check service to include domain monitoring and logging of health status changes. - Updated web components to reflect health status with new HealthCheckBadge and enhanced domain filtering options. - Refactored domain service to support bulk updates and improved domain management capabilities. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
dd167a4fec
commit
64585ccd47
38 files changed
+4199
-677
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { useQueries } from '@tanstack/react-query'
|
||||
import { useMemo } from 'react'
|
||||
import { healthStatusQueryOptions } from '@/queries'
|
||||
import type { IpHealthStatus, ServiceBinding } from '@/lib/schemas'
|
||||
|
||||
/** Map IP → worst health status across enabled bindings. */
|
||||
export function useDomainHealthByIp(bindings: ServiceBinding[] | undefined) {
|
||||
const enabledBindings = useMemo(
|
||||
() => (bindings ?? []).filter((b) => b.health_check_enabled),
|
||||
[bindings],
|
||||
)
|
||||
|
||||
const queries = useQueries({
|
||||
queries: enabledBindings.map((b) => ({
|
||||
...healthStatusQueryOptions('binding', b.id),
|
||||
})),
|
||||
})
|
||||
|
||||
return useMemo(() => {
|
||||
const map: Record<string, IpHealthStatus> = {}
|
||||
const rank = { up: 0, unknown: 1, degraded: 2, down: 3 } as const
|
||||
for (const q of queries) {
|
||||
for (const row of q.data ?? []) {
|
||||
const prev = map[row.ip]
|
||||
if (!prev || rank[row.status] > rank[prev.status]) {
|
||||
map[row.ip] = row
|
||||
}
|
||||
}
|
||||
}
|
||||
return map
|
||||
}, [queries])
|
||||
}
|
||||
Reference in new issue
Block a user