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
13 changes: 11 additions & 2 deletions private-web/src/components/StatusSnapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import CancelIcon from "@mui/icons-material/Cancel";
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
import CloseIcon from "@mui/icons-material/Close";
import PreviewIcon from "@mui/icons-material/Preview";
import WarningAmberIcon from "@mui/icons-material/WarningAmber";
import { Fragment } from "react";
import { useApi, type ApiState } from "../api";
import TimeAgo from "./TimeAgo";
Expand Down Expand Up @@ -107,7 +108,7 @@ function PanelBody({
return (
<Stack spacing={2}>
<CuratedFields snap={snap} />
<ChecksBlock health={snap.health} />
<ChecksBlock health={snap.health} overallHealthy={snap.healthy} />
<ExtrasBlock extra={snap.extra} />
</Stack>
);
Expand Down Expand Up @@ -165,7 +166,13 @@ function Field({
);
}

function ChecksBlock({ health }: { health: StatusSnapshotData["health"] }) {
function ChecksBlock({
health,
overallHealthy,
}: {
health: StatusSnapshotData["health"];
overallHealthy: boolean;
}) {
const entries = parseChecks(health);
if (entries.length === 0) return null;
return (
Expand All @@ -190,6 +197,8 @@ function ChecksBlock({ health }: { health: StatusSnapshotData["health"] }) {
>
{entry.healthy ? (
<CheckCircleIcon fontSize="small" color="success" />
) : overallHealthy ? (
<WarningAmberIcon fontSize="small" color="warning" />
) : (
<CancelIcon fontSize="small" color="error" />
)}
Expand Down
29 changes: 25 additions & 4 deletions private-web/src/routes/ServerDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import CheckCircleIcon from "@mui/icons-material/CheckCircle";
import CancelIcon from "@mui/icons-material/Cancel";
import EditIcon from "@mui/icons-material/Edit";
import LanguageIcon from "@mui/icons-material/Language";
import WarningAmberIcon from "@mui/icons-material/WarningAmber";
import { Fragment, useEffect, useState } from "react";
import { Link as RouterLink, useParams } from "react-router-dom";
import IncidentsLink from "../components/IncidentsLink";
Expand Down Expand Up @@ -489,7 +490,9 @@ function InfoSection({
/>
)}
</Stack>
{status && <ChecksTable health={status.health} />}
{status && (
<ChecksTable health={status.health} overallHealthy={status.healthy} />
)}
{status && Object.keys((status.extra ?? {}) as Record<string, unknown>).length > 0 && (
<Box sx={{ mt: 2 }}>
<details>
Expand Down Expand Up @@ -536,7 +539,13 @@ function HealthIndicator({ healthy }: { healthy: boolean }) {
* so a server reporting 30 checks doesn't push the rest of the page
* off-screen. Render nothing when the server doesn't ship per-check
* data (legacy / minimal payloads). */
function ChecksTable({ health }: { health: ServerLastStatusData["health"] }) {
function ChecksTable({
health,
overallHealthy,
}: {
health: ServerLastStatusData["health"];
overallHealthy: boolean;
}) {
const entries = parseChecks(health);
const [expanded, setExpanded] = useState(false);
if (entries.length === 0) return null;
Expand All @@ -550,7 +559,11 @@ function ChecksTable({ health }: { health: ServerLastStatusData["health"] }) {
</Typography>
<Stack spacing={1} sx={{ mt: 0.5 }}>
{visible.map((entry) => (
<CheckRow key={entry.check} entry={entry} />
<CheckRow
key={entry.check}
entry={entry}
overallHealthy={overallHealthy}
/>
))}
</Stack>
{hidden > 0 && (
Expand Down Expand Up @@ -606,7 +619,13 @@ function parseChecks(health: ServerLastStatusData["health"]): ParsedCheck[] {
return parsed;
}

function CheckRow({ entry }: { entry: ParsedCheck }) {
function CheckRow({
entry,
overallHealthy,
}: {
entry: ParsedCheck;
overallHealthy: boolean;
}) {
return (
<Stack
direction="row"
Expand All @@ -622,6 +641,8 @@ function CheckRow({ entry }: { entry: ParsedCheck }) {
>
{entry.healthy ? (
<CheckCircleIcon fontSize="small" color="success" />
) : overallHealthy ? (
<WarningAmberIcon fontSize="small" color="warning" />
) : (
<CancelIcon fontSize="small" color="error" />
)}
Expand Down