mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 09:31:55 +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 navigate = useNavigate();
|
||||
const { name, country_code, online, cpu, up, down, mem, stg } =
|
||||
formatNezhaInfo(now, serverInfo);
|
||||
const {
|
||||
name,
|
||||
country_code,
|
||||
online,
|
||||
cpu,
|
||||
up,
|
||||
down,
|
||||
mem,
|
||||
stg,
|
||||
net_in_transfer,
|
||||
net_out_transfer,
|
||||
} = formatNezhaInfo(now, serverInfo);
|
||||
|
||||
const showFlag = true;
|
||||
|
||||
@ -108,15 +118,13 @@ export default function ServerCard({
|
||||
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"
|
||||
>
|
||||
{t("serverCard.upload")}:
|
||||
{formatBytes(serverInfo.state.net_out_transfer)}
|
||||
{t("serverCard.upload")}:{formatBytes(net_out_transfer)}
|
||||
</Badge>
|
||||
<Badge
|
||||
variant="outline"
|
||||
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")}:
|
||||
{formatBytes(serverInfo.state.net_in_transfer)}
|
||||
{t("serverCard.download")}:{formatBytes(net_in_transfer)}
|
||||
</Badge>
|
||||
</section>
|
||||
</div>
|
||||
|
@ -22,8 +22,20 @@ export default function ServerCardInline({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const { name, country_code, online, cpu, up, down, mem, stg } =
|
||||
formatNezhaInfo(now, serverInfo);
|
||||
const {
|
||||
name,
|
||||
country_code,
|
||||
online,
|
||||
cpu,
|
||||
up,
|
||||
down,
|
||||
mem,
|
||||
stg,
|
||||
platform,
|
||||
uptime,
|
||||
net_in_transfer,
|
||||
net_out_transfer,
|
||||
} = formatNezhaInfo(now, serverInfo);
|
||||
|
||||
const showFlag = true;
|
||||
|
||||
@ -65,12 +77,10 @@ export default function ServerCardInline({
|
||||
className={"items-center flex flex-row gap-2 whitespace-nowrap"}
|
||||
>
|
||||
<div className="text-xs font-semibold">
|
||||
{serverInfo.host.platform.includes("Windows") ? (
|
||||
{platform.includes("Windows") ? (
|
||||
<MageMicrosoftWindows className="size-[10px]" />
|
||||
) : (
|
||||
<p
|
||||
className={`fl-${GetFontLogoClass(serverInfo.host.platform)}`}
|
||||
/>
|
||||
<p className={`fl-${GetFontLogoClass(platform)}`} />
|
||||
)}
|
||||
</div>
|
||||
<div className={"flex w-14 flex-col"}>
|
||||
@ -78,9 +88,9 @@ export default function ServerCardInline({
|
||||
{t("serverCard.system")}
|
||||
</p>
|
||||
<div className="flex items-center text-[10.5px] font-semibold">
|
||||
{serverInfo.host.platform.includes("Windows")
|
||||
{platform.includes("Windows")
|
||||
? "Windows"
|
||||
: GetOsName(serverInfo.host.platform)}
|
||||
: GetOsName(platform)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -89,7 +99,7 @@ export default function ServerCardInline({
|
||||
{t("serverCard.uptime")}
|
||||
</p>
|
||||
<div className="flex items-center text-xs font-semibold">
|
||||
{(serverInfo.state.uptime / 86400).toFixed(0)} {"Days"}
|
||||
{(uptime / 86400).toFixed(0)} {"Days"}
|
||||
</div>
|
||||
</div>
|
||||
<div className={"flex w-14 flex-col"}>
|
||||
@ -142,7 +152,7 @@ export default function ServerCardInline({
|
||||
{t("serverCard.totalUpload")}
|
||||
</p>
|
||||
<div className="flex items-center text-xs font-semibold">
|
||||
{formatBytes(serverInfo.state.net_out_transfer)}
|
||||
{formatBytes(net_out_transfer)}
|
||||
</div>
|
||||
</div>
|
||||
<div className={"flex w-20 flex-col"}>
|
||||
@ -150,7 +160,7 @@ export default function ServerCardInline({
|
||||
{t("serverCard.totalDownload")}
|
||||
</p>
|
||||
<div className="flex items-center text-xs font-semibold">
|
||||
{formatBytes(serverInfo.state.net_in_transfer)}
|
||||
{formatBytes(net_in_transfer)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -24,6 +24,9 @@ export function formatNezhaInfo(now: number, serverInfo: NezhaServer) {
|
||||
disk: (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,
|
||||
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