format code and no semi
This commit is contained in:
1 parent
eba65bd654
commit
87611700c3
11 files changed
+135
-157
No files matched your search
@@ -3,11 +3,7 @@ import classes from '@/styles/Header.module.css'
|
||||
import config from '@/uptime.config'
|
||||
|
||||
export default function Header() {
|
||||
const linkToElement = (link: {
|
||||
label: string
|
||||
link: string
|
||||
highlight?: boolean
|
||||
}) => {
|
||||
const linkToElement = (link: { label: string; link: string; highlight?: boolean }) => {
|
||||
return (
|
||||
<a
|
||||
key={link.label}
|
||||
@@ -46,9 +42,7 @@ export default function Header() {
|
||||
</Group>
|
||||
|
||||
<Group gap={5} hiddenFrom="sm">
|
||||
{config.page.links
|
||||
.filter((link) => link.highlight)
|
||||
.map(linkToElement)}
|
||||
{config.page.links.filter((link) => link.highlight).map(linkToElement)}
|
||||
</Group>
|
||||
</Container>
|
||||
</header>
|
||||
|
||||
@@ -31,21 +31,17 @@ export default function MonitorDetail({
|
||||
{monitor.name}
|
||||
</Text>
|
||||
<Text mt="sm" fw={700}>
|
||||
No data available, please make sure you have deployed your workers
|
||||
with latest config and check your worker status!
|
||||
No data available, please make sure you have deployed your workers with latest config and
|
||||
check your worker status!
|
||||
</Text>
|
||||
</>
|
||||
)
|
||||
|
||||
const statusIcon =
|
||||
state.incident[monitor.id].slice(-1)[0].end === undefined ? (
|
||||
<IconAlertCircle
|
||||
style={{ width: '1.25em', height: '1.25em', color: '#b91c1c' }}
|
||||
/>
|
||||
<IconAlertCircle style={{ width: '1.25em', height: '1.25em', color: '#b91c1c' }} />
|
||||
) : (
|
||||
<IconCircleCheck
|
||||
style={{ width: '1.25em', height: '1.25em', color: '#059669' }}
|
||||
/>
|
||||
<IconCircleCheck style={{ width: '1.25em', height: '1.25em', color: '#059669' }} />
|
||||
)
|
||||
|
||||
let totalTime = Date.now() / 1000 - state.incident[monitor.id][0].start[0]
|
||||
@@ -56,26 +52,15 @@ export default function MonitorDetail({
|
||||
|
||||
console.log(totalTime)
|
||||
console.log(downTime)
|
||||
const uptimePercent = (
|
||||
((totalTime - downTime) / totalTime) *
|
||||
100
|
||||
).toPrecision(4)
|
||||
const uptimePercent = (((totalTime - downTime) / totalTime) * 100).toPrecision(4)
|
||||
|
||||
return (
|
||||
<>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<Text
|
||||
mt="sm"
|
||||
fw={700}
|
||||
style={{ display: 'inline-flex', alignItems: 'center' }}
|
||||
>
|
||||
<Text mt="sm" fw={700} style={{ display: 'inline-flex', alignItems: 'center' }}>
|
||||
{statusIcon} {monitor.name}
|
||||
</Text>
|
||||
<Text
|
||||
mt="sm"
|
||||
fw={700}
|
||||
style={{ display: 'inline', color: getColor(uptimePercent, true) }}
|
||||
>
|
||||
<Text mt="sm" fw={700} style={{ display: 'inline', color: getColor(uptimePercent, true) }}>
|
||||
Overall: {uptimePercent}%
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
@@ -2,13 +2,7 @@ import { MonitorState, MonitorTarget } from '@/uptime.types'
|
||||
import { Card, Center, Divider } from '@mantine/core'
|
||||
import MonitorDetail from './MonitorDetail'
|
||||
|
||||
export default function MonitorList({
|
||||
config,
|
||||
state,
|
||||
}: {
|
||||
config: any
|
||||
state: MonitorState
|
||||
}) {
|
||||
export default function MonitorList({ config, state }: { config: any; state: MonitorState }) {
|
||||
return (
|
||||
<Center>
|
||||
<Card
|
||||
|
||||
@@ -7,18 +7,14 @@ export default function OverallStatus({
|
||||
state: { overallUp: number; overallDown: number; lastUpdate: number }
|
||||
}) {
|
||||
let statusString = ''
|
||||
let icon = (
|
||||
<IconAlertCircle style={{ width: 64, height: 64, color: '#b91c1c' }} />
|
||||
)
|
||||
let icon = <IconAlertCircle style={{ width: 64, height: 64, color: '#b91c1c' }} />
|
||||
if (state.overallUp === 0 && state.overallDown === 0) {
|
||||
statusString = 'No data yet'
|
||||
} else if (state.overallUp === 0) {
|
||||
statusString = 'All systems not operational'
|
||||
} else if (state.overallDown === 0) {
|
||||
statusString = 'All systems operational'
|
||||
icon = (
|
||||
<IconCircleCheck style={{ width: 64, height: 64, color: '#059669' }} />
|
||||
)
|
||||
icon = <IconCircleCheck style={{ width: 64, height: 64, color: '#059669' }} />
|
||||
} else {
|
||||
statusString = `Some systems not operational (${state.overallDown} out of ${
|
||||
state.overallUp + state.overallDown
|
||||
@@ -31,11 +27,7 @@ export default function OverallStatus({
|
||||
<Title mt="sm" style={{ textAlign: 'center' }} order={1}>
|
||||
{statusString}
|
||||
</Title>
|
||||
<Title
|
||||
mt="sm"
|
||||
style={{ textAlign: 'center', color: '#70778c' }}
|
||||
order={5}
|
||||
>
|
||||
<Title mt="sm" style={{ textAlign: 'center', color: '#70778c' }} order={5}>
|
||||
Last updated on:{' '}
|
||||
{`${new Date(state.lastUpdate * 1000).toLocaleString()} (${
|
||||
Math.round(Date.now() / 1000) - state.lastUpdate
|
||||
|
||||
Reference in new issue
Block a user