| | |
| | | |
| | | <!-- 加入已有集群 --> |
| | | <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" |
| | |
| | | <!-- <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="请输入集群密码" |
| | |
| | | ></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;"> |
| | |
| | | :members="members" |
| | | :agent="agentName" |
| | | v-loading="loading" |
| | | :isShowHover="false" |
| | | @selected-node="joinNode" |
| | | class="nodes-svg" |
| | | ></serfDiagram> |
| | |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <div class="ui-top-view"> |
| | | <!-- <div class="ui-top-view"> |
| | | <div class="ui-top-title">存储集群管理</div> |
| | | </div> |
| | | <el-row> |
| | |
| | | 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"> |
| | |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </el-col> |
| | | </el-row> |
| | | </el-row> --> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | 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() { |
| | |
| | | }, |
| | | |
| | | 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 => { |
| | |
| | | nodeIps: nodeIps |
| | | }; |
| | | this.joinCluster(json).then(() => { |
| | | _this.joinLoading = false; |
| | | this.findCluster(); |
| | | }).catch(e=>{ |
| | | console.log(e); |
| | | _this.joinLoading = false; |
| | | }); |
| | | } else { |
| | | console.log("error submit!!"); |
| | |
| | | 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; |
| | | }); |
| | | |
| | |
| | | |
| | | }, |
| | | joinNode(event, node) { |
| | | debugger |
| | | let _this = this; |
| | | this.currentCluster.cluster_id = node.cluster_id; |
| | | if (this.activeName === "3") { |
| | | this.manageForm.clustername = node.clusterName; |
| | |
| | | if (this.activeName === "2") { |
| | | this.$refs["joinForm"].validate(valid => { |
| | | if (valid) { |
| | | if(_this.showJoinConfirm) return; |
| | | _this.showJoinConfirm = true; |
| | | this.$confirm("是否要加入节点 " + node.nodeName + "?", "加入集群", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | |
| | | // }) |
| | | console.log(this.currentCluster, '选择的集群节点') |
| | | this.join("joinForm"); |
| | | _this.showJoinConfirm = false; |
| | | }) |
| | | .catch(() => { |
| | | this.$notify({ |
| | |
| | | duration: 1000, |
| | | message: "已取消" |
| | | }); |
| | | _this.showJoinConfirm = false; |
| | | }); |
| | | } else { |
| | | console.log("error submit!!"); |
| | |
| | | height: 30px; |
| | | line-height: 30px; |
| | | } |
| | | .nodes-svg { |
| | | background-color: rgba(127, 172, 255, 0.459); |
| | | } |
| | | |
| | | </style> |