status pages
This commit is contained in:
1 parent
602597abe2
commit
e5ef14215f
14 files changed
+77
-60
No files matched your search
@@ -17,9 +17,7 @@ import { BaseBox } from "@/components/design-elements";
|
||||
import { useAppSelector } from "@/hooks/AppHooks";
|
||||
import { formatDateWithTz, tooltipDateFormatLookup } from "@/utils/TimeUtils";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
type Datum = Record<string, unknown> & { _id: string | number };
|
||||
|
||||
import type { GroupedCheck } from "@/types/check";
|
||||
export const BarDockerCount = ({
|
||||
data,
|
||||
dataKey,
|
||||
@@ -27,7 +25,7 @@ export const BarDockerCount = ({
|
||||
title,
|
||||
emptyText,
|
||||
}: {
|
||||
data: Datum[];
|
||||
data: GroupedCheck[];
|
||||
dataKey: string;
|
||||
range: string;
|
||||
title: string;
|
||||
|
||||
@@ -48,7 +48,7 @@ export const HeaderControls = ({
|
||||
loading={isPosting || isPatching}
|
||||
startIcon={<Mail size={20} strokeWidth={1.5} />}
|
||||
onClick={async () => {
|
||||
await post(`/monitors/${monitor._id}/notifications/test`, {});
|
||||
await post(`/monitors/${monitor.id}/notifications/test`, {});
|
||||
}}
|
||||
>
|
||||
{t("common.buttons.testNotification")}
|
||||
@@ -57,7 +57,7 @@ export const HeaderControls = ({
|
||||
<Button
|
||||
startIcon={<Bug size={20} strokeWidth={1.5} />}
|
||||
onClick={() => {
|
||||
navigate(`/incidents?monitorId=${monitor._id}`);
|
||||
navigate(`/incidents?monitorId=${monitor.id}`);
|
||||
}}
|
||||
>
|
||||
{t("common.buttons.incidents")}
|
||||
@@ -65,7 +65,7 @@ export const HeaderControls = ({
|
||||
<Button
|
||||
loading={isPatching || isPosting}
|
||||
onClick={async () => {
|
||||
await patch(`/monitors/${monitor._id}/active`);
|
||||
await patch(`/monitors/${monitor.id}/active`);
|
||||
refetch();
|
||||
}}
|
||||
startIcon={
|
||||
@@ -83,7 +83,7 @@ export const HeaderControls = ({
|
||||
<Button
|
||||
startIcon={<Settings size={20} strokeWidth={1.5} />}
|
||||
onClick={() => {
|
||||
navigate(`${path}/${monitor._id}/configure`);
|
||||
navigate(`${path}/${monitor.id}/configure`);
|
||||
}}
|
||||
>
|
||||
{t("common.buttons.configure")}
|
||||
|
||||
@@ -5,14 +5,10 @@ import Link from "@mui/material/Link";
|
||||
import { config } from "@/config/index";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import type { IStatusPageWithMonitors } from "@/types/status-page";
|
||||
import type { IStatusPage } from "@/types/status-page";
|
||||
const HOST = config.HOST;
|
||||
|
||||
export const NameHeader = ({
|
||||
statusPage,
|
||||
}: {
|
||||
statusPage: IStatusPageWithMonitors;
|
||||
}) => {
|
||||
export const NameHeader = ({ statusPage }: { statusPage: IStatusPage }) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Stack direction={"row"} alignItems={"flex-end"} spacing={4}>
|
||||
|
||||
@@ -2,15 +2,11 @@ import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
|
||||
import { getStatusPageHeaderConfig } from "@/utils/MonitorUtils";
|
||||
import type { IStatusPageWithMonitors } from "@/types/status-page";
|
||||
import type { IStatusPage } from "@/types/status-page";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export const StatusHeader = ({
|
||||
statusPage,
|
||||
}: {
|
||||
statusPage: IStatusPageWithMonitors;
|
||||
}) => {
|
||||
export const StatusHeader = ({ statusPage }: { statusPage: IStatusPage }) => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
const headerConfig = getStatusPageHeaderConfig(statusPage?.monitors || [], t);
|
||||
|
||||
@@ -8,7 +8,9 @@ import { useTheme } from "@mui/material/styles";
|
||||
import { useAppSelector } from "@/hooks/AppHooks";
|
||||
import type { IMonitor } from "@/types/monitor";
|
||||
|
||||
export const StatusPageRow = ({ monitor }: { monitor: IMonitor }) => {
|
||||
type Props = { monitor: IMonitor; checks: any[] };
|
||||
|
||||
export const StatusPageRow = ({ monitor, checks }: Props) => {
|
||||
const theme = useTheme();
|
||||
const type = useAppSelector((state) => state?.ui?.chartType || "heatmap");
|
||||
|
||||
@@ -32,7 +34,7 @@ export const StatusPageRow = ({ monitor }: { monitor: IMonitor }) => {
|
||||
{type === "heatmap" && (
|
||||
<HeatmapResponseTime
|
||||
gap={{ xs: theme.spacing(0.5), md: theme.spacing(2) }}
|
||||
checks={monitor?.latestChecks ?? []}
|
||||
checks={checks ?? []}
|
||||
availabilityCellSx={{
|
||||
borderRadius: {
|
||||
xs: theme.spacing(0.5),
|
||||
@@ -49,7 +51,7 @@ export const StatusPageRow = ({ monitor }: { monitor: IMonitor }) => {
|
||||
)}
|
||||
{type === "histogram" && (
|
||||
<HistogramResponseTime
|
||||
checks={monitor?.latestChecks ?? []}
|
||||
checks={checks ?? []}
|
||||
height={{ xs: 50, md: 100 }}
|
||||
gap={{ xs: 0.5, md: theme.spacing(4) }}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user