admin/monitoring: show input speed
Massimo Melina committed
Sep 11, 2023 at 14:50 UTC
5e730be3477cef96f38f7af21bd696604cb8a443
1 file changed
+7
-5
admin/src/MonitorPage.ts
+7
-5
@@ -25,16 +25,18 @@ function MoreInfo() {
25
const { data: connections } = useApiEvents('get_connection_stats')
26
if (status && connections)
27
Object.assign(status, connections)
28
+ const xl = useBreakpoint('xl')
29
const md = useBreakpoint('md')
30
const sm = useBreakpoint('sm')
31
return element || h(Box, { display: 'flex', flexWrap: 'wrap', gap: '1em', mb: 2 },
31
- md && pair('started'),
32
- md && pair('http', { label: "HTTP", render: port }),
32
+ xl && pair('started'),
33
+ xl && pair('http', { label: "HTTP", render: port }),
34
md && pair('https', { label: "HTTPS", render: port }),
35
sm && pair('connections'),
36
pair('sent', { render: formatBytes, minWidth: '4em' }),
37
sm && pair('got', { render: formatBytes, minWidth: '4em' }),
38
pair('outSpeed', { label: "Output speed", render: formatSpeed }),
39
+ md && pair('inSpeed', { label: "Input speed", render: formatSpeed }),
40
)
41
42
type Color = ChipProps['color']
@@ -163,7 +165,7 @@ function Connections() {
165
width: 110,
166
hideUnder: 'sm',
167
type: 'number',
166
- renderCell: ({ value, row }) => formatSpeed(Math.max(value||0, row.inSpeed||0)),
168
+ renderCell: ({ value, row }) => formatSpeed(Math.max(value||0, row.inSpeed||0) || undefined),
169
mergeRender: { other: 'sent', fontSize: 'small', textAlign: 'right' }
170
},
171
{
@@ -212,6 +214,6 @@ function blockIp(ip: string) {
214
return manipulateConfig('block', data => [...data, { ip }])
215
}
216
215
-function formatSpeed(value: number) {
216
- return !value ? '' : formatBytes(value * 1000, { post: "B/s", k: 1000, digits: 1 })
217
+function formatSpeed(value: number | undefined) {
218
+ return value === undefined ? '' : formatBytes(value * 1000, { post: "B/s", k: 1000, digits: 1 })
219
}