You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/06/10 09:08:35 UTC

[skywalking-rocketbot-ui] branch master updated: Bugfix: service and instance in topology (#312)

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 1069067  Bugfix: service and instance in topology (#312)
1069067 is described below

commit 106906748de662524fec519cc1738485fe18221b
Author: Qiuxia Fan <fi...@outlook.com>
AuthorDate: Wed Jun 10 17:08:24 2020 +0800

    Bugfix: service and instance in topology (#312)
---
 src/views/components/dashboard/dashboard-item.vue |  4 ++--
 src/views/constant.ts                             |  1 +
 src/views/containers/dashboard.vue                |  4 ++++
 src/views/containers/topology/endpoint/index.vue  |  4 +++-
 src/views/containers/topology/instance/index.vue  |  4 +++-
 src/views/containers/topology/topology.vue        | 22 +++++++++++++++-------
 6 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/src/views/components/dashboard/dashboard-item.vue b/src/views/components/dashboard/dashboard-item.vue
index b6006e4..d2863df 100644
--- a/src/views/components/dashboard/dashboard-item.vue
+++ b/src/views/components/dashboard/dashboard-item.vue
@@ -107,9 +107,9 @@ limitations under the License. -->
       this.height = this.item.height;
       this.unit = this.item.unit;
       this.itemConfig = this.item;
-      const types = [ObjectsType.UPDATE_INSTANCES, ObjectsType.UPDATE_ENDPOINTS] as any[];
+      const types = [ObjectsType.UPDATE_INSTANCES, ObjectsType.UPDATE_ENDPOINTS, ObjectsType.UPDATE_DASHBOARD] as any[];
 
-      if (this.updateObjects && !types.includes(this.updateObjects)) {
+      if (!types.includes(this.updateObjects)) {
         return;
       }
       this.chartRender();
diff --git a/src/views/constant.ts b/src/views/constant.ts
index 5e0a3fe..cd9a79e 100644
--- a/src/views/constant.ts
+++ b/src/views/constant.ts
@@ -23,4 +23,5 @@ export enum TopologyType {
 export enum ObjectsType {
   UPDATE_INSTANCES = 'UPDATE_INSTANCES',
   UPDATE_ENDPOINTS = 'UPDATE_ENDPOINTS',
+  UPDATE_DASHBOARD = 'UPDATE_DASHBOARD',
 }
diff --git a/src/views/containers/dashboard.vue b/src/views/containers/dashboard.vue
index b62374b..0bbe1e4 100644
--- a/src/views/containers/dashboard.vue
+++ b/src/views/containers/dashboard.vue
@@ -31,6 +31,7 @@ limitations under the License. -->
         :index="index"
         :rocketGlobal="rocketGlobal"
         :item="i"
+        :updateObjects="ObjectsType.UPDATE_DASHBOARD"
       >
       </DashboardItem>
       <div v-show="rocketGlobal.edit" class="rk-add-dashboard-item g-sm-3" @click="ADD_COMP">
@@ -48,6 +49,7 @@ limitations under the License. -->
   import ToolGroup from '@/views/components/dashboard/tool-group.vue';
   import ToolNav from '@/views/components/dashboard/tool-nav.vue';
   import DashboardItem from '@/views/components/dashboard/dashboard-item.vue';
+  import { ObjectsType } from '../constant';
 
   interface ITemplate {
     name: string;
@@ -78,6 +80,8 @@ limitations under the License. -->
     @Mutation('SET_ALL_TEMPLATES') private SET_ALL_TEMPLATES: any;
     @Mutation('SET_EDIT') private SET_EDIT: any;
 
+    private ObjectsType = ObjectsType;
+
     private isRouterAlive: boolean = true;
     public reload(): void {
       this.isRouterAlive = false;
diff --git a/src/views/containers/topology/endpoint/index.vue b/src/views/containers/topology/endpoint/index.vue
index 13bd7e9..64a8a2d 100644
--- a/src/views/containers/topology/endpoint/index.vue
+++ b/src/views/containers/topology/endpoint/index.vue
@@ -67,6 +67,7 @@ limitations under the License. -->
   import ToolBarEndpointSelect from '@/views/components/dashboard/tool-bar-endpoint-select.vue';
   import { readFile } from '@/utils/readFile';
   import { saveFile } from '@/utils/saveFile';
+  import { ObjectsType } from '../../../constant';
 
   interface Endpoint {
     label: string;
@@ -113,7 +114,7 @@ limitations under the License. -->
         if (!Array.isArray(data)) {
           throw new Error();
         }
-        this.$emit('changeEndpointComps', data);
+        this.$emit('changeEndpointComps', { json: data, type: ObjectsType.UPDATE_ENDPOINTS });
         const el: any = document.getElementById('endpoint-file');
         el!.value = '';
       } catch (e) {
@@ -129,6 +130,7 @@ limitations under the License. -->
 
     private beforeDestroy() {
       this.SET_EDIT(false);
+      this.$emit('changeEndpointComps', { type: '' });
     }
   }
 </script>
diff --git a/src/views/containers/topology/instance/index.vue b/src/views/containers/topology/instance/index.vue
index 9cd1914..c45b79a 100644
--- a/src/views/containers/topology/instance/index.vue
+++ b/src/views/containers/topology/instance/index.vue
@@ -69,6 +69,7 @@ limitations under the License. -->
   import { Action, Getter, State, Mutation } from 'vuex-class';
   import { readFile } from '@/utils/readFile';
   import { saveFile } from '@/utils/saveFile';
+  import { ObjectsType } from '../../../constant';
 
   interface Instance {
     label: string;
@@ -113,7 +114,7 @@ limitations under the License. -->
         if (!Array.isArray(data)) {
           throw new Error();
         }
-        this.$emit('changeInstanceComps', data);
+        this.$emit('changeInstanceComps', { json: data, type: ObjectsType.UPDATE_ENDPOINTS });
         const el: any = document.getElementById('instance-file');
         el!.value = '';
       } catch (e) {
@@ -127,6 +128,7 @@ limitations under the License. -->
     }
 
     private beforeDestroy() {
+      this.$emit('changeInstanceComps', { type: '' });
       this.SET_EDIT(false);
     }
   }
diff --git a/src/views/containers/topology/topology.vue b/src/views/containers/topology/topology.vue
index 5b20419..0271a66 100644
--- a/src/views/containers/topology/topology.vue
+++ b/src/views/containers/topology/topology.vue
@@ -49,7 +49,7 @@ limitations under the License. -->
   import { State, Action, Getter, Mutation } from 'vuex-class';
   import { AxiosResponse } from 'axios';
   import { State as topoState } from '@/store/modules/topology';
-  import { TopologyType, ObjectsType } from '../../constant';
+  import { TopologyType } from '../../constant';
   import WindowEndpoint from '@/views/containers/topology/endpoint/index.vue';
   import WindowInstance from '@/views/containers/topology/instance/index.vue';
   import WindowTrace from '@/views/containers/topology/trace/index.vue';
@@ -76,6 +76,7 @@ limitations under the License. -->
     @Action('GET_ALL_TEMPLATES') private GET_ALL_TEMPLATES: any;
     @Mutation('rocketTopo/SET_TOPO_ENDPOINT') private SET_TOPO_ENDPOINT: any;
     @Mutation('rocketTopo/SET_TOPO_INSTANCE') private SET_TOPO_INSTANCE: any;
+    @Mutation('SET_CURRENT_SERVICE') private SET_CURRENT_SERVICE: any;
     @Getter('durationTime') private durationTime: any;
 
     private current: any = {};
@@ -118,18 +119,25 @@ limitations under the License. -->
     }
     private setCurrent(d: any): void {
       this.current = d;
+      this.SET_CURRENT_SERVICE(d);
     }
     private beforeDestroy() {
       this.CLEAR_TOPO_INFO();
       this.CLEAR_TOPO();
     }
-    private changeInstanceComps(data: any) {
-      this.updateObjects = ObjectsType.UPDATE_INSTANCES;
-      this.SET_TOPO_INSTANCE(data);
+    private changeInstanceComps(data: { type: string; json: any }) {
+      this.updateObjects = data.type;
+      if (!data.json) {
+        return;
+      }
+      this.SET_TOPO_INSTANCE(data.json);
     }
-    private changeEndpointComps(data: any) {
-      this.updateObjects = ObjectsType.UPDATE_ENDPOINTS;
-      this.SET_TOPO_ENDPOINT(data);
+    private changeEndpointComps(data: { type: string; json: any }) {
+      this.updateObjects = data.type;
+      if (!data.json) {
+        return;
+      }
+      this.SET_TOPO_ENDPOINT(data.json);
     }
   }
 </script>