feat: option to hide latency chart

pull/97/head
lyc8503 2025-03-25 17:41:32 +08:00
parent dabccd83f6
commit d1857502bb
5 changed files with 8 additions and 4 deletions

View File

@ -70,7 +70,7 @@ export default function MonitorDetail({
</div>
<DetailBar monitor={monitor} state={state} />
<DetailChart monitor={monitor} state={state} />
{!monitor.hideLatencyChart && <DetailChart monitor={monitor} state={state} />}
</>
)
}

View File

@ -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:
<Card.Section ml="xs" mr="xs">
<MonitorDetail monitor={monitor} state={state} />
</Card.Section>
<Divider />
</div>
))}
</Card>

View File

@ -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,
}
})

View File

@ -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

View File

@ -36,6 +36,7 @@ type MonitorTarget = {
tooltip?: string
statusPageLink?: string
checkLocationWorkerRoute?: string
hideLatencyChart?: boolean
// HTTP Code
expectedCodes?: number[]