infra locale
This commit is contained in:
1 parent
64d1ba08f9
commit
63dd455e4a
8 files changed
+121
-45
No files matched your search
@@ -8,6 +8,7 @@ import { useTheme } from "@mui/material/styles";
|
|||||||
import { alpha } from "@mui/material/styles";
|
import { alpha } from "@mui/material/styles";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Tooltip from "@mui/material/Tooltip";
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const CenterLabel = ({ viewBox, value }: any) => {
|
const CenterLabel = ({ viewBox, value }: any) => {
|
||||||
const { cx, cy } = viewBox;
|
const { cx, cy } = viewBox;
|
||||||
@@ -21,15 +22,16 @@ const CenterLabel = ({ viewBox, value }: any) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ChartPageSpeedReport = ({ latestCheck }: { latestCheck: any }) => {
|
export const ChartPageSpeedReport = ({ latestCheck }: { latestCheck: any }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const [hoverTitle, setHoverTitle] = useState<string | null>(null);
|
const [hoverTitle, setHoverTitle] = useState<string | null>(null);
|
||||||
|
|
||||||
const LABELS: Record<string, string> = {
|
const LABELS: Record<string, string> = {
|
||||||
FCP: "First Contentful Paint",
|
FCP: t("common.charts.pageSpeed.fcp"),
|
||||||
SI: "Speed Index",
|
SI: t("common.charts.pageSpeed.si"),
|
||||||
LCP: "Largest Contentful Paint",
|
LCP: t("common.charts.pageSpeed.lcp"),
|
||||||
TBT: "Total Blocking Time",
|
TBT: t("common.charts.pageSpeed.tbt"),
|
||||||
CLS: "Cumulative Layout Shift",
|
CLS: t("common.charts.pageSpeed.cls"),
|
||||||
};
|
};
|
||||||
const metrics = [
|
const metrics = [
|
||||||
{ key: "fcp", color: alpha("#1DE9B6", 0.6), weight: 0.1 },
|
{ key: "fcp", color: alpha("#1DE9B6", 0.6), weight: 0.1 },
|
||||||
@@ -80,7 +82,7 @@ export const ChartPageSpeedReport = ({ latestCheck }: { latestCheck: any }) => {
|
|||||||
return (
|
return (
|
||||||
<BaseChart
|
<BaseChart
|
||||||
icon={<FileText size={20} strokeWidth={1.5} />}
|
icon={<FileText size={20} strokeWidth={1.5} />}
|
||||||
title="Average PageSpeed score"
|
title={t("common.charts.pageSpeed.title")}
|
||||||
>
|
>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
open={Boolean(hoverTitle)}
|
open={Boolean(hoverTitle)}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { BarChart3 } from "lucide-react";
|
|||||||
import { BaseChart } from "@/components/monitors/Chart";
|
import { BaseChart } from "@/components/monitors/Chart";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { getPageSpeedPalette } from "@/utils/MonitorUtils";
|
import { getPageSpeedPalette } from "@/utils/MonitorUtils";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ const MetricBox = ({
|
|||||||
value: number;
|
value: number;
|
||||||
weight: number;
|
weight: number;
|
||||||
}) => {
|
}) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const palette = getPageSpeedPalette(value);
|
const palette = getPageSpeedPalette(value);
|
||||||
return (
|
return (
|
||||||
@@ -32,7 +34,7 @@ const MetricBox = ({
|
|||||||
<Typography textTransform={"uppercase"}>{label}</Typography>
|
<Typography textTransform={"uppercase"}>{label}</Typography>
|
||||||
<Stack direction="row" justifyContent={"space-between"}>
|
<Stack direction="row" justifyContent={"space-between"}>
|
||||||
<Typography>{`${value}%`}</Typography>
|
<Typography>{`${value}%`}</Typography>
|
||||||
<Typography>{`Weight: ${weight}%`}</Typography>
|
<Typography>{`${t("common.charts.pageSpeed.weight")}: ${weight}%`}</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Box
|
<Box
|
||||||
@@ -53,31 +55,35 @@ export const ChartPageSpeedReportLegend = ({
|
|||||||
latestCheck: any;
|
latestCheck: any;
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<BaseChart icon={<BarChart3 size={20} strokeWidth={1.5} />} title="PageSpeed report">
|
<BaseChart
|
||||||
|
icon={<BarChart3 size={20} strokeWidth={1.5} />}
|
||||||
|
title="PageSpeed report"
|
||||||
|
>
|
||||||
<Stack gap={theme.spacing(4)}>
|
<Stack gap={theme.spacing(4)}>
|
||||||
<MetricBox
|
<MetricBox
|
||||||
label="Speed index (SI)"
|
label={t("common.charts.pageSpeed.si")}
|
||||||
value={Math.floor(latestCheck?.si * 100 || 0 * 100)}
|
value={Math.floor(latestCheck?.si * 100 || 0 * 100)}
|
||||||
weight={10}
|
weight={10}
|
||||||
/>
|
/>
|
||||||
<MetricBox
|
<MetricBox
|
||||||
label="First contentful paint (FCP)"
|
label={t("common.charts.pageSpeed.fcp")}
|
||||||
value={Math.floor(latestCheck?.fcp * 100 || 0 * 100)}
|
value={Math.floor(latestCheck?.fcp * 100 || 0 * 100)}
|
||||||
weight={10}
|
weight={10}
|
||||||
/>
|
/>
|
||||||
<MetricBox
|
<MetricBox
|
||||||
label="Cumulative layout shift (CLS)"
|
label={t("common.charts.pageSpeed.cls")}
|
||||||
value={Math.floor(latestCheck?.cls * 100 || 0 * 100)}
|
value={Math.floor(latestCheck?.cls * 100 || 0 * 100)}
|
||||||
weight={25}
|
weight={25}
|
||||||
/>
|
/>
|
||||||
<MetricBox
|
<MetricBox
|
||||||
label="Total blocking time (TBT)"
|
label={t("common.charts.pageSpeed.tbt")}
|
||||||
value={Math.floor(latestCheck?.tbt * 100 || 0 * 100)}
|
value={Math.floor(latestCheck?.tbt * 100 || 0 * 100)}
|
||||||
weight={30}
|
weight={30}
|
||||||
/>
|
/>
|
||||||
<MetricBox
|
<MetricBox
|
||||||
label="Largest contentful paint (LCP)"
|
label={t("common.charts.pageSpeed.lcp")}
|
||||||
value={Math.floor(latestCheck?.lcp * 100 || 0 * 100)}
|
value={Math.floor(latestCheck?.lcp * 100 || 0 * 100)}
|
||||||
weight={25}
|
weight={25}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ const createGradient = ({
|
|||||||
export const HistogramInfrastructure = ({
|
export const HistogramInfrastructure = ({
|
||||||
range,
|
range,
|
||||||
title,
|
title,
|
||||||
|
type,
|
||||||
idx,
|
idx,
|
||||||
checks,
|
checks,
|
||||||
xKey,
|
xKey,
|
||||||
@@ -101,6 +102,7 @@ export const HistogramInfrastructure = ({
|
|||||||
}: {
|
}: {
|
||||||
range: string;
|
range: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
type: string;
|
||||||
idx: number | null;
|
idx: number | null;
|
||||||
checks: IInfraCheck[];
|
checks: IInfraCheck[];
|
||||||
xKey: string;
|
xKey: string;
|
||||||
@@ -118,7 +120,7 @@ export const HistogramInfrastructure = ({
|
|||||||
|
|
||||||
let avgTemps: { _id: string; avg_temp: number | null }[] = [];
|
let avgTemps: { _id: string; avg_temp: number | null }[] = [];
|
||||||
let tempYDomain: number[] = [];
|
let tempYDomain: number[] = [];
|
||||||
if (title === "temp") {
|
if (type === "temp") {
|
||||||
avgTemps = checks.map((check) => {
|
avgTemps = checks.map((check) => {
|
||||||
const temps = check.cpu.temperature || [];
|
const temps = check.cpu.temperature || [];
|
||||||
if (temps.length === 0) return { ...check, avg_temp: null };
|
if (temps.length === 0) return { ...check, avg_temp: null };
|
||||||
@@ -135,14 +137,14 @@ export const HistogramInfrastructure = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseChart icon={null} title={idx !== null ? title + ` ${idx}` : title}>
|
<BaseChart icon={null} title={title}>
|
||||||
<ResponsiveContainer width="100%" height={200}>
|
<ResponsiveContainer width="100%" height={200}>
|
||||||
<AreaChart data={title === "temp" ? avgTemps : checks}>
|
<AreaChart data={type === "temp" ? avgTemps : checks}>
|
||||||
<XAxis
|
<XAxis
|
||||||
dataKey={xKey}
|
dataKey={xKey}
|
||||||
tick={(props) => <XTick {...props} range={range} />}
|
tick={(props) => <XTick {...props} range={range} />}
|
||||||
/>
|
/>
|
||||||
<YAxis domain={title === "temp" ? tempYDomain : yDomain} />
|
<YAxis domain={type === "temp" ? tempYDomain : yDomain} />
|
||||||
|
|
||||||
<CartesianGrid
|
<CartesianGrid
|
||||||
stroke={theme.palette.divider}
|
stroke={theme.palette.divider}
|
||||||
|
|||||||
@@ -39,6 +39,29 @@
|
|||||||
"title": "Average Response Time",
|
"title": "Average Response Time",
|
||||||
"lowLabel": "Low",
|
"lowLabel": "Low",
|
||||||
"highLabel": "High"
|
"highLabel": "High"
|
||||||
|
},
|
||||||
|
"pageSpeed": {
|
||||||
|
"weight": "Weight",
|
||||||
|
"title": "Average PageSpeed score",
|
||||||
|
"fcp": "First Contentful Paint (FCP)",
|
||||||
|
"si": "Speed Index (SI)",
|
||||||
|
"lcp": "Largest Contentful Paint (LCP)",
|
||||||
|
"tbt": "Total Blocking Time (TBT)",
|
||||||
|
"cls": "Cumulative Layout Shift (CLS)"
|
||||||
|
},
|
||||||
|
"infrastructure": {
|
||||||
|
"memory": {
|
||||||
|
"title": "Memory"
|
||||||
|
},
|
||||||
|
"cpu": {
|
||||||
|
"title": "CPU"
|
||||||
|
},
|
||||||
|
"temp": {
|
||||||
|
"title": "Temp"
|
||||||
|
},
|
||||||
|
"disk": {
|
||||||
|
"title": "Disk {{idx}}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -69,7 +92,14 @@
|
|||||||
"activeFor": "Active for",
|
"activeFor": "Active for",
|
||||||
"lastCheck": "Last checked",
|
"lastCheck": "Last checked",
|
||||||
"lastResponseTime": "Last response time",
|
"lastResponseTime": "Last response time",
|
||||||
"certificate": "Certificate expiry"
|
"certificate": "Certificate expiry",
|
||||||
|
"cpuPhysical": "CPU (physical)",
|
||||||
|
"cpuLogical": "CPU (logical)",
|
||||||
|
"cpuFrequency": "CPU frequency",
|
||||||
|
"cpuTemperature": "Avg CPU temp",
|
||||||
|
"memory": "Memory",
|
||||||
|
"disk": "Disk",
|
||||||
|
"os": "OS"
|
||||||
},
|
},
|
||||||
"table": {
|
"table": {
|
||||||
"headers": {
|
"headers": {
|
||||||
@@ -221,6 +251,23 @@
|
|||||||
"optionDiskUsage": "Disk usage (%)",
|
"optionDiskUsage": "Disk usage (%)",
|
||||||
"optionTemperature": "Temperature (°C)"
|
"optionTemperature": "Temperature (°C)"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"gauges": {
|
||||||
|
"memory": {
|
||||||
|
"title": "Memory usage",
|
||||||
|
"upperLabel": "Used",
|
||||||
|
"lowerLabel": "Free"
|
||||||
|
},
|
||||||
|
"cpu": {
|
||||||
|
"title": "CPU usage",
|
||||||
|
"upperLabel": "Current frequency",
|
||||||
|
"lowerLabel": "Max frequency"
|
||||||
|
},
|
||||||
|
"disk": {
|
||||||
|
"title": "Disk {{idx}} usage",
|
||||||
|
"upperLabel": "Used",
|
||||||
|
"lowerLabel": "Free"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import prettyMilliseconds from "pretty-ms";
|
|||||||
import { getStatusPalette } from "@/utils/MonitorUtils";
|
import { getStatusPalette } from "@/utils/MonitorUtils";
|
||||||
import { InfraDetailsGraphs } from "@/pages/infrastructure/InfraDetailsGraphs";
|
import { InfraDetailsGraphs } from "@/pages/infrastructure/InfraDetailsGraphs";
|
||||||
|
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { useGet, usePatch } from "@/hooks/UseApi";
|
import { useGet, usePatch } from "@/hooks/UseApi";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
@@ -25,6 +26,7 @@ import { config } from "@/config/index";
|
|||||||
const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
|
const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
|
||||||
|
|
||||||
const InfraDetailsPage = () => {
|
const InfraDetailsPage = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [range, setRange] = useState("2h");
|
const [range, setRange] = useState("2h");
|
||||||
@@ -68,13 +70,13 @@ const InfraDetailsPage = () => {
|
|||||||
<Stack direction="row" gap={theme.spacing(8)} flexWrap={"wrap"}>
|
<Stack direction="row" gap={theme.spacing(8)} flexWrap={"wrap"}>
|
||||||
<StatBox
|
<StatBox
|
||||||
palette={palette}
|
palette={palette}
|
||||||
title="Active for"
|
title={t("monitors.common.stats.activeFor")}
|
||||||
subtitle={prettyMilliseconds(streakDuration, {
|
subtitle={prettyMilliseconds(streakDuration, {
|
||||||
secondsDecimalDigits: 0,
|
secondsDecimalDigits: 0,
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Last check"
|
title={t("monitors.common.stats.lastCheck")}
|
||||||
subtitle={
|
subtitle={
|
||||||
lastChecked >= 0
|
lastChecked >= 0
|
||||||
? `${prettyMilliseconds(lastChecked, {
|
? `${prettyMilliseconds(lastChecked, {
|
||||||
@@ -84,35 +86,40 @@ const InfraDetailsPage = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Last response time"
|
title={t("monitors.common.stats.lastResponseTime")}
|
||||||
subtitle={
|
subtitle={
|
||||||
stats?.lastResponseTime ? `${stats?.lastResponseTime} ms` : "N/A"
|
stats?.lastResponseTime ? `${stats?.lastResponseTime} ms` : "N/A"
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="CPU (physical)"
|
title={t("monitors.common.stats.cpuPhysical")}
|
||||||
subtitle={getCores(checks[0]?.cpu?.physical_core)}
|
subtitle={getCores(checks[0]?.cpu?.physical_core)}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="CPU (logical)"
|
title={t("monitors.common.stats.cpuLogical")}
|
||||||
subtitle={getCores(checks[0]?.cpu?.logical_core)}
|
subtitle={getCores(checks[0]?.cpu?.logical_core)}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="CPU frequency"
|
title={t("monitors.common.stats.cpuFrequency")}
|
||||||
subtitle={getFrequency(checks[0]?.cpu?.current_frequency)}
|
subtitle={getFrequency(checks[0]?.cpu?.current_frequency)}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Avg CPU temp"
|
title={t("monitors.common.stats.cpuTemperature")}
|
||||||
subtitle={getAvgTemp(checks[0]?.cpu?.temperature)}
|
subtitle={getAvgTemp(checks[0]?.cpu?.temperature)}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Memory"
|
title={t("monitors.common.stats.memory")}
|
||||||
subtitle={getGbs(checks[0]?.memory?.total_bytes)}
|
subtitle={getGbs(checks[0]?.memory?.total_bytes)}
|
||||||
/>
|
/>
|
||||||
<StatBox title="Disk" subtitle={getDiskTotalGbs(checks[0]?.disk)} />
|
<StatBox
|
||||||
<StatBox title="OS" subtitle={getOsAndPlatform(checks[0]?.host)} />
|
title={t("monitors.common.stats.disk")}
|
||||||
|
subtitle={getDiskTotalGbs(checks[0]?.disk)}
|
||||||
|
/>
|
||||||
|
<StatBox
|
||||||
|
title={t("monitors.common.stats.os")}
|
||||||
|
subtitle={getOsAndPlatform(checks[0]?.host)}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
{/* <Typography variant="h1">Infrastructure overview</Typography> */}
|
|
||||||
|
|
||||||
<InfraDetailsGauges checks={checks} />
|
<InfraDetailsGauges checks={checks} />
|
||||||
<HeaderRange loading={isValidating} range={range} setRange={setRange} />
|
<HeaderRange loading={isValidating} range={range} setRange={setRange} />
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Typography from "@mui/material/Typography";
|
|||||||
import { BaseChart } from "@/components/monitors/Chart";
|
import { BaseChart } from "@/components/monitors/Chart";
|
||||||
import { Gauge } from "@/components/design-elements";
|
import { Gauge } from "@/components/design-elements";
|
||||||
|
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { getGbs, getFrequency } from "./InfraUtils";
|
import { getGbs, getFrequency } from "./InfraUtils";
|
||||||
import type { IInfraCheck } from "@/types/check";
|
import type { IInfraCheck } from "@/types/check";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
@@ -42,6 +43,7 @@ const InfraDetailGauge = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const InfraDetailsGauges = ({ checks }: { checks: IInfraCheck[] }) => {
|
export const InfraDetailsGauges = ({ checks }: { checks: IInfraCheck[] }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
||||||
return (
|
return (
|
||||||
@@ -51,30 +53,31 @@ export const InfraDetailsGauges = ({ checks }: { checks: IInfraCheck[] }) => {
|
|||||||
alignItems={"center"}
|
alignItems={"center"}
|
||||||
>
|
>
|
||||||
<InfraDetailGauge
|
<InfraDetailGauge
|
||||||
title="Memory Usage"
|
title={t("monitors.infrastructure.gauges.memory.title")}
|
||||||
progress={(checks[0]?.memory.usage_percent || 0) * 100}
|
progress={(checks[0]?.memory.usage_percent || 0) * 100}
|
||||||
upperLabel="Used"
|
upperLabel={t("monitors.infrastructure.gauges.memory.upperLabel")}
|
||||||
upperValue={getGbs(checks[0]?.memory.used_bytes)}
|
upperValue={getGbs(checks[0]?.memory.used_bytes)}
|
||||||
lowerLabel="Free"
|
lowerLabel={t("monitors.infrastructure.gauges.memory.lowerLabel")}
|
||||||
lowerValue={getGbs(checks[0]?.memory.total_bytes)}
|
lowerValue={getGbs(checks[0]?.memory.total_bytes)}
|
||||||
/>
|
/>
|
||||||
<InfraDetailGauge
|
<InfraDetailGauge
|
||||||
title="CPU Usage"
|
title={t("monitors.infrastructure.gauges.cpu.title")}
|
||||||
progress={(checks[0]?.cpu.usage_percent || 0) * 100}
|
progress={(checks[0]?.cpu.usage_percent || 0) * 100}
|
||||||
upperLabel="Current frequency"
|
upperLabel={t("monitors.infrastructure.gauges.cpu.upperLabel")}
|
||||||
upperValue={getFrequency(checks[0]?.cpu.current_frequency)}
|
upperValue={getFrequency(checks[0]?.cpu.current_frequency)}
|
||||||
lowerLabel="Max Frequency"
|
lowerLabel={t("monitors.infrastructure.gauges.cpu.lowerLabel")}
|
||||||
lowerValue={getFrequency(checks[0]?.cpu.frequency)}
|
lowerValue={getFrequency(checks[0]?.cpu.frequency)}
|
||||||
/>
|
/>
|
||||||
{checks[0]?.disk?.map((disk, idx) => {
|
{checks[0]?.disk?.map((disk, idx) => {
|
||||||
return (
|
return (
|
||||||
<InfraDetailGauge
|
<InfraDetailGauge
|
||||||
key={disk.device + idx}
|
key={disk.device + idx}
|
||||||
title={`Disk ${idx} usage`}
|
// title={`Disk ${idx} usage`}
|
||||||
|
title={t("monitors.infrastructure.gauges.disk.title", { idx })}
|
||||||
progress={(disk.usage_percent || 0) * 100}
|
progress={(disk.usage_percent || 0) * 100}
|
||||||
upperLabel="Used"
|
upperLabel={t("monitors.infrastructure.gauges.disk.upperLabel")}
|
||||||
upperValue={getGbs(disk.used_bytes)}
|
upperValue={getGbs(disk.used_bytes)}
|
||||||
lowerLabel="Free"
|
lowerLabel={t("monitors.infrastructure.gauges.disk.lowerLabel")}
|
||||||
lowerValue={getGbs(disk.total_bytes)}
|
lowerValue={getGbs(disk.total_bytes)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import Grid from "@mui/material/Grid";
|
import Grid from "@mui/material/Grid";
|
||||||
import { HistogramInfrastructure } from "@/components/monitors";
|
import { HistogramInfrastructure } from "@/components/monitors";
|
||||||
|
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import type { IInfraCheck } from "@/types/check";
|
import type { IInfraCheck } from "@/types/check";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
|
|
||||||
const getChartConfigs = (theme: any, checks: IInfraCheck[]) => {
|
const getChartConfigs = (theme: any, checks: IInfraCheck[], t: any) => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
title: t("common.charts.infrastructure.memory.title"),
|
||||||
type: "memory",
|
type: "memory",
|
||||||
dataKeys: ["memory.usage_percent"],
|
dataKeys: ["memory.usage_percent"],
|
||||||
strokeColor: theme.palette.primary.main,
|
strokeColor: theme.palette.primary.main,
|
||||||
@@ -17,6 +19,7 @@ const getChartConfigs = (theme: any, checks: IInfraCheck[]) => {
|
|||||||
idx: null,
|
idx: null,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
title: t("common.charts.infrastructure.cpu.title"),
|
||||||
type: "cpu",
|
type: "cpu",
|
||||||
dataKeys: ["cpu.used_percent"],
|
dataKeys: ["cpu.used_percent"],
|
||||||
strokeColor: theme.palette.success.main,
|
strokeColor: theme.palette.success.main,
|
||||||
@@ -25,6 +28,7 @@ const getChartConfigs = (theme: any, checks: IInfraCheck[]) => {
|
|||||||
idx: null,
|
idx: null,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
title: t("common.charts.infrastructure.temp.title"),
|
||||||
type: "temp",
|
type: "temp",
|
||||||
dataKeys: ["avg_temp"],
|
dataKeys: ["avg_temp"],
|
||||||
strokeColor: theme.palette.error.main,
|
strokeColor: theme.palette.error.main,
|
||||||
@@ -33,6 +37,7 @@ const getChartConfigs = (theme: any, checks: IInfraCheck[]) => {
|
|||||||
idx: null,
|
idx: null,
|
||||||
},
|
},
|
||||||
...(checks[0]?.disk?.map((_, idx) => ({
|
...(checks[0]?.disk?.map((_, idx) => ({
|
||||||
|
title: t("common.charts.infrastructure.disk.title", { idx }),
|
||||||
type: "disk",
|
type: "disk",
|
||||||
dataKeys: [`disk[${idx}].usage_percent`],
|
dataKeys: [`disk[${idx}].usage_percent`],
|
||||||
strokeColor: theme.palette.warning.main,
|
strokeColor: theme.palette.warning.main,
|
||||||
@@ -52,9 +57,10 @@ export const InfraDetailsGraphs = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
||||||
|
const { t } = useTranslation();
|
||||||
const chartConfigs = useMemo(
|
const chartConfigs = useMemo(
|
||||||
() => getChartConfigs(theme, checks),
|
() => getChartConfigs(theme, checks, t),
|
||||||
[theme, checks]
|
[theme, checks, t]
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={theme.spacing(8)}>
|
<Grid container spacing={theme.spacing(8)}>
|
||||||
@@ -66,7 +72,8 @@ export const InfraDetailsGraphs = ({
|
|||||||
>
|
>
|
||||||
<HistogramInfrastructure
|
<HistogramInfrastructure
|
||||||
range={range}
|
range={range}
|
||||||
title={config.type}
|
title={config.title}
|
||||||
|
type={config.type}
|
||||||
idx={config.idx}
|
idx={config.idx}
|
||||||
key={`${config.type}-${config.idx ?? ""}`}
|
key={`${config.type}-${config.idx ?? ""}`}
|
||||||
checks={checks}
|
checks={checks}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { HistogramPageSpeedScores } from "@/components/monitors/HistogramPageSpe
|
|||||||
import { ChartPageSpeedReport } from "@/components/monitors/ChartPageSpeedReport";
|
import { ChartPageSpeedReport } from "@/components/monitors/ChartPageSpeedReport";
|
||||||
import { ChartPageSpeedReportLegend } from "@/components/monitors/ChartPageSpeedReportLegend";
|
import { ChartPageSpeedReportLegend } from "@/components/monitors/ChartPageSpeedReportLegend";
|
||||||
|
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
@@ -18,6 +19,7 @@ import { config } from "@/config/index";
|
|||||||
|
|
||||||
const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
|
const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
|
||||||
const PageSpeedDetailsPage = () => {
|
const PageSpeedDetailsPage = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [range, setRange] = useState("2h");
|
const [range, setRange] = useState("2h");
|
||||||
@@ -62,13 +64,13 @@ const PageSpeedDetailsPage = () => {
|
|||||||
<Stack direction="row" gap={theme.spacing(8)}>
|
<Stack direction="row" gap={theme.spacing(8)}>
|
||||||
<StatBox
|
<StatBox
|
||||||
palette={palette}
|
palette={palette}
|
||||||
title="Active for"
|
title={t("monitors.common.stats.activeFor")}
|
||||||
subtitle={prettyMilliseconds(streakDuration, {
|
subtitle={prettyMilliseconds(streakDuration, {
|
||||||
secondsDecimalDigits: 0,
|
secondsDecimalDigits: 0,
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Last check"
|
title={t("monitors.common.stats.lastCheck")}
|
||||||
subtitle={
|
subtitle={
|
||||||
lastChecked >= 0
|
lastChecked >= 0
|
||||||
? `${prettyMilliseconds(lastChecked, {
|
? `${prettyMilliseconds(lastChecked, {
|
||||||
@@ -78,7 +80,7 @@ const PageSpeedDetailsPage = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Last response time"
|
title={t("monitors.common.stats.lastResponseTime")}
|
||||||
subtitle={
|
subtitle={
|
||||||
stats?.lastResponseTime ? `${stats?.lastResponseTime} ms` : "N/A"
|
stats?.lastResponseTime ? `${stats?.lastResponseTime} ms` : "N/A"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user