| | |
| | | clusterip: [{ validator: isIPv4, trigger: "blur" }],
|
| | | clusterpwd: [{ validator: checkPwd, required: true, trigger: "blur" }]
|
| | | },
|
| | | quitInput: ""
|
| | | clusterPassword: "",
|
| | | clusterPasswordInput: ""
|
| | | }
|
| | | },
|
| | | components: {
|
| | |
| | | exitCluster() {
|
| | | const h = this.$createElement
|
| | | let res = {}
|
| | | this.quitInput = ""
|
| | | this.clusterPasswordInput = ""
|
| | | this.$msgbox({
|
| | | title: "",
|
| | | message: h(
|
| | |
| | | h("span", { class: "icon iconfont warn-icon" }, "\ue71c"),
|
| | | h("span", { class: "warn-title" }, "退出集群"),
|
| | | h("input", {
|
| | | attrs: { placeholder: "请输入集群密码", id: "quit-input", class: "warn-title" },
|
| | | attrs: { placeholder: "请输入集群密码", id: "cluster-password", class: "warn-title" },
|
| | | value: "",
|
| | | on: { input: this.onQuitInputChange }
|
| | | })
|
| | |
| | | async () => {
|
| | | clearInterval(this.intervalTimer)
|
| | | try {
|
| | | res = await leave({ password: this.quitInput })
|
| | | res = await leave({ password: this.clusterPasswordInput })
|
| | | if (res && res.success) {
|
| | | this.showCurCluster = false
|
| | | this.ruleForm.virtualIp = ""
|
| | |
| | | )
|
| | | },
|
| | | onQuitInputChange() {
|
| | | this.quitInput = document.getElementById("quit-input").value
|
| | | this.clusterPasswordInput = document.getElementById("cluster-password").value
|
| | | },
|
| | | clearInput(typ) {
|
| | | if (typ == 1) {
|
| | |
| | | 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
|
| | | })
|
| | | }
|
| | | }
|
| | | }
|