Skip to content

Commit 4fb8c5b

Browse files
committed
uodate dashboard
Signed-off-by: cwen0 <[email protected]>
1 parent 7954240 commit 4fb8c5b

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

server/nework.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
type PingD struct {
1313
Time int64 `json:"time"`
14-
Delay float64 `json:"delay"`
14+
Latency float64 `json:"latency"`
1515
}
1616

1717
func (p *PingD) Key() interface{} {
@@ -37,7 +37,7 @@ func (s *Server) startPing() {
3737
pinger.Count = 1
3838
pinger.Run() // blocks until finished
3939
stats := pinger.Statistics()
40-
s.push(&PingD{Time: time.Now().UnixNano() / 1e6, Delay: float64(stats.AvgRtt.Microseconds()) / 1000})
40+
s.push(&PingD{Time: time.Now().UnixNano() / 1e6, Latency: float64(stats.AvgRtt.Microseconds()) / 1000})
4141
}
4242
}
4343
}

web/src/components/Banner.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ const BannerStyles = styled.div`
6767
align-content: center;
6868
height: 75px;
6969
width: 100%;
70-
background: (190, 190, 190);
70+
background: (187, 255, 255);
7171
background: linear-gradient(
7272
90deg,
73-
rgba(164, 167, 66, 1) 0%,
74-
rgba(183, 184, 85, 1) 50%,
75-
rgba(199, 100, 100, 1) 100%
73+
rgba(174, 248, 238, 1) 0%,
74+
rgba(174, 238, 255, 1) 50%,
75+
rgba(174, 238, 255, 1) 100%
7676
);
7777
`;
7878

@@ -89,7 +89,7 @@ const BannerTitle = styled.div`
8989
margin-left: 20px;
9090
h1 {
9191
font-size: 14px;
92-
color: white;
92+
color: (106, 90, 205);
9393
font-weight: 400;
9494
margin: 0;
9595
padding: 0;

web/src/components/TrafficChart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ const TrafficChart: React.FC<IProps> = props => {
4141
tickFormatter = {(unixTime) => moment(unixTime).format('HH:mm:ss Do')}
4242
type = 'number'
4343
/>
44-
<YAxis label={{ value: 'Delay', position: 'insideLeft', angle: -90 }} unit={"ms"}/>
44+
<YAxis label={{ value: 'Latency', position: 'insideLeft', angle: -90 }} unit={"ms"}/>
4545
<Tooltip labelFormatter={t => new Date(t).toLocaleString()} />
4646
<Legend />
47-
<Line type="monotone" dataKey="delay" stroke="#8884d8" />
47+
<Line type="monotone" dataKey="latency" stroke="#8884d8" />
4848
</ComposedChart>
4949
</ResponsiveContainer>
5050
);

web/src/data.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export interface ITrafficData {
22
time: number;
3-
delay: number;
3+
latency: number;
44
}
55

66
export interface IData {
@@ -9,10 +9,10 @@ export interface IData {
99

1010
export const data: IData = {
1111
traffic: [
12-
{time: 1503617297689, delay: 15},
13-
{time: 1503616962277, delay: 152},
14-
{time: 1503616882654, delay: 112},
15-
{time: 1503613184594, delay: 201},
16-
{time: 1503611308914, delay: 141},
12+
{time: 1503617297689, latency: 15},
13+
{time: 1503616962277, latency: 152},
14+
{time: 1503616882654, latency: 112},
15+
{time: 1503613184594, latency: 201},
16+
{time: 1503611308914, latency: 141},
1717
]
1818
}

web/src/utils/useInterval.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useEffect, useRef } from 'react'
66
const noop = () => {} // keep typescript happy
77
export const useInterval = (
88
callback: () => void,
9-
delay: number | null,
9+
latency: number | null,
1010
immediate?: boolean // called when mounted if true
1111
) => {
1212
const savedCallback = useRef(noop)
@@ -24,10 +24,10 @@ export const useInterval = (
2424

2525
// Set up the interval.
2626
useEffect(() => {
27-
if (delay === null) return undefined
27+
if (latency === null) return undefined
2828

2929
const tick = () => savedCallback.current()
30-
const id = setInterval(tick, delay)
30+
const id = setInterval(tick, latency)
3131
return () => clearInterval(id)
32-
}, [delay])
32+
}, [latency])
3333
}

0 commit comments

Comments
 (0)