admin/monitoring: ask confirmation to reset stats
Massimo Melina committed
Jun 25, 2024 at 15:48 UTC
0e2291abec1d091771abcfcfb9d8750fc49b48ad
1 file changed
+4
-3
admin/src/MonitorPage.ts
+4
-3
@@ -16,7 +16,7 @@ import { StandardCSSProperties } from '@mui/system/styleFunctionSx/StandardCssPr
16
import { agentIcons } from './LogsPage'
17
import { state, useSnapState } from './state'
18
import { useBlockIp } from './useBlockIp'
19
-import { alertDialog } from './dialog'
19
+import { alertDialog, confirmDialog } from './dialog'
20
21
export default function MonitorPage() {
22
return h(Fragment, {},
@@ -43,8 +43,9 @@ function MoreInfo() {
43
(allInfo || sm) && pair('sent_got', {
44
render: x => ({ Sent: formatBytes(x[0]), Got: formatBytes(x[1]) }),
45
title: x => "Since: " + formatTimestamp(x[2]),
46
- onDelete: () => apiCall('clear_persistent', { k: ['totalSent', 'totalGot'] })
47
- .then(() => alertDialog("Done", 'success'), alertDialog)
46
+ onDelete: () => confirmDialog("Reset stats?")
47
+ .then(yes => yes && apiCall('clear_persistent', { k: ['totalSent', 'totalGot'] })
48
+ .then(() => alertDialog("Done", 'success'), alertDialog) )
49
}),
50
(allInfo || sm) && pair('ips', { label: "IPs" }),
51
pair('outSpeed', { label: "Output", render: formatSpeedK, minWidth: '8.5em' }),