This commit is contained in:
hailin 2025-04-02 22:53:07 +08:00
parent 17bd1c941c
commit d36c396db1
1 changed files with 6 additions and 0 deletions

View File

@ -515,6 +515,8 @@ export function DetailPageHeader({ data }: { data: any }) {
console.log("====> deploy status result:", result); console.log("====> deploy status result:", result);
const status = result?.data?.data?.status; const status = result?.data?.data?.status;
console.log("🟡 [fetch] 拉取状态 status =", status);
const userData = JSON.parse(localStorage.getItem("UserData") || "null"); const userData = JSON.parse(localStorage.getItem("UserData") || "null");
const userName = userData?.user_name; const userName = userData?.user_name;
const id = data?.id; const id = data?.id;
@ -522,11 +524,13 @@ export function DetailPageHeader({ data }: { data: any }) {
setStatusLoaded(true); setStatusLoaded(true);
if (status === "deploying" && userName && id && !hasWSConnected) { if (status === "deploying" && userName && id && !hasWSConnected) {
console.log("🔄 自动连接 WebSocket: 正在部署中...");
setStatusText("检测到正在部署,连接中..."); setStatusText("检测到正在部署,连接中...");
initWebSocket(userName, id); initWebSocket(userName, id);
} }
if (!result || result.header?.code !== 1006) { if (!result || result.header?.code !== 1006) {
console.warn("🚫 状态接口返回失败或 code 错误", result.header);
setStatusText(result?.header?.message || "操作失败(后端返回错误)"); setStatusText(result?.header?.message || "操作失败(后端返回错误)");
setShowDelete(false); setShowDelete(false);
return; return;
@ -536,8 +540,10 @@ export function DetailPageHeader({ data }: { data: any }) {
// ✅ 只在 running / stopped 显示删除按钮 // ✅ 只在 running / stopped 显示删除按钮
if (status === "running" || status === "stopped") { if (status === "running" || status === "stopped") {
console.log("✅ 状态允许删除,显示删除按钮");
setShowDelete(true); setShowDelete(true);
} else { } else {
console.log("❌ 状态不允许删除,隐藏按钮");
setShowDelete(false); setShowDelete(false);
} }
} catch (err) { } catch (err) {