mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 08:43:45 +08:00
fix: connections page traffic calculation
This commit is contained in:
parent
1378068a30
commit
bb1dbfcfc3
@ -178,7 +178,7 @@
|
|||||||
"Process": "Process",
|
"Process": "Process",
|
||||||
"Time": "Time",
|
"Time": "Time",
|
||||||
"Source": "Source",
|
"Source": "Source",
|
||||||
"Destination": "Destination IP",
|
"Destination": "Destination",
|
||||||
"DestinationPort": "Destination Port",
|
"DestinationPort": "Destination Port",
|
||||||
"Close Connection": "Close Connection",
|
"Close Connection": "Close Connection",
|
||||||
"Rules": "Rules",
|
"Rules": "Rules",
|
||||||
|
@ -127,9 +127,8 @@ const ConnectionsPage = () => {
|
|||||||
return isPaused ? (frozenData ?? connData) : connData;
|
return isPaused ? (frozenData ?? connData) : connData;
|
||||||
}, [isPaused, frozenData, connData]);
|
}, [isPaused, frozenData, connData]);
|
||||||
|
|
||||||
const [filterConn, download, upload] = useMemo(() => {
|
const [filterConn] = useMemo(() => {
|
||||||
const orderFunc = orderOpts[curOrderOpt];
|
const orderFunc = orderOpts[curOrderOpt];
|
||||||
|
|
||||||
let connections = displayData.connections.filter((conn) => {
|
let connections = displayData.connections.filter((conn) => {
|
||||||
const { host, destinationIP, process } = conn.metadata;
|
const { host, destinationIP, process } = conn.metadata;
|
||||||
return (
|
return (
|
||||||
@ -139,13 +138,7 @@ const ConnectionsPage = () => {
|
|||||||
|
|
||||||
if (orderFunc) connections = orderFunc(connections);
|
if (orderFunc) connections = orderFunc(connections);
|
||||||
|
|
||||||
let download = 0;
|
return [connections];
|
||||||
let upload = 0;
|
|
||||||
connections.forEach((x) => {
|
|
||||||
download += x.download;
|
|
||||||
upload += x.upload;
|
|
||||||
});
|
|
||||||
return [connections, download, upload];
|
|
||||||
}, [displayData, match, curOrderOpt]);
|
}, [displayData, match, curOrderOpt]);
|
||||||
|
|
||||||
const onCloseAll = useLockFn(closeAllConnections);
|
const onCloseAll = useLockFn(closeAllConnections);
|
||||||
@ -181,10 +174,10 @@ const ConnectionsPage = () => {
|
|||||||
header={
|
header={
|
||||||
<Box sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
<Box sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||||
<Box sx={{ mx: 1 }}>
|
<Box sx={{ mx: 1 }}>
|
||||||
{t("Downloaded")}: {parseTraffic(download)}
|
{t("Downloaded")}: {parseTraffic(displayData.downloadTotal)}
|
||||||
</Box>
|
</Box>
|
||||||
<Box sx={{ mx: 1 }}>
|
<Box sx={{ mx: 1 }}>
|
||||||
{t("Uploaded")}: {parseTraffic(upload)}
|
{t("Uploaded")}: {parseTraffic(displayData.uploadTotal)}
|
||||||
</Box>
|
</Box>
|
||||||
<IconButton
|
<IconButton
|
||||||
color="inherit"
|
color="inherit"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user