diff --git a/client/src/components/common/HistogramResponseTime.tsx b/client/src/components/common/HistogramResponseTime.tsx index 69c2e99b1..83526fe5c 100644 --- a/client/src/components/common/HistogramResponseTime.tsx +++ b/client/src/components/common/HistogramResponseTime.tsx @@ -7,7 +7,7 @@ import { HeatmapResponseTimeTooltip } from "./HeatmapResponseTimeTooltip"; interface HistogramResponseTimeProps { checks: ICheck[]; - height?: number | string; + height?: ResponsiveStyleValue; gap?: ResponsiveStyleValue; } diff --git a/client/src/components/status-pages/StatusPageRow.tsx b/client/src/components/status-pages/StatusPageRow.tsx index cddef6181..945c4f53c 100644 --- a/client/src/components/status-pages/StatusPageRow.tsx +++ b/client/src/components/status-pages/StatusPageRow.tsx @@ -1,13 +1,16 @@ import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import { HeatmapResponseTime } from "../common/HeatmapResponseTime"; +import { HistogramResponseTime } from "../common/HistogramResponseTime"; import { StatusLabel } from "@/components/design-elements"; -import { useTheme } from "@mui/material/styles"; +import { useTheme } from "@mui/material/styles"; +import { useAppSelector } from "@/hooks/AppHooks"; import type { IMonitor } from "@/types/monitor"; export const StatusPageRow = ({ monitor }: { monitor: IMonitor }) => { const theme = useTheme(); + const type = useAppSelector((state) => state?.ui?.chartType || "heatmap"); return ( @@ -23,22 +26,31 @@ export const StatusPageRow = ({ monitor }: { monitor: IMonitor }) => { - + {type === "heatmap" && ( + + )} + {type === "histogram" && ( + + )} ); diff --git a/client/src/pages/settings/Settings.tsx b/client/src/pages/settings/Settings.tsx index db6c51968..62ec7de3d 100644 --- a/client/src/pages/settings/Settings.tsx +++ b/client/src/pages/settings/Settings.tsx @@ -1,6 +1,7 @@ import Stack from "@mui/material/Stack"; import { BasePage, ConfigBox } from "@/components/design-elements"; import { AutoComplete, Select, LanguageSelector } from "@/components/inputs"; +import { RadioWithDescription } from "@/components/inputs/RadioInput"; import MenuItem from "@mui/material/MenuItem"; import Typography from "@mui/material/Typography"; import { SettingsForm } from "@/pages/settings/SettingsForm"; @@ -100,22 +101,26 @@ const SettingsPage = () => { subtitle="Choose what type of Uptime chart you want to see on the dashboard and status page" leftContent={} rightContent={ - + Chart Type - - - {chartType === "heatmap" - ? "Heatmap: colored line indicates status" - : "Bar chart: color denotes status (up/down). height denotes response time"} - + + dispatch(setChartType("heatmap"))} + value="heatmap" + label="Heatmap" + description="Compact tiles; color shows response speed, top strip shows availability." + name="chart-type" + /> + dispatch(setChartType("histogram"))} + value="histogram" + label="Histogram" + description="One bar per check; height shows response time, color shows status." + name="chart-type" + /> + } /> diff --git a/client/src/pages/status-page/StatusPageDetails.tsx b/client/src/pages/status-page/StatusPageDetails.tsx index 133395fa4..8f7281a79 100644 --- a/client/src/pages/status-page/StatusPageDetails.tsx +++ b/client/src/pages/status-page/StatusPageDetails.tsx @@ -10,6 +10,7 @@ import type { ApiResponse } from "@/hooks/UseApi"; import { useParams } from "react-router"; import type { IStatusPageWithMonitors } from "@/types/status-page"; import { NameHeader } from "@/components/status-pages/NameHeader"; + const GLOBAL_REFRESH = import.meta.env.VITE_APP_GLOBAL_REFRESH; const StatusPages = () => { const theme = useTheme(); diff --git a/client/src/pages/uptime/MonitorTable.tsx b/client/src/pages/uptime/MonitorTable.tsx index 9ebf526ee..6fdb8618b 100644 --- a/client/src/pages/uptime/MonitorTable.tsx +++ b/client/src/pages/uptime/MonitorTable.tsx @@ -8,6 +8,7 @@ import type { Header } from "@/components/design-elements/Table"; import { ActionsMenu } from "@/components/actions-menu"; import { ArrowDown, ArrowUp } from "lucide-react"; +import { useAppSelector } from "@/hooks/AppHooks"; import { useTranslation } from "react-i18next"; import { useTheme } from "@mui/material/styles"; import { useNavigate } from "react-router-dom"; @@ -139,6 +140,9 @@ export const MonitorTable = ({ }; const getHeaders = () => { + const chartType = useAppSelector( + (state) => state?.ui?.chartType || "heatmap" + ); const renderSortIcon = (isActive: boolean) => ( {isActive ? ( @@ -193,7 +197,11 @@ export const MonitorTable = ({ id: "histogram", content: t("responseTime"), render: (row) => { - return ; + if (chartType === "histogram") { + return ; + } else { + return ; + } }, }, {