From d1857502bb002c4f2eeac6109a04a1e14a5bbc8e Mon Sep 17 00:00:00 2001 From: lyc8503 Date: Tue, 25 Mar 2025 17:41:32 +0800 Subject: [PATCH] feat: option to hide latency chart --- components/MonitorDetail.tsx | 2 +- components/MonitorList.tsx | 3 +-- pages/index.tsx | 4 +++- uptime.config.ts | 2 ++ uptime.types.ts | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/components/MonitorDetail.tsx b/components/MonitorDetail.tsx index c7e47f4..2ddfa14 100644 --- a/components/MonitorDetail.tsx +++ b/components/MonitorDetail.tsx @@ -70,7 +70,7 @@ export default function MonitorDetail({ - + {!monitor.hideLatencyChart && } ) } diff --git a/components/MonitorList.tsx b/components/MonitorList.tsx index fec88f9..e4c4682 100644 --- a/components/MonitorList.tsx +++ b/components/MonitorList.tsx @@ -1,5 +1,5 @@ import { MonitorState, MonitorTarget } from '@/uptime.types' -import { Card, Center, Divider } from '@mantine/core' +import { Card, Center } from '@mantine/core' import MonitorDetail from './MonitorDetail' export default function MonitorList({ monitors, state }: { monitors: any; state: MonitorState }) { @@ -20,7 +20,6 @@ export default function MonitorList({ monitors, state }: { monitors: any; state: - ))} diff --git a/pages/index.tsx b/pages/index.tsx index 1becbac..afc9ec6 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -108,7 +108,9 @@ export async function getServerSideProps() { // @ts-ignore tooltip: monitor?.tooltip, // @ts-ignore - statusPageLink: monitor?.statusPageLink + statusPageLink: monitor?.statusPageLink, + // @ts-ignore + hideLatencyChart: monitor?.hideLatencyChart, } }) diff --git a/uptime.config.ts b/uptime.config.ts index 0d3edae..526be49 100644 --- a/uptime.config.ts +++ b/uptime.config.ts @@ -30,6 +30,8 @@ const workerConfig = { tooltip: 'This is a tooltip for this monitor', // [OPTIONAL] `statusPageLink` is ONLY used for clickable link at status page statusPageLink: 'https://example.com', + // [OPTIONAL] `hideLatencyChart` will hide status page latency chart if set to true + hideLatencyChart: false, // [OPTIONAL] `expectedCodes` is an array of acceptable HTTP response codes, if not specified, default to 2xx expectedCodes: [200], // [OPTIONAL] `timeout` in millisecond, if not specified, default to 10000 diff --git a/uptime.types.ts b/uptime.types.ts index a4d56cd..73cf3cc 100644 --- a/uptime.types.ts +++ b/uptime.types.ts @@ -36,6 +36,7 @@ type MonitorTarget = { tooltip?: string statusPageLink?: string checkLocationWorkerRoute?: string + hideLatencyChart?: boolean // HTTP Code expectedCodes?: number[]