From 0d3db253cad1fb49c4fae9b9a537c8c318c7172f Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期三, 29 十一月 2023 10:23:59 +0800 Subject: [PATCH] 优化应用中心卸载 --- src/pages/settings/views/clusterManagement.vue | 98 +++++++++++++++++++++++++++++++++++++----------- 1 files changed, 75 insertions(+), 23 deletions(-) diff --git a/src/pages/settings/views/clusterManagement.vue b/src/pages/settings/views/clusterManagement.vue index ec80f34..98825dc 100644 --- a/src/pages/settings/views/clusterManagement.vue +++ b/src/pages/settings/views/clusterManagement.vue @@ -252,7 +252,9 @@ clusterid: [{ validator: checkID, trigger: "blur" }], clusterip: [{ validator: isIPv4, trigger: "blur" }], clusterpwd: [{ validator: checkPwd, required: true, trigger: "blur" }] - } + }, + clusterPassword: "", + clusterPasswordInput: "" } }, components: { @@ -262,9 +264,9 @@ }, mounted() { this.findCluster() - this.intervalTimer = setInterval(() => { - this.findCluster() - }, 30000) + // this.intervalTimer = setInterval(() => { + // this.findCluster() + // }, 30000) }, beforeDestroy() { clearInterval(this.intervalTimer) @@ -481,7 +483,7 @@ exitCluster() { const h = this.$createElement let res = {} - + this.clusterPasswordInput = "" this.$msgbox({ title: "", message: h( @@ -492,9 +494,14 @@ [ h("span", { class: "icon iconfont warn-icon" }, "\ue71c"), h("span", { class: "warn-title" }, "閫�鍑洪泦缇�"), - h("span", { class: "warn-dec" }, "纭畾閫�鍑洪泦缇ゅ悧锛�") + h("input", { + attrs: { placeholder: "璇疯緭鍏ラ泦缇ゅ瘑鐮�", id: "cluster-password", class: "warn-title" }, + value: "", + on: { input: this.onQuitInputChange } + }) ] ), + // showInput: true, showCancelButton: true, showClose: true, confirmButtonText: "纭畾", @@ -505,10 +512,10 @@ // this.showCurCluster = false; // } async () => { + clearInterval(this.intervalTimer) try { - res = await leave() + res = await leave({ password: this.clusterPasswordInput }) if (res && res.success) { - clearInterval(this.intervalTimer) this.showCurCluster = false this.ruleForm.virtualIp = "" this.ruleForm.clustername = "" @@ -529,16 +536,11 @@ message: err.msg }) } - }, - (err) => { - clearInterval(this.intervalTimer) - this.showCurCluster = false - this.ruleForm.virtualIp = "" - this.ruleForm.clustername = "" - this.ruleForm.clusterpwd = "" - this.clusterid = "" } ) + }, + onQuitInputChange() { + this.clusterPasswordInput = document.getElementById("cluster-password").value }, clearInput(typ) { if (typ == 1) { @@ -638,13 +640,63 @@ this.innerNodes = [] }, async change2Master() { - let res = await update2Master({ clusterId: this.clusterid, nodeId: this.ruleForm.localId }) - if (res && res.success) { - this.$message.success("鍒囨崲鎴愬姛") - this.findCluster() - } else { - this.$message.warning("鍒囨崲澶辫触") - } + const h = this.$createElement + this.clusterPasswordInput = "" + this.$msgbox({ + title: "", + message: h( + "div", + { + style: "display: flex; flex-direction: column; justify-content: center; align-items: center;" + }, + [ + h("span", { class: "icon iconfont warn-icon" }, "\ue71c"), + h("span", { class: "warn-title" }, "鍒囨崲涓昏妭鐐�"), + h("input", { + attrs: { placeholder: "璇疯緭鍏ラ泦缇ゅ瘑鐮�", id: "cluster-password", class: "warn-title" }, + value: "", + on: { input: this.onQuitInputChange } + }) + ] + ), + // showInput: true, + showCancelButton: true, + showClose: true, + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + customClass: "del-account-message-box" + }) + .then( + // () => { + // this.showCurCluster = false; + // } + async () => { + clearInterval(this.intervalTimer) + try { + let res = await update2Master({ + clusterId: this.clusterid, + nodeId: this.ruleForm.localId, + password: this.clusterPasswordInput + }) + if (res && res.success) { + this.$message.success("鍒囨崲鎴愬姛") + this.findCluster() + } else { + this.$message.warning("鍒囨崲澶辫触, 璇锋鏌ュ瘑鐮�") + this.masterNode = false + } + } catch (err) { + console.log(err) + this.$notify.error({ + title: "澶辫触", + message: err.msg + }) + } + } + ) + .catch(() => { + this.masterNode = false + }) } } } -- Gitblit v1.8.0