Merge pull request #25 from TinyAllen/develop

merge develop
diff --git a/README.md b/README.md
index da32ce2..fd59a4e 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 <h1 align="center"></h1>
 
 <p align="center">
-<a><img src="https://img.shields.io/badge/version-1.0.1-blue.svg?longCache=true&style=popout-square"></a>
+<a><img src="https://img.shields.io/badge/version-1.0.2-blue.svg?longCache=true&style=popout-square"></a>
 <a href="https://github.com/TinyAllen/rocketbot/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg?longCache=true&style=popout-square"></a>
 <a href="https://github.com/TinyAllen/rocketbot/blob/master/LICENSE"><img src="https://img.shields.io/badge/support by-Daocloud Lab-brightgreen.svg?longCache=true&style=popout-square"></a>
 <a><img src="https://img.shields.io/badge/base-Skywalking-red.svg?longCache=true&style=popout-square"></a>
@@ -136,7 +136,6 @@
 
 #### WeChat
 <p>
-  <img width="160" src="https://user-images.githubusercontent.com/19775780/47762068-03e1df00-dcf6-11e8-9315-cc17b28383e7.jpeg"/>
   <img width="160" src="https://user-images.githubusercontent.com/19775780/47297000-814a8700-d646-11e8-8ff6-c2748555ceca.jpeg"/>
 </p>
 
