fix(detail): chart detail info

This commit is contained in:
hamster1963 2024-12-02 02:42:45 +08:00
parent a9186f1148
commit 924f7e24bd
2 changed files with 10 additions and 5 deletions

View File

@ -354,10 +354,17 @@ function MemChart({ now, data }: { now: number; data: NezhaServer }) {
<section className="flex flex-col items-end gap-0.5"> <section className="flex flex-col items-end gap-0.5">
<div className="flex text-[11px] font-medium items-center gap-2"> <div className="flex text-[11px] font-medium items-center gap-2">
{formatBytes(data.state.mem_used)} /{" "} {formatBytes(data.state.mem_used)} /{" "}
{formatBytes(data.state.mem_total)} {formatBytes(data.host.mem_total)}
</div> </div>
<div className="flex text-[11px] font-medium items-center gap-2"> <div className="flex text-[11px] font-medium items-center gap-2">
swap: {formatBytes(data.state.swap_used)} {data.host.swap_total ? (
<>
swap: {formatBytes(data.state.swap_used)} /{" "}
{formatBytes(data.host.swap_total)}
</>
) : (
<>no swap</>
)}
</div> </div>
</section> </section>
</div> </div>
@ -468,7 +475,7 @@ function DiskChart({ now, data }: { now: number; data: NezhaServer }) {
</section> </section>
<div className="flex text-[11px] font-medium items-center gap-2"> <div className="flex text-[11px] font-medium items-center gap-2">
{formatBytes(data.state.disk_used)} /{" "} {formatBytes(data.state.disk_used)} /{" "}
{formatBytes(data.state.disk_total)} {formatBytes(data.host.disk_total)}
</div> </div>
</section> </section>
</div> </div>

View File

@ -28,10 +28,8 @@ export interface NezhaServerHost {
export interface NezhaServerStatus { export interface NezhaServerStatus {
cpu: number; cpu: number;
mem_used: number; mem_used: number;
mem_total: number;
swap_used: number; swap_used: number;
disk_used: number; disk_used: number;
disk_total: number;
net_in_transfer: number; net_in_transfer: number;
net_out_transfer: number; net_out_transfer: number;
net_in_speed: number; net_in_speed: number;