mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 17:41:56 +08:00
fix: display error
This commit is contained in:
parent
c8796545c1
commit
6344064977
@ -18,8 +18,18 @@ export default function ServerCard({
|
|||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { name, country_code, online, cpu, up, down, mem, stg } =
|
const {
|
||||||
formatNezhaInfo(now, serverInfo);
|
name,
|
||||||
|
country_code,
|
||||||
|
online,
|
||||||
|
cpu,
|
||||||
|
up,
|
||||||
|
down,
|
||||||
|
mem,
|
||||||
|
stg,
|
||||||
|
net_in_transfer,
|
||||||
|
net_out_transfer,
|
||||||
|
} = formatNezhaInfo(now, serverInfo);
|
||||||
|
|
||||||
const showFlag = true;
|
const showFlag = true;
|
||||||
|
|
||||||
@ -108,15 +118,13 @@ export default function ServerCard({
|
|||||||
variant="secondary"
|
variant="secondary"
|
||||||
className="items-center flex-1 justify-center rounded-[8px] text-nowrap text-[11px] border-muted-50 shadow-md shadow-neutral-200/30 dark:shadow-none"
|
className="items-center flex-1 justify-center rounded-[8px] text-nowrap text-[11px] border-muted-50 shadow-md shadow-neutral-200/30 dark:shadow-none"
|
||||||
>
|
>
|
||||||
{t("serverCard.upload")}:
|
{t("serverCard.upload")}:{formatBytes(net_out_transfer)}
|
||||||
{formatBytes(serverInfo.state.net_out_transfer)}
|
|
||||||
</Badge>
|
</Badge>
|
||||||
<Badge
|
<Badge
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="items-center flex-1 justify-center rounded-[8px] text-nowrap text-[11px] shadow-md shadow-neutral-200/30 dark:shadow-none"
|
className="items-center flex-1 justify-center rounded-[8px] text-nowrap text-[11px] shadow-md shadow-neutral-200/30 dark:shadow-none"
|
||||||
>
|
>
|
||||||
{t("serverCard.download")}:
|
{t("serverCard.download")}:{formatBytes(net_in_transfer)}
|
||||||
{formatBytes(serverInfo.state.net_in_transfer)}
|
|
||||||
</Badge>
|
</Badge>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,8 +22,20 @@ export default function ServerCardInline({
|
|||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { name, country_code, online, cpu, up, down, mem, stg } =
|
const {
|
||||||
formatNezhaInfo(now, serverInfo);
|
name,
|
||||||
|
country_code,
|
||||||
|
online,
|
||||||
|
cpu,
|
||||||
|
up,
|
||||||
|
down,
|
||||||
|
mem,
|
||||||
|
stg,
|
||||||
|
platform,
|
||||||
|
uptime,
|
||||||
|
net_in_transfer,
|
||||||
|
net_out_transfer,
|
||||||
|
} = formatNezhaInfo(now, serverInfo);
|
||||||
|
|
||||||
const showFlag = true;
|
const showFlag = true;
|
||||||
|
|
||||||
@ -65,12 +77,10 @@ export default function ServerCardInline({
|
|||||||
className={"items-center flex flex-row gap-2 whitespace-nowrap"}
|
className={"items-center flex flex-row gap-2 whitespace-nowrap"}
|
||||||
>
|
>
|
||||||
<div className="text-xs font-semibold">
|
<div className="text-xs font-semibold">
|
||||||
{serverInfo.host.platform.includes("Windows") ? (
|
{platform.includes("Windows") ? (
|
||||||
<MageMicrosoftWindows className="size-[10px]" />
|
<MageMicrosoftWindows className="size-[10px]" />
|
||||||
) : (
|
) : (
|
||||||
<p
|
<p className={`fl-${GetFontLogoClass(platform)}`} />
|
||||||
className={`fl-${GetFontLogoClass(serverInfo.host.platform)}`}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={"flex w-14 flex-col"}>
|
<div className={"flex w-14 flex-col"}>
|
||||||
@ -78,9 +88,9 @@ export default function ServerCardInline({
|
|||||||
{t("serverCard.system")}
|
{t("serverCard.system")}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex items-center text-[10.5px] font-semibold">
|
<div className="flex items-center text-[10.5px] font-semibold">
|
||||||
{serverInfo.host.platform.includes("Windows")
|
{platform.includes("Windows")
|
||||||
? "Windows"
|
? "Windows"
|
||||||
: GetOsName(serverInfo.host.platform)}
|
: GetOsName(platform)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -89,7 +99,7 @@ export default function ServerCardInline({
|
|||||||
{t("serverCard.uptime")}
|
{t("serverCard.uptime")}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex items-center text-xs font-semibold">
|
<div className="flex items-center text-xs font-semibold">
|
||||||
{(serverInfo.state.uptime / 86400).toFixed(0)} {"Days"}
|
{(uptime / 86400).toFixed(0)} {"Days"}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={"flex w-14 flex-col"}>
|
<div className={"flex w-14 flex-col"}>
|
||||||
@ -142,7 +152,7 @@ export default function ServerCardInline({
|
|||||||
{t("serverCard.totalUpload")}
|
{t("serverCard.totalUpload")}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex items-center text-xs font-semibold">
|
<div className="flex items-center text-xs font-semibold">
|
||||||
{formatBytes(serverInfo.state.net_out_transfer)}
|
{formatBytes(net_out_transfer)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={"flex w-20 flex-col"}>
|
<div className={"flex w-20 flex-col"}>
|
||||||
@ -150,7 +160,7 @@ export default function ServerCardInline({
|
|||||||
{t("serverCard.totalDownload")}
|
{t("serverCard.totalDownload")}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex items-center text-xs font-semibold">
|
<div className="flex items-center text-xs font-semibold">
|
||||||
{formatBytes(serverInfo.state.net_in_transfer)}
|
{formatBytes(net_in_transfer)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -24,6 +24,9 @@ export function formatNezhaInfo(now: number, serverInfo: NezhaServer) {
|
|||||||
disk: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0,
|
disk: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0,
|
||||||
stg: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0,
|
stg: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0,
|
||||||
country_code: serverInfo.country_code,
|
country_code: serverInfo.country_code,
|
||||||
|
platform: serverInfo.host.platform || "",
|
||||||
|
net_out_transfer: serverInfo.state.net_out_transfer || 0,
|
||||||
|
net_in_transfer: serverInfo.state.net_in_transfer || 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user