mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
fix: sort
This commit is contained in:
parent
1f4c58457d
commit
950a20f60c
@ -107,12 +107,14 @@ export default function ServerListClient() {
|
|||||||
: filteredServersByStatus.filter((server) => server.tag === tag);
|
: filteredServersByStatus.filter((server) => server.tag === tag);
|
||||||
|
|
||||||
if (filter) {
|
if (filter) {
|
||||||
// 根据使用速度进行从高到低排序
|
|
||||||
filteredServers.sort((a, b) => {
|
filteredServers.sort((a, b) => {
|
||||||
|
if (!a.online_status && b.online_status) return 1;
|
||||||
|
if (a.online_status && !b.online_status) return -1;
|
||||||
|
if (!a.online_status && !b.online_status) return 0;
|
||||||
return (
|
return (
|
||||||
b.status.NetInSpeed +
|
b.status.NetInSpeed +
|
||||||
b.status.NetOutSpeed -
|
b.status.NetOutSpeed -
|
||||||
(a.status.NetInSpeed + b.status.NetOutSpeed)
|
(a.status.NetInSpeed + a.status.NetOutSpeed)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user