未验证 提交 10690674 编写于 作者: Q Qiuxia Fan 提交者: GitHub

Bugfix: service and instance in topology (#312)

上级 6a1631d2
...@@ -107,9 +107,9 @@ limitations under the License. --> ...@@ -107,9 +107,9 @@ limitations under the License. -->
this.height = this.item.height; this.height = this.item.height;
this.unit = this.item.unit; this.unit = this.item.unit;
this.itemConfig = this.item; 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; return;
} }
this.chartRender(); this.chartRender();
......
...@@ -23,4 +23,5 @@ export enum TopologyType { ...@@ -23,4 +23,5 @@ export enum TopologyType {
export enum ObjectsType { export enum ObjectsType {
UPDATE_INSTANCES = 'UPDATE_INSTANCES', UPDATE_INSTANCES = 'UPDATE_INSTANCES',
UPDATE_ENDPOINTS = 'UPDATE_ENDPOINTS', UPDATE_ENDPOINTS = 'UPDATE_ENDPOINTS',
UPDATE_DASHBOARD = 'UPDATE_DASHBOARD',
} }
...@@ -31,6 +31,7 @@ limitations under the License. --> ...@@ -31,6 +31,7 @@ limitations under the License. -->
:index="index" :index="index"
:rocketGlobal="rocketGlobal" :rocketGlobal="rocketGlobal"
:item="i" :item="i"
:updateObjects="ObjectsType.UPDATE_DASHBOARD"
> >
</DashboardItem> </DashboardItem>
<div v-show="rocketGlobal.edit" class="rk-add-dashboard-item g-sm-3" @click="ADD_COMP"> <div v-show="rocketGlobal.edit" class="rk-add-dashboard-item g-sm-3" @click="ADD_COMP">
...@@ -48,6 +49,7 @@ limitations under the License. --> ...@@ -48,6 +49,7 @@ limitations under the License. -->
import ToolGroup from '@/views/components/dashboard/tool-group.vue'; import ToolGroup from '@/views/components/dashboard/tool-group.vue';
import ToolNav from '@/views/components/dashboard/tool-nav.vue'; import ToolNav from '@/views/components/dashboard/tool-nav.vue';
import DashboardItem from '@/views/components/dashboard/dashboard-item.vue'; import DashboardItem from '@/views/components/dashboard/dashboard-item.vue';
import { ObjectsType } from '../constant';
interface ITemplate { interface ITemplate {
name: string; name: string;
...@@ -78,6 +80,8 @@ limitations under the License. --> ...@@ -78,6 +80,8 @@ limitations under the License. -->
@Mutation('SET_ALL_TEMPLATES') private SET_ALL_TEMPLATES: any; @Mutation('SET_ALL_TEMPLATES') private SET_ALL_TEMPLATES: any;
@Mutation('SET_EDIT') private SET_EDIT: any; @Mutation('SET_EDIT') private SET_EDIT: any;
private ObjectsType = ObjectsType;
private isRouterAlive: boolean = true; private isRouterAlive: boolean = true;
public reload(): void { public reload(): void {
this.isRouterAlive = false; this.isRouterAlive = false;
......
...@@ -67,6 +67,7 @@ limitations under the License. --> ...@@ -67,6 +67,7 @@ limitations under the License. -->
import ToolBarEndpointSelect from '@/views/components/dashboard/tool-bar-endpoint-select.vue'; import ToolBarEndpointSelect from '@/views/components/dashboard/tool-bar-endpoint-select.vue';
import { readFile } from '@/utils/readFile'; import { readFile } from '@/utils/readFile';
import { saveFile } from '@/utils/saveFile'; import { saveFile } from '@/utils/saveFile';
import { ObjectsType } from '../../../constant';
interface Endpoint { interface Endpoint {
label: string; label: string;
...@@ -113,7 +114,7 @@ limitations under the License. --> ...@@ -113,7 +114,7 @@ limitations under the License. -->
if (!Array.isArray(data)) { if (!Array.isArray(data)) {
throw new Error(); throw new Error();
} }
this.$emit('changeEndpointComps', data); this.$emit('changeEndpointComps', { json: data, type: ObjectsType.UPDATE_ENDPOINTS });
const el: any = document.getElementById('endpoint-file'); const el: any = document.getElementById('endpoint-file');
el!.value = ''; el!.value = '';
} catch (e) { } catch (e) {
...@@ -129,6 +130,7 @@ limitations under the License. --> ...@@ -129,6 +130,7 @@ limitations under the License. -->
private beforeDestroy() { private beforeDestroy() {
this.SET_EDIT(false); this.SET_EDIT(false);
this.$emit('changeEndpointComps', { type: '' });
} }
} }
</script> </script>
......
...@@ -69,6 +69,7 @@ limitations under the License. --> ...@@ -69,6 +69,7 @@ limitations under the License. -->
import { Action, Getter, State, Mutation } from 'vuex-class'; import { Action, Getter, State, Mutation } from 'vuex-class';
import { readFile } from '@/utils/readFile'; import { readFile } from '@/utils/readFile';
import { saveFile } from '@/utils/saveFile'; import { saveFile } from '@/utils/saveFile';
import { ObjectsType } from '../../../constant';
interface Instance { interface Instance {
label: string; label: string;
...@@ -113,7 +114,7 @@ limitations under the License. --> ...@@ -113,7 +114,7 @@ limitations under the License. -->
if (!Array.isArray(data)) { if (!Array.isArray(data)) {
throw new Error(); throw new Error();
} }
this.$emit('changeInstanceComps', data); this.$emit('changeInstanceComps', { json: data, type: ObjectsType.UPDATE_ENDPOINTS });
const el: any = document.getElementById('instance-file'); const el: any = document.getElementById('instance-file');
el!.value = ''; el!.value = '';
} catch (e) { } catch (e) {
...@@ -127,6 +128,7 @@ limitations under the License. --> ...@@ -127,6 +128,7 @@ limitations under the License. -->
} }
private beforeDestroy() { private beforeDestroy() {
this.$emit('changeInstanceComps', { type: '' });
this.SET_EDIT(false); this.SET_EDIT(false);
} }
} }
......
...@@ -49,7 +49,7 @@ limitations under the License. --> ...@@ -49,7 +49,7 @@ limitations under the License. -->
import { State, Action, Getter, Mutation } from 'vuex-class'; import { State, Action, Getter, Mutation } from 'vuex-class';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { State as topoState } from '@/store/modules/topology'; 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 WindowEndpoint from '@/views/containers/topology/endpoint/index.vue';
import WindowInstance from '@/views/containers/topology/instance/index.vue'; import WindowInstance from '@/views/containers/topology/instance/index.vue';
import WindowTrace from '@/views/containers/topology/trace/index.vue'; import WindowTrace from '@/views/containers/topology/trace/index.vue';
...@@ -76,6 +76,7 @@ limitations under the License. --> ...@@ -76,6 +76,7 @@ limitations under the License. -->
@Action('GET_ALL_TEMPLATES') private GET_ALL_TEMPLATES: any; @Action('GET_ALL_TEMPLATES') private GET_ALL_TEMPLATES: any;
@Mutation('rocketTopo/SET_TOPO_ENDPOINT') private SET_TOPO_ENDPOINT: any; @Mutation('rocketTopo/SET_TOPO_ENDPOINT') private SET_TOPO_ENDPOINT: any;
@Mutation('rocketTopo/SET_TOPO_INSTANCE') private SET_TOPO_INSTANCE: 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; @Getter('durationTime') private durationTime: any;
private current: any = {}; private current: any = {};
...@@ -118,18 +119,25 @@ limitations under the License. --> ...@@ -118,18 +119,25 @@ limitations under the License. -->
} }
private setCurrent(d: any): void { private setCurrent(d: any): void {
this.current = d; this.current = d;
this.SET_CURRENT_SERVICE(d);
} }
private beforeDestroy() { private beforeDestroy() {
this.CLEAR_TOPO_INFO(); this.CLEAR_TOPO_INFO();
this.CLEAR_TOPO(); this.CLEAR_TOPO();
} }
private changeInstanceComps(data: any) { private changeInstanceComps(data: { type: string; json: any }) {
this.updateObjects = ObjectsType.UPDATE_INSTANCES; this.updateObjects = data.type;
this.SET_TOPO_INSTANCE(data); if (!data.json) {
return;
}
this.SET_TOPO_INSTANCE(data.json);
} }
private changeEndpointComps(data: any) { private changeEndpointComps(data: { type: string; json: any }) {
this.updateObjects = ObjectsType.UPDATE_ENDPOINTS; this.updateObjects = data.type;
this.SET_TOPO_ENDPOINT(data); if (!data.json) {
return;
}
this.SET_TOPO_ENDPOINT(data.json);
} }
} }
</script> </script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册