Add device traffic history chart and total breakdown
Build and Deploy Gateway / build-and-push (push) Successful in 14s
Build and Deploy Gateway / deploy (push) Successful in 6s

This commit is contained in:
2026-08-07 18:52:46 +03:00
parent 00a2e1606b
commit cf90fd5b4e
5 changed files with 191 additions and 34 deletions
+11
View File
@@ -37,6 +37,17 @@ export function positiveByteDelta(previous, current) {
return after > before ? formatByteString((after - before).toString()) : '';
}
export function trafficSampleMetrics(gatewayValue, proxyValue, maxValue) {
const gateway = byteString(gatewayValue);
const proxy = byteString(proxyValue);
const total = gateway + proxy;
const max = byteString(maxValue);
return {
height: max && total ? Math.max(10, Math.min(100, Number(total * 100n / max))) : 0,
gatewayShare: total ? Number(gateway * 100n / total) : 0,
};
}
export function sortDevicesByTraffic(devices, direction = 'desc') {
const factor = direction === 'asc' ? 1 : -1;
return (Array.isArray(devices) ? devices : [])