From e9e3db616fd3a1de44c0a1f3df73a39281b4281d Mon Sep 17 00:00:00 2001 From: hanbaoshan <hanbaoshan@aiotlink.com> Date: 星期二, 20 十月 2020 11:26:55 +0800 Subject: [PATCH] 加入集群节点优化,更新虚拟/外部IP名称 --- src/pages/settings/components/ClusterManagement.vue | 42 +++++++++++++++++++++++++++++++----------- 1 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/pages/settings/components/ClusterManagement.vue b/src/pages/settings/components/ClusterManagement.vue index f9aa80c..9f07655 100644 --- a/src/pages/settings/components/ClusterManagement.vue +++ b/src/pages/settings/components/ClusterManagement.vue @@ -30,7 +30,7 @@ <!-- 鍔犲叆宸叉湁闆嗙兢 --> <el-tab-pane label="鍔犲叆宸叉湁闆嗙兢" name="2" :disabled="isHasColony"> - <el-form label-width="80px" :model="joinForm" :rules="joinRules" ref="joinForm"> + <el-form label-width="80px" :model="joinForm" :rules="joinRules" ref="joinForm" v-loading="joinLoading"> <el-form-item label="IP鍦板潃" style="width:440px"> <el-input v-model="joinForm.clusterip" @@ -52,7 +52,7 @@ <!-- <el-button size="mini" :disabled="searchDis" @click="searchColony">鎼滅储闆嗙兢</el-button> <el-button size="mini" @click="stopSearch">鍋滄鎼滅储</el-button>--> </el-form-item> - <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd" style="width:500px"> + <el-form-item label="闆嗙兢瀵嗙爜" prop="clusterpwd" style="width:440px"> <el-input v-model="joinForm.clusterpwd" placeholder="璇疯緭鍏ラ泦缇ゅ瘑鐮�" @@ -85,7 +85,7 @@ ></el-input> </el-form-item> - <el-form-item label="铏氭嫙IP" prop="virtualIp"> + <el-form-item label="铏氭嫙/澶栭儴IP" prop="virtualIp"> <ip-input :ip="ruleForm.virtualIp" :on-blur="onIpBlur"></ip-input> </el-form-item> <el-form-item style="width:440px;text-align: right;"> @@ -111,6 +111,7 @@ :members="members" :agent="agentName" v-loading="loading" + :isShowHover="false" @selected-node="joinNode" class="nodes-svg" ></serfDiagram> @@ -125,7 +126,7 @@ </el-col> </el-row> - <div class="ui-top-view"> + <!-- <div class="ui-top-view"> <div class="ui-top-title">瀛樺偍闆嗙兢绠$悊</div> </div> <el-row> @@ -138,7 +139,7 @@ size="small" @click="createEsCluster()" >鍒涘缓瀛樺偍闆嗙兢</el-button> - <!-- <p>鐐瑰嚮灏嗘湰鏈哄垱寤轰负瀛樺偍闆嗙兢</p> --> + </el-tab-pane> <el-tab-pane label="鍔犲叆宸叉湁闆嗙兢" name="s-second" v-if="sActiveName != 's-third1'"> <el-form label-width="80px"> @@ -175,7 +176,7 @@ </el-tab-pane> </el-tabs> </el-col> - </el-row> + </el-row> --> </div> </template> @@ -288,11 +289,21 @@ agentName: "", members: [], innerNodes: [], + intervalTimer: null, + joinLoading: false, + showJoinConfirm: false }; }, mounted() { this.findCluster(); + let _this = this; + this.intervalTimer = setInterval(()=>{ + _this.findCluster(); + },30000); this.getEsClusterNodes(); + }, + beforeDestroy(){ + clearInterval(this.intervalTimer); }, methods: { cleanValue() { @@ -342,14 +353,17 @@ }, join(formName) { + let _this = this; this.$refs[formName].validate(valid => { if (valid) { + _this.joinLoading = true; if (Object.keys(this.currentCluster).length === 0) { this.$notify({ type: "info", duration: 1000, message: "璇峰厛閫夋嫨涓�涓泦缇よ妭鐐�" }); + _this.joinLoading = false; return true; } let nodeIps = this.members.map(i => { @@ -361,7 +375,11 @@ nodeIps: nodeIps }; this.joinCluster(json).then(() => { + _this.joinLoading = false; this.findCluster(); + }).catch(e=>{ + console.log(e); + _this.joinLoading = false; }); } else { console.log("error submit!!"); @@ -505,7 +523,7 @@ obj.node_ip = i.node_ip; obj.nodeName = i.node_name; obj.Address = i.node_ip; - obj.role = i.role ? i.role : "pc"; + obj.role = i.drift_state ? i.drift_state : "pc"; return obj; }); @@ -583,7 +601,7 @@ }, joinNode(event, node) { - debugger + let _this = this; this.currentCluster.cluster_id = node.cluster_id; if (this.activeName === "3") { this.manageForm.clustername = node.clusterName; @@ -593,6 +611,8 @@ if (this.activeName === "2") { this.$refs["joinForm"].validate(valid => { if (valid) { + if(_this.showJoinConfirm) return; + _this.showJoinConfirm = true; this.$confirm("鏄惁瑕佸姞鍏ヨ妭鐐� " + node.nodeName + "?", "鍔犲叆闆嗙兢", { confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", @@ -612,6 +632,7 @@ // }) console.log(this.currentCluster, '閫夋嫨鐨勯泦缇よ妭鐐�') this.join("joinForm"); + _this.showJoinConfirm = false; }) .catch(() => { this.$notify({ @@ -619,6 +640,7 @@ duration: 1000, message: "宸插彇娑�" }); + _this.showJoinConfirm = false; }); } else { console.log("error submit!!"); @@ -805,7 +827,5 @@ height: 30px; line-height: 30px; } -.nodes-svg { - background-color: rgba(127, 172, 255, 0.459); -} + </style> -- Gitblit v1.8.0