You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2020/04/15 13:53:06 UTC

[skywalking-rocketbot-ui] branch master updated: Fix: refresh detect point data (#282)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-rocketbot-ui.git


The following commit(s) were added to refs/heads/master by this push:
     new 52a56d3  Fix: refresh detect point data (#282)
52a56d3 is described below

commit 52a56d3ee273a3629d3ac48ba7eb99d8ba694ca9
Author: Qiuxia Fan <fi...@outlook.com>
AuthorDate: Wed Apr 15 21:52:54 2020 +0800

    Fix: refresh detect point data (#282)
    
    * fix: refresh detect point data
---
 src/store/modules/topology/index.ts          | 11 +++++++++++
 src/store/mutation-types.ts                  |  1 +
 src/views/components/topology/chart/topo.vue |  3 +++
 src/views/components/topology/topo-aside.vue | 13 ++++++++++++-
 src/views/containers/topology/topology.vue   |  1 -
 5 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/store/modules/topology/index.ts b/src/store/modules/topology/index.ts
index 9e9d914..3bd9969 100644
--- a/src/store/modules/topology/index.ts
+++ b/src/store/modules/topology/index.ts
@@ -56,6 +56,7 @@ export interface State {
   detectPoints: string[];
   selectedServiceCall: Call | null;
   currentNode: any;
+  currentLink: any;
   current: Option;
   mode: boolean;
   getResponseTimeTrend: number[];
@@ -83,6 +84,7 @@ const initState: State = {
   _calls: [],
   _nodes: [],
   currentNode: {},
+  currentLink: {},
   current: {
     key: 'default',
     label: 'default',
@@ -121,6 +123,9 @@ const mutations = {
   [types.SET_NODE](state: State, data: any) {
     state.currentNode = data;
   },
+  [types.SET_LINK](state: State, data: any) {
+    state.currentLink = data;
+  },
   [types.SET_TOPO](state: State, data: any) {
     state.calls = data.calls;
     state.nodes = data.nodes;
@@ -235,6 +240,9 @@ const actions: ActionTree<State, any> = {
         duration: params.duration,
       })
       .then((res: AxiosResponse) => {
+        if (!res.data.data) {
+          return;
+        }
         context.commit('SET_TOPO_RELATION', res.data.data);
         context.commit(types.SET_SELECTED_CALL, params);
       });
@@ -244,6 +252,9 @@ const actions: ActionTree<State, any> = {
       .query('queryTopoClientInfo')
       .params(params)
       .then((res: AxiosResponse) => {
+        if (!res.data.data) {
+          return;
+        }
         context.commit('SET_TOPO_RELATION', res.data.data);
         context.commit(types.SET_SELECTED_CALL, params);
       });
diff --git a/src/store/mutation-types.ts b/src/store/mutation-types.ts
index 20fcbc9..1dbf989 100644
--- a/src/store/mutation-types.ts
+++ b/src/store/mutation-types.ts
@@ -82,6 +82,7 @@ export const SET_HONEYCOMB_NODE = 'SET_HONEYCOMB_NODE';
 export const SET_SHOW_DIALOG = 'SET_SHOW_DIALOG';
 export const SET_INSTANCE_DEPENDENCY = 'SET_INSTANCE_DEPENDENCY';
 export const SET_TOPO_COPY = 'SET_TOPO_COPY';
+export const SET_LINK = 'SET_LINK';
 
 // comparison
 export const SET_CHARTVAL = 'SET_CHARTVAL';
diff --git a/src/views/components/topology/chart/topo.vue b/src/views/components/topology/chart/topo.vue
index de61efa..a2a0762 100644
--- a/src/views/components/topology/chart/topo.vue
+++ b/src/views/components/topology/chart/topo.vue
@@ -76,6 +76,7 @@ limitations under the License. -->
         event.stopPropagation();
         event.preventDefault();
         this.$store.commit('rocketTopo/SET_NODE', {});
+        this.$store.commit('rocketTopo/SET_LINK', {});
         this.$store.dispatch('rocketTopo/CLEAR_TOPO_INFO');
         this.tool.attr('style', 'display: none');
       });
@@ -110,10 +111,12 @@ limitations under the License. -->
         const {x, y, vx, vy, fx, fy, index, ...rest} = d;
         this.$store.dispatch('rocketTopo/CLEAR_TOPO_INFO');
         this.$store.commit('rocketTopo/SET_NODE', rest);
+        this.$store.commit('rocketTopo/SET_LINK', {});
       },
       handleLinkClick(d) {
         event.stopPropagation();
         this.$store.commit('rocketTopo/SET_NODE', {});
+        this.$store.commit('rocketTopo/SET_LINK', d);
         this.$store.dispatch('rocketTopo/CLEAR_TOPO_INFO');
         this.$store.commit('rocketTopo/SET_MODE', d.detectPoints);
         this.$store.dispatch(this.$store.state.rocketTopo.mode ? 'rocketTopo/GET_TOPO_SERVICE_INFO' :
diff --git a/src/views/components/topology/topo-aside.vue b/src/views/components/topology/topo-aside.vue
index 7c00fd0..573ccf2 100644
--- a/src/views/components/topology/topo-aside.vue
+++ b/src/views/components/topology/topo-aside.vue
@@ -105,11 +105,21 @@ limitations under the License. -->
       this.drawerMainBodyHeight = `${document.body.clientHeight - 50}px`;
     }
 
+    private beforeMount() {
+      this.SET_EVENTS([this.handleRefresh]);
+    }
+
     private created() {
-      this.SET_EVENTS([]);
       this.SET_COMPS_TREE(this.initState.tree);
     }
 
+    private handleRefresh() {
+      this.$store.dispatch(
+        this.stateTopo.mode ? 'rocketTopo/GET_TOPO_SERVICE_INFO' : 'rocketTopo/GET_TOPO_CLIENT_INFO',
+        { ...this.stateTopo.currentLink, duration: this.durationTime },
+      );
+    }
+
     private mounted() {
       this.resize();
       window.addEventListener('resize', this.resize);
@@ -119,6 +129,7 @@ limitations under the License. -->
       window.removeEventListener('resize', this.resize);
       this.CLEAR_TOPO_INFO();
       this.CLEAR_TOPO();
+      this.SET_EVENTS([]);
     }
 
     get types() {
diff --git a/src/views/containers/topology/topology.vue b/src/views/containers/topology/topology.vue
index ebe636b..29008ea 100644
--- a/src/views/containers/topology/topology.vue
+++ b/src/views/containers/topology/topology.vue
@@ -59,7 +59,6 @@ limitations under the License. -->
   export default class Topology extends Vue {
     @State('rocketTopo') private stateTopo!: topoState;
     @State('rocketOption') private stateDashboardOption!: any;
-    @Mutation('SET_EVENTS') private SET_EVENTS: any;
     @Action('rocketTopo/CLEAR_TOPO') private CLEAR_TOPO: any;
     @Action('rocketTopo/CLEAR_TOPO_INFO') private CLEAR_TOPO_INFO: any;
     @Getter('durationTime') private durationTime: any;