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
5f1d84992c
commit
4040c6d83a
@ -15,7 +15,7 @@ export default function ServerOverviewClient() {
|
|||||||
const { data } = useSWR<ServerApi>("/api/server", nezhaFetcher);
|
const { data } = useSWR<ServerApi>("/api/server", nezhaFetcher);
|
||||||
const disableCartoon = getEnv("NEXT_PUBLIC_DisableCartoon") === "true";
|
const disableCartoon = getEnv("NEXT_PUBLIC_DisableCartoon") === "true";
|
||||||
return (
|
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>
|
<Card>
|
||||||
<CardContent className="px-6 py-3">
|
<CardContent className="px-6 py-3">
|
||||||
<section className="flex flex-col gap-1">
|
<section className="flex flex-col gap-1">
|
||||||
@ -94,9 +94,14 @@ export default function ServerOverviewClient() {
|
|||||||
{t("p_3463-3530_Totalbandwidth")}
|
{t("p_3463-3530_Totalbandwidth")}
|
||||||
</p>
|
</p>
|
||||||
{data ? (
|
{data ? (
|
||||||
<p className="text-lg font-semibold">
|
<section className="flex pt-[4px] items-center gap-2">
|
||||||
{formatBytes(data?.total_bandwidth)}
|
<p className="text-[14px] font-semibold">
|
||||||
</p>
|
↑{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">
|
<div className="flex h-7 items-center">
|
||||||
<Loader visible={true} />
|
<Loader visible={true} />
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
export type ServerApi = {
|
export type ServerApi = {
|
||||||
live_servers: number;
|
live_servers: number;
|
||||||
offline_servers: number;
|
offline_servers: number;
|
||||||
total_bandwidth: number;
|
total_out_bandwidth: number;
|
||||||
|
total_in_bandwidth: number;
|
||||||
result: NezhaAPISafe[];
|
result: NezhaAPISafe[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ export async function GetNezhaData() {
|
|||||||
const data: ServerApi = {
|
const data: ServerApi = {
|
||||||
live_servers: 0,
|
live_servers: 0,
|
||||||
offline_servers: 0,
|
offline_servers: 0,
|
||||||
total_bandwidth: 0,
|
total_out_bandwidth: 0,
|
||||||
|
total_in_bandwidth: 0,
|
||||||
result: [],
|
result: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,7 +62,8 @@ export async function GetNezhaData() {
|
|||||||
data.live_servers += 1;
|
data.live_servers += 1;
|
||||||
element.online_status = true;
|
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.ipv4;
|
||||||
delete element.ipv6;
|
delete element.ipv6;
|
||||||
|
Loading…
Reference in New Issue
Block a user