diff --git a/apps/operator/pages/index.vue b/apps/operator/pages/index.vue index 65b6701..00d7b79 100644 --- a/apps/operator/pages/index.vue +++ b/apps/operator/pages/index.vue @@ -3,7 +3,6 @@ import type { Tenant } from '~/types/tenant' import type { Partner } from '~/types/partner' import type { PlatformUser } from '~/types/user' import type { AuditEvent } from '~/types/audit' -import { SERVICES, INCIDENT } from '~/data/fixtures' const { data: tenants, pending: tp, refresh: rT } = await useFetch('/api/tenants', { default: () => [] }) const { data: partners, pending: pp, refresh: rP } = await useFetch('/api/partners', { default: () => [] }) @@ -13,19 +12,30 @@ const { data: auditEvents, refresh: rA } = await useFetch('/api/au query: { limit: 8 }, }) +// Real service health from platform-api probes (same source as the +// infrastructure page) — replaces the old SERVICES/INCIDENT fixtures. +interface ProbeResult { + id: string + name: string + status: 'ok' | 'warn' | 'bad' +} +const { data: probes, refresh: rH } = await useFetch('/api/health/platform', { + default: () => [], +}) + function fmtClock(iso: string) { return new Date(iso).toLocaleTimeString('da-DK', { hour: '2-digit', minute: '2-digit' }) } -const { open: openIncident } = useIncidentModal() - const pending = computed(() => tp.value || pp.value || up.value) async function refresh() { - await Promise.all([rT(), rP(), rU(), rA()]) + await Promise.all([rT(), rP(), rU(), rA(), rH()]) } -const degradedCount = computed(() => SERVICES.filter((s) => s.status !== 'ok').length) +const totalServices = computed(() => (probes.value ?? []).length) +const degradedServices = computed(() => (probes.value ?? []).filter((p) => p.status !== 'ok')) +const degradedCount = computed(() => degradedServices.value.length) const incidentActive = computed(() => degradedCount.value > 0) const stats = computed(() => ({ @@ -74,18 +84,18 @@ function fmtDate(d: string) {
- +
@@ -102,7 +112,7 @@ function fmtDate(d: string) { label="Services" :value="incidentActive ? `${degradedCount} degraded` : 'all green'" :delta-tone="incidentActive ? 'down' : 'up'" - :hint="incidentActive ? 'P2 · authentik' : `${SERVICES.length} / ${SERVICES.length} healthy`" + :hint="`${totalServices - degradedCount} / ${totalServices} healthy`" />
@@ -249,6 +259,7 @@ function fmtDate(d: string) { cursor: pointer; color: var(--text); font-family: inherit; + text-decoration: none; } .pill { display: inline-flex; diff --git a/apps/operator/pages/infrastructure.vue b/apps/operator/pages/infrastructure.vue index 0db9afa..17be489 100644 --- a/apps/operator/pages/infrastructure.vue +++ b/apps/operator/pages/infrastructure.vue @@ -1,5 +1,5 @@