db.vue 4.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
<template>
  <div>
19
    <div class="servers-wrapper mysql-model content-wrap" v-show="mysqlList.length">
20 21
      <div class="row" v-for="(item,$index) in mysqlList">
        <div class="col-md-12">
22 23
          <div class="db-title">
            <span>{{item.dbType+$t('Manage')}}</span>
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
          </div>
        </div>
        <div class="col-md-3">
          <div class="text-num-model text">
            <div class="title">
              <span>{{$t('Health status')}}</span>
            </div>
            <div class="value-p">
              <span class="state">
                <i class="iconfont success" v-if="item.state">&#xe607;</i>
                <i class="iconfont error" v-else>&#xe626;</i>
              </span>
            </div>
            <div class="text-1">{{$t('Health status')}}</div>
          </div>
        </div>
        <div class="col-md-3">
          <div class="text-num-model text">
            <div class="title">
              <span>{{$t('Max connections')}} - {{item.date | formatDate}}</span>
            </div>
            <div class="value-p">
              <b :style="{color:color[0]}">{{item.maxConnections}}</b>
            </div>
            <div class="text-1">{{$t('Max connections')}}</div>
          </div>
        </div>
        <div class="col-md-3">
          <div class="text-num-model text">
            <div class="title">
              <span>{{$t('Threads connections')}}</span>
            </div>
            <div class="value-p">
              <b :style="{color:color[8]}">{{item.threadsConnections}}</b>
            </div>
            <div class="text-1">{{$t('Threads connections')}}</div>
          </div>
        </div>
        <!-- <div class="col-md-2">
            <div class="text-num-model text">
              <div class="title">
                <span>{{$t('Max used connections')}}</span>
              </div>
              <div class="value-p">
                <b :style="{color:color[2]}">{{item.maxUsedConnections}}</b>
              </div>
              <div class="text-1">
                {{$t('Max used connections')}}
              </div>
            </div>
        </div>-->
        <div class="col-md-3">
          <div class="text-num-model text">
            <div class="title">
              <span>{{$t('Threads running connections')}}</span>
            </div>
            <div class="value-p">
              <b :style="{color:color[4]}">{{item.threadsRunningConnections}}</b>
            </div>
            <div class="text-1">{{$t('Threads running connections')}}</div>
          </div>
        </div>
      </div>
    </div>
    <div v-if="!mysqlList.length">
      <m-no-data></m-no-data>
    </div>
    <m-spin :is-spin="isLoading"></m-spin>
  </div>
</template>
<script>
import { mapActions } from "vuex";
import mList from "./_source/zookeeperList";
import mSpin from "@/module/components/spin/spin";
import mNoData from "@/module/components/noData/noData";
import themeData from "@/module/echarts/themeData.json";
import mListConstruction from "@/module/components/listConstruction/listConstruction";

export default {
  name: "servers-mysql",
  data() {
    return {
      isLoading: false,
      mysqlList: [],
      color: themeData.color
    };
  },
  props: {},
  methods: {
    ...mapActions("monitor", ["getDatabaseData"])
  },
  watch: {},
  created() {
    this.isLoading = true;
    this.getDatabaseData()
      .then(res => {
        this.mysqlList = res;
        this.isLoading = false;
      })
      .catch(() => {
        this.isLoading = false;
      });
  },
  mounted() {},
  components: { mList, mListConstruction, mSpin, mNoData }
};
</script>
<style lang="scss" rel="stylesheet/scss">
@import "./servers";
133
.content-wrap {
134 135 136 137 138
  background: #fff;
  min-height: calc(100vh - 100px);
  margin: 20px;
}
.db-title {
139 140 141
  height: 48px;
  background: #f8fbfe;
  border-radius: 3px 3px 0 0;
142
  margin: -16px -16px 10px -16px;
143 144 145 146 147 148 149 150 151
  span {
    font-size: 22px;
    padding-left: 18px;
    padding-top: 10px;
    display: inline-block;
    color: #2a455b;
  }
}
</style>