| | |
| | | <el-col :span="12"> |
| | | <el-tabs v-model="activeName" id="e-alaycluster" v-if="!isHasColony"> |
| | | <el-tab-pane label="创建集群" name="1" :disabled="isHasColony"> |
| | | <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="80px"> |
| | | <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px"> |
| | | <el-form-item label="集群名称" prop="clustername"> |
| | | <el-input v-model="ruleForm.clustername" placeholder="手动输入, 如“集群A”" size="small"></el-input> |
| | | </el-form-item> |
| | |
| | | <el-button type="text" slot="suffix" @click="generatePassword">生成密码</el-button> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | <!-- <el-form-item label="虚拟IP" prop="virtualip"> |
| | | <ip-input :ip="ruleForm.virtualip" :on-blur="onIpBlur"></ip-input> |
| | | </el-form-item>--> |
| | | <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:500px"> |
| | | <el-button type="primary" size="small" @click="submitForm('ruleForm')">保存</el-button> |
| | | </el-form-item> |
| | |
| | | </el-tabs> |
| | | <!-- 有集群的情况 --> |
| | | <div v-if="isHasColony" id="h-alaycluster"> |
| | | <el-form :model="ruleForm" ref="ruleForm" label-width="80px"> |
| | | <el-form :model="ruleForm" ref="ruleForm" label-width="100px"> |
| | | <el-form-item label="集群名称" prop="clustername"> |
| | | <el-input v-model="ruleForm.clustername" placeholder="手动输入, 如“集群A”" size="small"></el-input> |
| | | </el-form-item> |
| | |
| | | ></el-input> |
| | | </el-form-item> |
| | | |
| | | <!-- <el-form-item label="虚拟IP" prop="virtualip"> |
| | | <ip-input :ip="ruleForm.virtualip" :on-blur="onIpBlur"></ip-input> |
| | | </el-form-item>--> |
| | | <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;"> |
| | | <el-button size="small" type="danger" @click="leave">退出集群</el-button> |
| | | <el-button |
| | |
| | | </el-form> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="10" style="height: 100%;" v-if="members.length !== 0"> |
| | | <el-col :span="12" style="height: 100%;" v-if="members.length !== 0"> |
| | | <serfDiagram |
| | | ref="diagram" |
| | | :members="members" |
| | | :agent="agentName" |
| | | v-loading="loading" |
| | | @selected-node="joinNode" |
| | | class="nodes-svg" |
| | | ></serfDiagram> |
| | | </el-col> |
| | | </el-row> |
| | | <div class="ui-top-view"> |
| | | <div class="ui-top-title">漂移IP</div> |
| | | </div> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form :model="vrIpForm" ref="vrIpForm" :rules="vrIpRules" style="padding:20px 40px;"> |
| | | <el-form-item label="虚拟IP" prop="virtual_ip"> |
| | | <ip-input :ip="vrIpForm.virtual_ip" :on-blur="onIpBlur"></ip-input> |
| | | <el-switch v-model="vrIpForm.enable" style="margin-left:30px;"></el-switch> |
| | | </el-form-item> |
| | | <el-form-item style="width:500px"> |
| | | <el-button type="primary" size="small" @click="saveForm('vrIpForm')">保存</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <div class="ui-top-view"> |
| | | <div class="ui-top-title">存储集群管理</div> |
| | | </div> |
| | |
| | | </el-tabs> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | |
| | | import serfDiagram from "@/components/serfDiagram"; |
| | | import ipInput from "@/components/subComponents/IPInput"; |
| | | |
| | | import {isIPv4} from "@/scripts/validate"; |
| | | export default { |
| | | components: { |
| | | serfDiagram, |
| | |
| | | } |
| | | }, 1000); |
| | | }; |
| | | |
| | | return { |
| | | activeName: "1", |
| | | sActiveName: "s-first", |
| | |
| | | ruleForm: { |
| | | clustername: "", |
| | | clusterpwd: "", |
| | | //virtualip: "" |
| | | virtualIp: "" |
| | | }, |
| | | vrIpForm: { |
| | | enable: true, |
| | |
| | | { required: true, message: "请输入集群名称", trigger: "change" } |
| | | ], |
| | | clusterpwd: [{ validator: checkPwd, trigger: "change" }], |
| | | // virtualip: [ |
| | | // { required: true, message: "请输入虚拟IP", trigger: "change" } |
| | | // ] |
| | | }, |
| | | vrIpRules: { |
| | | virtualip: [ |
| | | { required: true, message: "请输入虚拟IP", trigger: "change" } |
| | | virtualIp: [ |
| | | { required: true, validator: isIPv4, trigger: "change" } |
| | | ] |
| | | }, |
| | | // vrIpRules: { |
| | | // virtualIp: [ |
| | | // { required: true, message: "请输入虚拟IP", trigger: "change" } |
| | | // ] |
| | | // }, |
| | | joinRules: { |
| | | clusterpwd: [ |
| | | { required: true, message: "请输入集群密码", trigger: "change" }, |
| | |
| | | submitForm(formName) { |
| | | this.$refs[formName].validate(valid => { |
| | | if (valid) { |
| | | debugger |
| | | //alert("submit!"); |
| | | let json = { |
| | | clusterId: this.clusterid, |
| | | clusterName: this.ruleForm.clustername, |
| | | password: this.ruleForm.clusterpwd, |
| | | //virtualip: this.ruleForm.virtualip |
| | | virtualIp: this.ruleForm.virtualIp |
| | | }; |
| | | this.createCluster(json).then(() => { |
| | | this.findCluster(); |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | saveForm(formName) { |
| | | this.$refs[formName].validate(valid => { |
| | | if (valid) { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | join(formName) { |
| | | this.$refs[formName].validate(valid => { |
| | | if (valid) { |
| | |
| | | this.clusterid = res.data.clusterId; |
| | | this.ruleForm.clustername = res.data.clusterName; |
| | | this.ruleForm.clusterpwd = res.data.clusterpwd |
| | | //this.ruleForm.virtualip = res.data.virtualip |
| | | this.ruleForm.virtualIp = res.data.virtualIp |
| | | let list = res.data.nodes.map(i => { |
| | | debugger |
| | | let obj = {}; |
| | | obj.device_type = i.device_type; |
| | | obj.cluster_id = i.cluster_id; |
| | | obj.clusterName = res.data.clusterName; |
| | | obj.create_time = i.create_time; |
| | |
| | | |
| | | this.ruleForm.clusterpwd = uuid.join(""); |
| | | }, |
| | | onIpBlur(ip) { |
| | | this.vrIpForm.virtual_ip = ip; |
| | | }, |
| | | |
| | | async getEsClusterNodes() { |
| | | let rsp = await getDevInfo(); |
| | | let hostIpAddr = ""; |
| | |
| | | message: rsp.msg |
| | | }); |
| | | }) |
| | | }, |
| | | onIpBlur (ip) { |
| | | //this.vrIpForm.virtual_ip = ip; |
| | | this.ruleForm.virtualIp = ip; |
| | | console.log(this.ruleForm.virtualIp) |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | }, |
| | | mounted () { |
| | | this.findCluster(); |
| | | |
| | | }, |
| | | created () { } |
| | | |
| | | }; |
| | | </script> |
| | | <style lang="scss"> |
| | |
| | | height: 30px; |
| | | line-height: 30px; |
| | | } |
| | | .nodes-svg{ |
| | | background-color: aquamarine; |
| | | } |
| | | </style> |