This commit is contained in:
hailin 2025-05-20 14:20:24 +08:00
parent 0493cf4a92
commit b433a34747
3 changed files with 41 additions and 5 deletions

View File

@ -43,6 +43,7 @@ import { Trash2 } from "lucide-react";
import { useEffect } from "react"; import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { import {
BadgeInfo, BadgeInfo,
@ -417,6 +418,8 @@ export function DetailPageHeader({ data }: { data: any }) {
const [canDeploy, setCanDeploy] = useState(true); const [canDeploy, setCanDeploy] = useState(true);
const socketRef = useRef<WebSocket | null>(null); const socketRef = useRef<WebSocket | null>(null);
const { t } = useTranslation();
const initWebSocket = (userName: string, id: number) => { const initWebSocket = (userName: string, id: number) => {
if (socketRef.current) socketRef.current.close(); if (socketRef.current) socketRef.current.close();
@ -607,10 +610,10 @@ export function DetailPageHeader({ data }: { data: any }) {
setCanDeploy(false); // ✅ 已部署/已停止,不允许再次 deploy setCanDeploy(false); // ✅ 已部署/已停止,不允许再次 deploy
if (status === "running") { if (status === "running") {
setStatusText("运行中"); setStatusText(t("status.running"));
setProgressBarColor("bg-green-500"); setProgressBarColor("bg-green-500");
} else if (status === "stopped") { } else if (status === "stopped") {
setStatusText("已停止"); setStatusText(t("status.stopped"));
setProgressBarColor("bg-gray-400"); setProgressBarColor("bg-gray-400");
} }
} else { } else {
@ -781,9 +784,6 @@ export function DetailPageHeader({ data }: { data: any }) {
)} )}
</div> </div>
</div> </div>
); );

View File

@ -67,6 +67,24 @@
"update_subscriptions": "Update subscriptions", "update_subscriptions": "Update subscriptions",
"subscribe": "Subscribe" "subscribe": "Subscribe"
}, },
"deploy": {
"starting": "Starting deployment...",
"running": "Running",
"stopped": "Stopped",
"not_deployed": "Not deployed yet",
"progress_prefix": "Progress",
"deleting": "Deleting deployment...",
"deletion_success": "Deleted successfully",
"deletion_failed": "Deletion failed",
"request_failed": "Request failed",
"ws_error": "WebSocket error",
"deploying": "Deploying...",
"fetching_status": "Fetching status...",
"done": "Deployment complete",
"status_prefix": "Status",
"retry": "Retry",
"loading": "Loading..."
},
"footer": { "footer": {
"thank_subscription": "Thank you for your subscription", "thank_subscription": "Thank you for your subscription",
"subscribe_success": "Subscription Successful", "subscribe_success": "Subscription Successful",

View File

@ -67,6 +67,24 @@
"update_subscriptions": "更新订阅", "update_subscriptions": "更新订阅",
"subscribe": "订阅" "subscribe": "订阅"
}, },
"deploy": {
"starting": "正在启动部署...",
"running": "运行中",
"stopped": "已停止",
"not_deployed": "尚未部署",
"progress_prefix": "进度",
"deleting": "正在删除部署...",
"deletion_success": "删除成功",
"deletion_failed": "删除失败",
"request_failed": "请求失败",
"ws_error": "WebSocket 出错",
"deploying": "部署中...",
"fetching_status": "正在拉取状态...",
"done": "部署完成",
"status_prefix": "状态",
"retry": "重试",
"loading": "加载中..."
},
"footer": { "footer": {
"thank_subscription": "感谢您的订阅", "thank_subscription": "感谢您的订阅",
"subscribe_success": "订阅成功", "subscribe_success": "订阅成功",