Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions app/(dashboard)/_components/performance-infrastructure-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardDescription, CardHeader } from "@/components/ui/card"
import type { RunningStatusTopology } from "@/lib/performance-data"

function HealthMetric({ label, value, unavailableLabel }: { label: string; value?: number; unavailableLabel: string }) {
return (
Expand All @@ -21,6 +22,7 @@ export function PerformanceInfrastructureCard({
onlineDisks,
offlineDisks,
unknownDisks,
topology,
t,
}: {
onlineServers?: number
Expand All @@ -31,6 +33,7 @@ export function PerformanceInfrastructureCard({
onlineDisks?: number
offlineDisks?: number
unknownDisks?: number
topology: RunningStatusTopology
t: (key: string) => string
}) {
const needsAttention = Boolean((offlineServers ?? 0) + (degradedServers ?? 0) + (offlineDisks ?? 0))
Expand All @@ -42,16 +45,19 @@ export function PerformanceInfrastructureCard({
diskCounts.some((value) => value === undefined) ||
serverCounts.reduce<number>((total, value) => total + (value ?? 0), 0) === 0 ||
diskCounts.reduce<number>((total, value) => total + (value ?? 0), 0) === 0
const hasIncompleteTopology = topology.incomplete
const status = needsAttention
? t("Needs attention")
: hasUnknownState || dataUnavailable
: hasUnknownState || dataUnavailable || hasIncompleteTopology
? t("Unknown")
: t("Healthy")
const description = needsAttention
? t("Offline or degraded resources require attention.")
: hasUnknownState || dataUnavailable
? t("Some resource health data is unavailable or still initializing.")
: t("All reported servers and disks are online.")
: hasIncompleteTopology
? t("The reported health rows do not cover the full cluster topology.")
: hasUnknownState || dataUnavailable
? t("Some resource health data is unavailable or still initializing.")
: t("All reported servers and disks are online.")

return (
<Card className="h-full shadow-none">
Expand All @@ -64,7 +70,13 @@ export function PerformanceInfrastructureCard({
<CardDescription>{description}</CardDescription>
</div>
<Badge
variant={needsAttention ? "destructive" : hasUnknownState || dataUnavailable ? "outline" : "secondary"}
variant={
needsAttention
? "destructive"
: hasUnknownState || dataUnavailable || hasIncompleteTopology
? "outline"
: "secondary"
}
aria-live="polite"
>
{status}
Expand Down Expand Up @@ -94,6 +106,12 @@ export function PerformanceInfrastructureCard({
<HealthMetric label={t("Unknown")} value={unknownServers} unavailableLabel={t("Unavailable")} />
) : null}
</dl>
{topology.expectedServers !== undefined ? (
<p className="mt-3 text-xs text-muted-foreground tabular-nums">
{t("Reported")}: {topology.reportedServers ?? t("Unavailable")} · {t("Expected")}:{" "}
{topology.expectedServers}
</p>
) : null}
</section>
<section aria-labelledby="disk-health-title">
<h3 id="disk-health-title" className="text-sm font-medium text-muted-foreground">
Expand All @@ -105,7 +123,20 @@ export function PerformanceInfrastructureCard({
{unknownDisks ? (
<HealthMetric label={t("Unknown")} value={unknownDisks} unavailableLabel={t("Unavailable")} />
) : null}
{topology.unreportedDrives ? (
<HealthMetric
label={t("Unreported")}
value={topology.unreportedDrives}
unavailableLabel={t("Unavailable")}
/>
) : null}
</dl>
{topology.expectedDrives !== undefined ? (
<p className="mt-3 text-xs text-muted-foreground tabular-nums">
{t("Reported")}: {topology.reportedDrives ?? t("Unavailable")} · {t("Expected")}:{" "}
{topology.expectedDrives}
</p>
) : null}
</section>
</div>
</CardContent>
Expand Down
24 changes: 22 additions & 2 deletions app/(dashboard)/_components/performance-server-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import { Card, CardContent, CardDescription, CardHeader } from "@/components/ui/
import { Progress } from "@/components/ui/progress"
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { niceBytes } from "@/lib/functions"
import { resolveServerHealth, type ClusterDiagnostics, type ServerHealthState } from "@/lib/performance-data"
import {
resolveServerHealth,
type ClusterDiagnostics,
type RunningStatusTopology,
type ServerHealthState,
} from "@/lib/performance-data"
import { cn } from "@/lib/utils"
import type { ServerInfo } from "@/hooks/use-performance-data"

Expand Down Expand Up @@ -117,10 +122,12 @@ const filterOrder: ServerHealthState[] = ["offline", "degraded", "initializing",
export function PerformanceServerList({
servers,
diagnostics,
topology,
t,
}: {
servers?: ServerInfo[]
diagnostics?: ClusterDiagnostics
topology: RunningStatusTopology
t: Translate
}) {
const [sortBy, setSortBy] = React.useState<PerformanceServerSort>("attention")
Expand Down Expand Up @@ -191,7 +198,20 @@ export function PerformanceServerList({
</div>
{servers !== undefined ? (
<span className="text-sm text-muted-foreground" role="status" aria-live="polite">
{t("Total")}: {visibleServers.length}/{reportedServers.length}
{topology.expectedServers !== undefined ? (
<>
{t("Total")}: {visibleServers.length}/{topology.expectedServers} · {t("Reported")}:{" "}
{topology.reportedServers ?? t("Unavailable")}
</>
) : topology.incomplete ? (
<>
{t("Reported")}: {topology.reportedServers ?? reportedServers.length}
</>
) : (
<>
{t("Total")}: {visibleServers.length}/{reportedServers.length}
</>
)}
</span>
) : null}
</div>
Expand Down
17 changes: 12 additions & 5 deletions app/(dashboard)/status/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button"
import { Spinner } from "@/components/ui/spinner"
import { usePerformanceData, type PerformanceDataSource } from "@/hooks/use-performance-data"
import { usePermissions } from "@/hooks/use-permissions"
import { formatRelativeTime, resolveUsageFreshness, summarizeServerStates } from "@/lib/performance-data"
import { buildRunningStatusView, formatRelativeTime, resolveUsageFreshness } from "@/lib/performance-data"
import { cn } from "@/lib/utils"
import {
RiArchiveDrawerFill,
Expand Down Expand Up @@ -130,10 +130,11 @@ export default function PerformancePage() {
[i18n.resolvedLanguage, metricsUpdatedAt, scannerCompletedAt, scannerDuration, scannerStatus, t],
)

const serverSummary = useMemo(
() => (systemInfo.servers ? summarizeServerStates(systemInfo.servers, diagnosticsInfo) : undefined),
[diagnosticsInfo, systemInfo.servers],
const runningStatus = useMemo(
() => buildRunningStatusView(systemInfo, diagnosticsInfo),
[diagnosticsInfo, systemInfo],
)
const serverSummary = runningStatus.serverSummary

const usageFreshness = useMemo(
() =>
Expand Down Expand Up @@ -275,6 +276,7 @@ export default function PerformancePage() {
onlineDisks={systemInfo.backend?.onlineDisks}
offlineDisks={systemInfo.backend?.offlineDisks}
unknownDisks={systemInfo.backend?.unknownDisks}
topology={runningStatus.topology}
t={t}
/>
</div>
Expand All @@ -291,7 +293,12 @@ export default function PerformancePage() {
</div>

<div className="order-2 xl:order-3 xl:col-span-2">
<PerformanceServerList servers={systemInfo.servers} diagnostics={diagnosticsInfo} t={t} />
<PerformanceServerList
servers={runningStatus.servers}
diagnostics={diagnosticsInfo}
topology={runningStatus.topology}
t={t}
/>
</div>
</div>

Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/ar-MA.json
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,10 @@
"Clear Decommission": "Clear Decommission",
"All": "الكل",
"All reported servers and disks are online.": "جميع الخوادم والأقراص المبلّغ عنها متصلة.",
"Expected": "المتوقع",
"Reported": "المبلّغ عنه",
"Unreported": "غير مبلّغ عنه",
"The reported health rows do not cover the full cluster topology.": "لا تغطي حالات الصحة المبلّغ عنها مخطط المجموعة بالكامل.",
"Check your connection, then refresh the status page.": "تحقق من اتصالك، ثم حدّث صفحة الحالة.",
"Cluster Health": "صحة المجموعة",
"Cluster information": "معلومات المجموعة",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Clear Decommission",
"All": "Alle",
"All reported servers and disks are online.": "Alle gemeldeten Server und Laufwerke sind online.",
"Expected": "Erwartet",
"Reported": "Gemeldet",
"Unreported": "Nicht gemeldet",
"The reported health rows do not cover the full cluster topology.": "Die gemeldeten Integritätsdaten decken nicht die vollständige Clustertopologie ab.",
"Check your connection, then refresh the status page.": "Prüfen Sie Ihre Verbindung und aktualisieren Sie dann die Statusseite.",
"Cluster Health": "Clusterzustand",
"Cluster information": "Clusterinformationen",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Clear Decommission",
"All": "All",
"All reported servers and disks are online.": "All reported servers and disks are online.",
"Expected": "Expected",
"Reported": "Reported",
"Unreported": "Unreported",
"The reported health rows do not cover the full cluster topology.": "The reported health rows do not cover the full cluster topology.",
"Check your connection, then refresh the status page.": "Check your connection, then refresh the status page.",
"Cluster Health": "Cluster Health",
"Cluster information": "Cluster information",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Clear Decommission",
"All": "Todos",
"All reported servers and disks are online.": "Todos los servidores y discos informados están en línea.",
"Expected": "Esperado",
"Reported": "Informado",
"Unreported": "No informado",
"The reported health rows do not cover the full cluster topology.": "Los estados de salud informados no cubren toda la topología del clúster.",
"Check your connection, then refresh the status page.": "Comprueba la conexión y actualiza la página de estado.",
"Cluster Health": "Estado del clúster",
"Cluster information": "Información del clúster",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Clear Decommission",
"All": "Tous",
"All reported servers and disks are online.": "Tous les serveurs et disques signalés sont en ligne.",
"Expected": "Attendu",
"Reported": "Signalé",
"Unreported": "Non signalé",
"The reported health rows do not cover the full cluster topology.": "Les états de santé signalés ne couvrent pas toute la topologie du cluster.",
"Check your connection, then refresh the status page.": "Vérifiez votre connexion, puis actualisez la page d’état.",
"Cluster Health": "État du cluster",
"Cluster information": "Informations sur le cluster",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/id-ID.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Clear Decommission",
"All": "Semua",
"All reported servers and disks are online.": "Semua server dan disk yang dilaporkan sedang online.",
"Expected": "Diharapkan",
"Reported": "Dilaporkan",
"Unreported": "Tidak dilaporkan",
"The reported health rows do not cover the full cluster topology.": "Baris kesehatan yang dilaporkan tidak mencakup seluruh topologi klaster.",
"Check your connection, then refresh the status page.": "Periksa koneksi, lalu muat ulang halaman status.",
"Cluster Health": "Kesehatan klaster",
"Cluster information": "Informasi klaster",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Clear Decommission",
"All": "Tutti",
"All reported servers and disks are online.": "Tutti i server e le unità segnalati sono online.",
"Expected": "Previsto",
"Reported": "Segnalato",
"Unreported": "Non segnalato",
"The reported health rows do not cover the full cluster topology.": "Gli stati di integrità segnalati non coprono l'intera topologia del cluster.",
"Check your connection, then refresh the status page.": "Controlla la connessione, quindi aggiorna la pagina di stato.",
"Cluster Health": "Stato del cluster",
"Cluster information": "Informazioni sul cluster",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,10 @@
"Clear Decommission": "Clear Decommission",
"All": "すべて",
"All reported servers and disks are online.": "報告されたすべてのサーバーとディスクはオンラインです。",
"Expected": "想定",
"Reported": "報告済み",
"Unreported": "未報告",
"The reported health rows do not cover the full cluster topology.": "報告されたヘルス情報はクラスター全体のトポロジーをカバーしていません。",
"Check your connection, then refresh the status page.": "接続を確認して、ステータスページを更新してください。",
"Cluster Health": "クラスターの状態",
"Cluster information": "クラスター情報",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,10 @@
"Clear Decommission": "Clear Decommission",
"All": "전체",
"All reported servers and disks are online.": "보고된 모든 서버와 디스크가 온라인 상태입니다.",
"Expected": "예상",
"Reported": "보고됨",
"Unreported": "보고되지 않음",
"The reported health rows do not cover the full cluster topology.": "보고된 상태 정보가 전체 클러스터 토폴로지를 포함하지 않습니다.",
"Check your connection, then refresh the status page.": "연결을 확인한 후 상태 페이지를 새로고침하세요.",
"Cluster Health": "클러스터 상태",
"Cluster information": "클러스터 정보",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Clear Decommission",
"All": "Todos",
"All reported servers and disks are online.": "Todos os servidores e discos reportados estão online.",
"Expected": "Esperado",
"Reported": "Reportado",
"Unreported": "Não reportado",
"The reported health rows do not cover the full cluster topology.": "Os estados de integridade reportados não cobrem toda a topologia do cluster.",
"Check your connection, then refresh the status page.": "Verifique sua conexão e atualize a página de status.",
"Cluster Health": "Integridade do cluster",
"Cluster information": "Informações do cluster",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Очистить декомиссию",
"All": "Все",
"All reported servers and disks are online.": "Все указанные серверы и диски доступны.",
"Expected": "Ожидается",
"Reported": "Сообщено",
"Unreported": "Не сообщено",
"The reported health rows do not cover the full cluster topology.": "Полученные данные о состоянии не охватывают полную топологию кластера.",
"Check your connection, then refresh the status page.": "Проверьте подключение и обновите страницу состояния.",
"Cluster Health": "Состояние кластера",
"Cluster information": "Сведения о кластере",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/tr-TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Clear Decommission",
"All": "Tümü",
"All reported servers and disks are online.": "Bildirilen tüm sunucu ve diskler çevrimiçi.",
"Expected": "Beklenen",
"Reported": "Bildirilen",
"Unreported": "Bildirilmemiş",
"The reported health rows do not cover the full cluster topology.": "Bildirilen sağlık satırları küme topolojisinin tamamını kapsamıyor.",
"Check your connection, then refresh the status page.": "Bağlantınızı kontrol edip durum sayfasını yenileyin.",
"Cluster Health": "Küme durumu",
"Cluster information": "Küme bilgileri",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@
"Clear Decommission": "Clear Decommission",
"All": "Tất cả",
"All reported servers and disks are online.": "Tất cả máy chủ và ổ đĩa được báo cáo đều đang trực tuyến.",
"Expected": "Dự kiến",
"Reported": "Đã báo cáo",
"Unreported": "Chưa báo cáo",
"The reported health rows do not cover the full cluster topology.": "Các trạng thái sức khỏe được báo cáo chưa bao phủ toàn bộ cấu trúc liên kết cụm.",
"Check your connection, then refresh the status page.": "Kiểm tra kết nối, sau đó làm mới trang trạng thái.",
"Cluster Health": "Tình trạng cụm",
"Cluster information": "Thông tin cụm",
Expand Down
4 changes: 4 additions & 0 deletions i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,10 @@
"Clear Decommission": "清理退役",
"All": "全部",
"All reported servers and disks are online.": "已上报的服务器和磁盘均在线。",
"Expected": "预期",
"Reported": "已上报",
"Unreported": "未上报",
"The reported health rows do not cover the full cluster topology.": "已上报的健康状态未覆盖完整的集群拓扑。",
"Check your connection, then refresh the status page.": "请检查连接,然后刷新状态页。",
"Cluster Health": "集群健康状态",
"Cluster information": "集群信息",
Expand Down
Loading