diff --git a/apps/web/messages/en.json b/apps/web/messages/en.json index b0a9baa2..b2affdec 100644 --- a/apps/web/messages/en.json +++ b/apps/web/messages/en.json @@ -708,5 +708,18 @@ "entries": "entries", "empty": "No knowledge entries yet", "emptyDescription": "Entries will be auto-extracted from incidents, or you can create them manually" + }, + "monitoring": { + "healthy": "Healthy", + "warning": "Warning", + "critical": "Critical", + "goldMetrics": "GOLD METRICS", + "hostStatus": "HOST STATUS (FOUR-HOST ARCHITECTURE)", + "serviceList": "SERVICE LIST", + "serviceName": "Service", + "status": "Status", + "latency": "Latency", + "uptime": "Uptime", + "lastCheck": "Last Check" } } \ No newline at end of file diff --git a/apps/web/messages/zh-TW.json b/apps/web/messages/zh-TW.json index d6af0f7a..09d70909 100644 --- a/apps/web/messages/zh-TW.json +++ b/apps/web/messages/zh-TW.json @@ -709,5 +709,18 @@ "entries": "筆", "empty": "尚未建立任何知識條目", "emptyDescription": "知識庫將自動從 Incident 中萃取案例,你也可以手動新增" + }, + "monitoring": { + "healthy": "正常", + "warning": "警告", + "critical": "異常", + "goldMetrics": "黃金指標 (GOLD METRICS)", + "hostStatus": "主機狀態 (FOUR-HOST ARCHITECTURE)", + "serviceList": "服務清單", + "serviceName": "服務名稱", + "status": "狀態", + "latency": "延遲", + "uptime": "可用率", + "lastCheck": "最後檢查" } } \ No newline at end of file diff --git a/apps/web/src/app/[locale]/monitoring/page.tsx b/apps/web/src/app/[locale]/monitoring/page.tsx index cf2bdf38..51a83430 100644 --- a/apps/web/src/app/[locale]/monitoring/page.tsx +++ b/apps/web/src/app/[locale]/monitoring/page.tsx @@ -4,18 +4,16 @@ * Monitoring Page - 服務監控 * =========================== * 黃金指標 (Gold Metrics) + 四主機狀態 + 服務健康 - * 資料來源: - * GET /api/v1/metrics/gold - * GET /api/v1/dashboard/hosts - * GET /api/v1/dashboard (SSE 快照) * * @created 2026-04-01 ogt + * @updated 2026-04-02 Claude Code — QA 修復: i18n + useHosts + NaN */ import { useState, useEffect, useCallback, useRef } from 'react' import { useTranslations } from 'next-intl' import { AppLayout } from '@/components/layout' import { useGlobalPulseMetrics } from '@/hooks/useGlobalPulseMetrics' +import { useHosts } from '@/stores/dashboard.store' import { GlobalPulseChart } from '@/components/charts/global-pulse-chart' import { HostGrid } from '@/components/infra/host-grid' import { cn } from '@/lib/utils' @@ -74,21 +72,23 @@ const STATUS_BADGE = { // Sub-component: Health Summary // ============================================================================= -function HealthSummary({ data }: { data: DashboardResponse }) { - const total = data.total_count || 1 +function HealthSummary({ data, t }: { data: DashboardResponse; t: (key: string) => string }) { + const total = data.total_count || 0 + const pct = (count: number) => total > 0 ? `${Math.round(count / total * 100)}%` : '0%' + return (
- {t('alerts.autoRefresh', { seconds: 30 })} + {tAlerts('autoRefresh', { seconds: 30 })}
| {h} |
|---|