mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
feat: separate upload and download traffic display
This commit is contained in:
parent
f6ef1877bf
commit
95fcb521c1
@ -15,7 +15,7 @@ export default function ServerOverviewClient() {
|
||||
const { data } = useSWR<ServerApi>("/api/server", nezhaFetcher);
|
||||
const disableCartoon = getEnv("NEXT_PUBLIC_DisableCartoon") === "true";
|
||||
return (
|
||||
<section className="grid grid-cols-2 gap-4 md:grid-cols-4">
|
||||
<section className="grid grid-cols-2 gap-4 lg:grid-cols-4">
|
||||
<Card>
|
||||
<CardContent className="px-6 py-3">
|
||||
<section className="flex flex-col gap-1">
|
||||
@ -94,9 +94,14 @@ export default function ServerOverviewClient() {
|
||||
{t("p_3463-3530_Totalbandwidth")}
|
||||
</p>
|
||||
{data ? (
|
||||
<p className="text-lg font-semibold">
|
||||
{formatBytes(data?.total_bandwidth)}
|
||||
</p>
|
||||
<section className="flex pt-[4px] items-center gap-2">
|
||||
<p className="text-[14px] font-semibold">
|
||||
↑{formatBytes(data?.total_out_bandwidth)}
|
||||
</p>
|
||||
<p className="text-[14px] font-semibold">
|
||||
↓{formatBytes(data?.total_in_bandwidth)}
|
||||
</p>
|
||||
</section>
|
||||
) : (
|
||||
<div className="flex h-7 items-center">
|
||||
<Loader visible={true} />
|
||||
|
@ -1,7 +1,8 @@
|
||||
export type ServerApi = {
|
||||
live_servers: number;
|
||||
offline_servers: number;
|
||||
total_bandwidth: number;
|
||||
total_out_bandwidth: number;
|
||||
total_in_bandwidth: number;
|
||||
result: NezhaAPISafe[];
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,8 @@ export async function GetNezhaData() {
|
||||
const data: ServerApi = {
|
||||
live_servers: 0,
|
||||
offline_servers: 0,
|
||||
total_bandwidth: 0,
|
||||
total_out_bandwidth: 0,
|
||||
total_in_bandwidth: 0,
|
||||
result: [],
|
||||
};
|
||||
|
||||
@ -61,7 +62,8 @@ export async function GetNezhaData() {
|
||||
data.live_servers += 1;
|
||||
element.online_status = true;
|
||||
}
|
||||
data.total_bandwidth += element.status.NetOutTransfer;
|
||||
data.total_out_bandwidth += element.status.NetOutTransfer;
|
||||
data.total_in_bandwidth += element.status.NetInTransfer;
|
||||
|
||||
delete element.ipv4;
|
||||
delete element.ipv6;
|
||||
|
Loading…
Reference in New Issue
Block a user