Commit 9f0732da authored by xuchentao's avatar xuchentao

fix: hide redundant build success message

parent 9489de6e
Pipeline #420 passed with stages
in 17 seconds
...@@ -590,6 +590,7 @@ $("#file").addEventListener("change", async (event) => { ...@@ -590,6 +590,7 @@ $("#file").addEventListener("change", async (event) => {
async function triggerBuild(endpoint, { action = "发布", method = "POST", body } = {}) { async function triggerBuild(endpoint, { action = "发布", method = "POST", body } = {}) {
show("#build-modal"); show("#build-modal");
hide("#close-modal"); hide("#close-modal");
show("#build-log");
$("#build-title").textContent = `正在${action}…`; $("#build-title").textContent = `正在${action}…`;
$("#build-log").textContent = "系统正在更新官网,请稍候。"; $("#build-log").textContent = "系统正在更新官网,请稍候。";
try { try {
...@@ -605,7 +606,11 @@ async function triggerBuild(endpoint, { action = "发布", method = "POST", body ...@@ -605,7 +606,11 @@ async function triggerBuild(endpoint, { action = "发布", method = "POST", body
const state = await api("/build"); const state = await api("/build");
if (state.status === "building") continue; if (state.status === "building") continue;
$("#build-title").textContent = state.ok ? `${action}成功` : `${action}失败`; $("#build-title").textContent = state.ok ? `${action}成功` : `${action}失败`;
$("#build-log").textContent = state.ok ? "静态页面已经生成,官网内容已更新。" : (state.log || `${action}失败,请联系技术人员。`); if (state.ok) {
hide("#build-log");
} else {
$("#build-log").textContent = state.log || `${action}失败,请联系技术人员。`;
}
show("#close-modal"); show("#close-modal");
if (!state.ok) throw new Error(`${action}失败,原文章已恢复,请检查操作日志。`); if (!state.ok) throw new Error(`${action}失败,原文章已恢复,请检查操作日志。`);
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment