hanbaoshan
2020-10-19 c0c79d9b58705a3c8c13ea9f23b1dd0f724a04af
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"
@@ -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,20 @@
      agentName: "",
      members: [],
      innerNodes: [],
      intervalTimer: null,
      joinLoading: false
    };
  },
  mounted() {
    this.findCluster();
    let _this = this;
    this.intervalTimer = setInterval(()=>{
      _this.findCluster();
    },30000);
    this.getEsClusterNodes();
  },
  beforeDestroy(){
    clearInterval(this.intervalTimer);
  },
  methods: {
    cleanValue() {
@@ -342,8 +352,10 @@
    },
    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",
@@ -361,7 +373,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 +521,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;
          });
@@ -805,7 +821,5 @@
  height: 30px;
  line-height: 30px;
}
.nodes-svg {
  background-color: rgba(127, 172, 255, 0.459);
}
</style>