Add device traffic reset with outbound baselines
Build and Deploy Gateway / build-and-push (push) Successful in 21s
Build and Deploy Gateway / deploy (push) Successful in 14s

This commit is contained in:
2026-08-12 23:55:34 +03:00
parent 08cc013def
commit b86812d02b
18 changed files with 369 additions and 33 deletions
+31 -2
View File
@@ -7,6 +7,7 @@ import {
type CSSProperties,
} from 'react';
import { Drawer } from '../../ui/Drawer.js';
import { ConfirmationDialog } from '../../ui/ConfirmationDialog.js';
import { Tooltip } from '../../ui/Tooltip.js';
import { copyText } from '../../utils/clientControls.js';
import {
@@ -70,9 +71,14 @@ export function DevicesPanel({ feature }: { feature: DevicesFeature }) {
refreshing,
refreshCycle,
savingId,
resetOpen,
resetting,
load: onLoad,
updateDevice,
updatePolicy,
requestTrafficReset,
cancelTrafficReset,
confirmResetTraffic,
close: onClose,
} = feature;
const [editingId, setEditingId] = useState('');
@@ -278,7 +284,7 @@ export function DevicesPanel({ feature }: { feature: DevicesFeature }) {
});
}
return (
return <>
<Drawer
panelRef={panelRef}
closeRef={closeRef}
@@ -333,6 +339,17 @@ export function DevicesPanel({ feature }: { feature: DevicesFeature }) {
<button type="button" aria-pressed={trafficScale === 'linear'} onClick={() => setTrafficScale('linear')}>Лин</button>
<button type="button" aria-pressed={trafficScale === 'log'} onClick={() => setTrafficScale('log')}>Лог</button>
</span>
<button
className="client-devices-reset"
type="button"
disabled={!snapshot || resetting}
onClick={requestTrafficReset}
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M4 12a8 8 0 1 0 2.3-5.7M4 5v7h7" />
</svg>
<span>Сбросить данные</span>
</button>
</div>
<h2 id="client-devices-title">Устройства</h2>
<div className="client-instructions-intro">
@@ -623,5 +640,17 @@ export function DevicesPanel({ feature }: { feature: DevicesFeature }) {
})}
</div>
</Drawer>
);
<ConfirmationDialog
open={resetOpen}
id="client-devices-reset"
kicker="Данные устройств"
title="Сбросить статистику?"
description="Вход и выход для всех устройств начнут считаться заново. Общая скорость и история Prometheus/Grafana останутся без изменений."
cancelLabel="Оставить данные"
confirmLabel="Сбросить"
busy={resetting}
onCancel={cancelTrafficReset}
onConfirm={confirmResetTraffic}
/>
</>;
}