From 671e31c148fdd27a573a8d1e3a552783a8f37078 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Sun, 1 Dec 2024 15:57:55 +0800 Subject: [PATCH 1/3] feat(detail): add Load info --- app/(main)/ClientComponents/ServerDetailClient.tsx | 13 +++++++++++++ messages/en.json | 3 ++- messages/ja.json | 1 + messages/zh-t.json | 3 ++- messages/zh.json | 5 +++-- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/(main)/ClientComponents/ServerDetailClient.tsx b/app/(main)/ClientComponents/ServerDetailClient.tsx index 177ccac..0e2a5a0 100644 --- a/app/(main)/ClientComponents/ServerDetailClient.tsx +++ b/app/(main)/ClientComponents/ServerDetailClient.tsx @@ -200,6 +200,19 @@ export default function ServerDetailClient({
+ + +
+

{t("Load")}

+ {data.status.NetInTransfer ? ( +
+ {data.status.Load1} / {data.status.Load5} /{" "} + {data.status.Load15} +
+ ) : null} +
+
+
diff --git a/messages/en.json b/messages/en.json index 74641a5..ad255fd 100644 --- a/messages/en.json +++ b/messages/en.json @@ -71,7 +71,8 @@ "System": "System", "CPU": "CPU", "Upload": "Upload", - "Download": "Download" + "Download": "Download", + "Load": "Load" }, "ServerDetailChartClient": { "chart_fetch_error_message": "Please check your environment variables and review the server console", diff --git a/messages/ja.json b/messages/ja.json index e6c8202..00323aa 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -70,6 +70,7 @@ "Region": "地域", "System": "システム", "CPU": "CPU", + "Load": "負荷", "Upload": "Upload", "Download": "Download" }, diff --git a/messages/zh-t.json b/messages/zh-t.json index 07b76a5..8e82230 100644 --- a/messages/zh-t.json +++ b/messages/zh-t.json @@ -71,7 +71,8 @@ "System": "系統", "CPU": "CPU", "Upload": "上傳", - "Download": "下載" + "Download": "下載", + "Load": "負載" }, "ServerDetailChartClient": { "chart_fetch_error_message": "獲取伺服器詳情失敗,請檢查您的環境變數並檢查伺服器控制台", diff --git a/messages/zh.json b/messages/zh.json index 918e77a..8fdad27 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -71,10 +71,11 @@ "System": "系统", "CPU": "CPU", "Upload": "上传", - "Download": "下载" + "Download": "下载", + "Load": "负载" }, "ServerDetailChartClient": { - "chart_fetch_error_message": "获取服务器详情失败,请检查您的环境变量并检查服务器控制台", + "chart_fetch_error_message": "获取服务器详情失败,请检查您的环境变量并检查服务器控制台", "Process": "进程", "Disk": "磁盘", "Mem": "内存", From 391e356f7ca40af1116edb85346d0c3b5e1e7c32 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Sun, 1 Dec 2024 16:17:34 +0800 Subject: [PATCH 2/3] feat(detail): add chart info --- .../ServerDetailChartClient.tsx | 46 +++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/app/(main)/ClientComponents/ServerDetailChartClient.tsx b/app/(main)/ClientComponents/ServerDetailChartClient.tsx index c2fb955..93c15c3 100644 --- a/app/(main)/ClientComponents/ServerDetailChartClient.tsx +++ b/app/(main)/ClientComponents/ServerDetailChartClient.tsx @@ -6,7 +6,12 @@ import AnimatedCircularProgressBar from "@/components/ui/animated-circular-progr import { Card, CardContent } from "@/components/ui/card"; import { ChartConfig, ChartContainer } from "@/components/ui/chart"; import getEnv from "@/lib/env-entry"; -import { formatNezhaInfo, formatRelativeTime, nezhaFetcher } from "@/lib/utils"; +import { + formatBytes, + formatNezhaInfo, + formatRelativeTime, + nezhaFetcher, +} from "@/lib/utils"; import { useTranslations } from "next-intl"; import { useEffect, useState } from "react"; import { @@ -339,7 +344,7 @@ function MemChart({ data }: { data: NezhaAPISafe }) {
-
+

{t("Mem")}

@@ -368,6 +373,15 @@ function MemChart({ data }: { data: NezhaAPISafe }) {
+
+
+ {formatBytes(data.status.MemUsed)} /{" "} + {formatBytes(data.host.MemTotal)} +
+
+ swap: {formatBytes(data.status.SwapUsed)} +
+

{t("Disk")}

-
-

- {disk.toFixed(0)}% -

- +
+
+

+ {disk.toFixed(0)}% +

+ +
+
+ {formatBytes(data.status.DiskUsed)} /{" "} + {formatBytes(data.host.DiskTotal)} +
Date: Sun, 1 Dec 2024 16:17:51 +0800 Subject: [PATCH 3/3] update: v1.6.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 49b5cbd..abdf347 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nezha-dash", - "version": "1.6.0-fix", + "version": "1.6.1", "private": true, "scripts": { "dev": "next dev -p 3040",