heyujie
2021-07-30 4b43bfb3f6f499f480712dd29bef52275466afd6
src/pages/settings/views/clusterManagement.vue
@@ -1,6 +1,6 @@
<template>
  <div class="all">
    <div class="cluster-guanli" v-if="showCurCluster">
    <div class="cluster-guanli" v-if="showCurCluster&& isHasColony">
      <cloud-node :nodes="innerNodes"></cloud-node>
      <div class="bar">
@@ -22,13 +22,13 @@
            >&#xe60c;</span
          >
          <span
            class="icon iconfont"
            class="icon iconfont" style="font-size:21px;"
            @click="clearInput(1)"
            v-show="isFillingName"
            >&#xe649;</span
          >
          <span
            class="icon iconfont"
          <span
            class="icon iconfont" style="font-size:20px;"
            @click="updateCluster(1)"
            v-show="isFillingName"
            >&#xe62a;</span
@@ -65,14 +65,14 @@
            >&#xe60c;</span
          >
          <span
            class="icon iconfont"
            class="icon iconfont" style="font-size:21px;"
            @click="clearInput(2)"
            v-show="isFillingIp"
            >&#xe649;</span
          >
          <span
            class="icon iconfont"
            @click="updateCluster(2)"
            @click="updateCluster(2)" style="font-size:20px;"
            v-show="isFillingIp"
            >&#xe62a;</span
          >
@@ -83,7 +83,7 @@
    </div>
    <div class="cluster-content">
      <div class="cluster-center" ref="left" v-if="!showCurCluster">
      <div class="cluster-center" ref="left" v-if="!showCurCluster|| !isHasColony">
        <div
          class="menu-item"
          :class="activePage == i ? 'menu-item-active' : ''"
@@ -94,7 +94,7 @@
          {{ item }}
        </div>
      </div>
      <div class="cluster-right" v-if="!showCurCluster">
      <div class="cluster-right" v-if="!showCurCluster || !isHasColony">
        <div class="create-new" v-if="activePage == 0">
          <el-form
            :model="ruleForm"
@@ -198,6 +198,7 @@
import {
  createSerfCluster,
  randomPwd,
  leave,
  search,
  getSearchNodes,
  stopSearching,
@@ -284,9 +285,8 @@
  },
  mounted() {
    this.findCluster();
    let _this = this;
    this.intervalTimer = setInterval(() => {
      _this.findCluster();
      this.findCluster();
    }, 30000);
  },
  beforeDestroy() {
@@ -457,12 +457,29 @@
      this.ruleForm.clusterpwd = uuid.join("");
    },
    exitCluster() {
      clearInterval(this.intervalTimer);
      this.showCurCluster = false;
      this.ruleForm.virtualIp = "";
      this.ruleForm.clustername = "";
      this.ruleForm.clusterpwd = "";
      this.clusterid = "";
      this.$confirm("确定退出集群吗?","提示").then(async () => {
          let res = await leave();
          this.$notify({
            title: res.success ? "成功" : "失败",
            message: res.msg,
            type: res.success ? "success" : "error",
          });
          if (res && res.success) {
            clearInterval(this.intervalTimer);
            this.showCurCluster = false;
            this.ruleForm.virtualIp = "";
            this.ruleForm.clustername = "";
            this.ruleForm.clusterpwd = "";
            this.clusterid = "";
          }
      },(err) => {
        clearInterval(this.intervalTimer);
            this.showCurCluster = false;
            this.ruleForm.virtualIp = "";
            this.ruleForm.clustername = "";
            this.ruleForm.clusterpwd = "";
            this.clusterid = "";
      })
    },
    clearInput(typ) {
      if (typ == 1) {
@@ -571,6 +588,9 @@
    padding: 0 20px;
    justify-content: space-between;
    align-items: center;
    .title{
          font-size: 14px;
    }
    .input-area {
      display: flex;
      width: 340px;
@@ -578,6 +598,10 @@
      line-height: 30px;
      justify-content: inherit;
      box-sizing: border-box;
      .icon{
        cursor: pointer;
        // font-size: 18px;
      }
    }
  }
  .exit {
@@ -609,7 +633,7 @@
    padding: 10px;
    border-right: 5px solid #f8f8f8;
    .menu-item {
      background-color: #f8f8f8;
      background-color: #f8f8f8; cursor: pointer;
      height: 50px;
      margin-bottom: 10px;
      border-radius: 8px;