diff --git a/config/index.js b/config/index.js
index ed45fb5..ba9285f 100644
--- a/config/index.js
+++ b/config/index.js
@@ -12,8 +12,8 @@
     assetsPublicPath: '/',
     proxyTable: {
       "/api":{
-        // target: "http://192.168.1.250:12800/",
-        target: "http://106.75.237.45:12800/",
+        target: "http://192.168.1.250:12800/",
+        // target: "http://106.75.237.45:12800/",
         changeOrigin: true,
         pathRewrite:  (path) => {
           return "/graphql"
diff --git a/src/api/index.ts b/src/api/index.ts
index e06c288..d9d07ac 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -71,6 +71,57 @@
       label: name
       value
     }
+    getServiceInstanceThroughput: getServiceInstanceTopN(
+      serviceId: $applicationId
+      duration: $duration
+      name: "service_instance_cpm",
+      topN: 10,
+      order: DES
+    ) {
+      key: id
+      name
+      value
+    }
+    getP99: getLinearIntValues(metric: {
+      name: "service_p99"
+      id: $applicationId
+    }, duration: $duration) {
+      values {
+        value
+      }
+    }
+    getP95: getLinearIntValues(metric: {
+      name: "service_p95"
+      id: $applicationId
+    }, duration: $duration) {
+      values {
+        value
+      }
+    }
+    getP90: getLinearIntValues(metric: {
+      name: "service_p90"
+      id: $applicationId
+    }, duration: $duration) {
+      values {
+        value
+      }
+    }
+    getP75: getLinearIntValues(metric: {
+      name: "service_p75"
+      id: $applicationId
+    }, duration: $duration) {
+      values {
+        value
+      }
+    }
+    getP50: getLinearIntValues(metric: {
+      name: "service_p50"
+      id: $applicationId
+    }, duration: $duration) {
+      values {
+        value
+      }
+    }
     servers:  getServiceInstances(duration: $duration, serviceId: $applicationId) {
       key: id
       name
diff --git a/src/main.ts b/src/main.ts
index af50465..447d434 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -30,6 +30,6 @@
 
 try {
   if (window.console && window.console.log) {
-    console.log('%c Rocketbot v1.0.1 %c Powered By Daocloud Lab %c', 'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff', 'background:#3880ff ; padding: 1px; border-radius: 0 3px 3px 0;  color: #fff', 'background:transparent');
+    console.log('%c Rocketbot v1.0.2 %c Powered By Daocloud Lab %c', 'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff', 'background:#3880ff ; padding: 1px; border-radius: 0 3px 3px 0;  color: #fff', 'background:transparent');
   }
 } catch (e) {}
diff --git a/src/store/modules/options.ts b/src/store/modules/options.ts
index f7f61fc..33469a7 100644
--- a/src/store/modules/options.ts
+++ b/src/store/modules/options.ts
@@ -23,6 +23,7 @@
   applications: Option[];
   endpoints: Option[];
   servers: Server[];
+  serversThroughput: Server[];
   serviceSlow: SlowEndpoint[];
   currentApplication: Option;
   currentEndpoint: Option;
@@ -33,6 +34,7 @@
   applications: [],
   endpoints: [],
   servers: [],
+  serversThroughput: [],
   serviceSlow: [],
   currentApplication: {
     key: '',
@@ -77,6 +79,11 @@
           i.name = `${i.pid}@${i.ipv4[0]}`;
         }
       });
+      if (res.data.data.getServiceInstanceThroughput) {
+        context.commit(types.SET_SERVERS_THROUGHPUT, res.data.data.getServiceInstanceThroughput);
+      } else {
+        context.commit(types.SET_SERVERS_THROUGHPUT, res.data.data.servers);
+      }
       context.commit(types.SET_SERVERS, res.data.data.servers);
       context.commit(types.SET_SLOWENDPOINT, res.data.data.serviceSlowEndpoint);
       // context.commit(types.SET_SERVER, res.data.data.servers[0]);
@@ -95,6 +102,9 @@
   [types.SET_SERVERS](state: State, data: Server[]) {
     state.servers = data;
   },
+  [types.SET_SERVERS_THROUGHPUT](state: State, data: Server[]) {
+    state.serversThroughput = data;
+  },
   [types.SET_SLOWENDPOINT](state: State, data: SlowEndpoint[]) {
     state.serviceSlow = data;
   },
diff --git a/src/store/mutation-types.ts b/src/store/mutation-types.ts
index 4c767ba..04f0f33 100644
--- a/src/store/mutation-types.ts
+++ b/src/store/mutation-types.ts
@@ -14,6 +14,7 @@
 export const SET_ENDPOINT = 'SET_ENDPOINT';
 export const SET_SERVER = 'SET_SERVER';
 export const SET_SLOWENDPOINT = 'SET_SLOWENDPOINT';
+export const SET_SERVERS_THROUGHPUT = 'SET_SERVERS_THROUGHPUT';
 
 export const SET_ENDPOINT_INFO = 'SET_ENDPOINT_INFO';
 export const SET_APPLICATION_INFO = 'SET_APPLICATION_INFO';
diff --git a/src/views/components/dashboard/server-throughput.vue b/src/views/components/dashboard/server-throughput.vue
new file mode 100644
index 0000000..343c4dc
--- /dev/null
+++ b/src/views/components/dashboard/server-throughput.vue
@@ -0,0 +1,41 @@
+<template>
+<rk-panel class="rk-server-throughput" title="Server Throughputs">
+  <div class="mb15" v-for="i in fiveData" :key="i.key">
+    <div>
+      <span class="r sm">{{i.value}} calls/ m</span>
+      <div class="mb5">
+        <Tooltip :content="i" max-width="300" placement="top" class="ell" style="max-width: 300px;">
+          <span class="cp link-hover" @click="appChange(i)">{{i.name}}</span>
+        </Tooltip>
+      </div>
+    </div>
+    <RkProgress :precent="i.value/maxValue*100" color="#bf99f8"/>
+  </div>
+</rk-panel>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+import { State } from 'vuex-class';
+import { Component } from 'vue-property-decorator';
+import { appChange } from '@/store/dispatch/dashboard.ts';
+
+@Component({})
+export default class RkChartBox extends Vue {
+  @State('options') stateOptions;
+  changeApp = appChange;
+  appChange(i) {
+    const temp = { key: `${i.key}`, label: i.label };
+    this.changeApp(temp);
+  }
+  get fiveData() {
+    return [...this.stateOptions.serversThroughput];
+  }
+  get maxValue() {
+    const temp:Number[] = this.fiveData.map(i => i.value);
+    return Math.max.apply(null, temp);
+  }
+}
+</script>
+<style lang="scss">
+</style>
diff --git a/src/views/containers/dashboard.vue b/src/views/containers/dashboard.vue
index d6dc59f..110875c 100644
--- a/src/views/containers/dashboard.vue
+++ b/src/views/containers/dashboard.vue
@@ -39,6 +39,7 @@
       <ChartCpu class="mr10"/>
       <ChartGc/>
     </div>
+    <ServerThroughput/>
   </rk-sidebox>
 </div>
 </template>
@@ -61,6 +62,7 @@
 import SlowService from '../components/dashboard/slow-service.vue';
 import SlowAppService from '../components/dashboard/slow-app-service.vue';
 import TopSlow from '../components/dashboard/top-slow.vue';
+import ServerThroughput from '../components/dashboard/server-throughput.vue';
 
 @Component({
   components: {
@@ -77,6 +79,7 @@
     ChartCpu,
     ChartGc,
     SlowAppService,
+    ServerThroughput,
   },
 })