diff --git a/src/components/index.ts b/src/components/index.ts
index a5f02e88a..7918f5a76 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -16,8 +16,6 @@
*/
import noty from './noty';
-import RkHeader from './rk-header.vue';
-import RkFooter from './rk-footer.vue';
import RkFooterTime from './rk-footer-time.vue';
import RkProgress from './rk-progress.vue';
import RkPage from './rk-page.vue';
@@ -33,10 +31,9 @@ import RkBack from './rk-back.vue';
import RkButton from './rk-button.vue';
import RkIcon from './rk-icon.vue';
import RkRadio from './rk-radio.vue';
+import RkAlert from './rk-alert.vue';
const components: any = {
- RkHeader,
- RkFooter,
RkProgress,
RkDate,
RkPanel,
@@ -52,6 +49,7 @@ const components: any = {
RkButton,
RkIcon,
RkRadio,
+ RkAlert,
};
const componentsName: string[] = Object.keys(components);
diff --git a/src/components/rk-alert.vue b/src/components/rk-alert.vue
new file mode 100644
index 000000000..e2dee6844
--- /dev/null
+++ b/src/components/rk-alert.vue
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
{{ message }}
+
{{ description }}
+
+
+
+
+
+
+
diff --git a/src/components/rk-icon.vue b/src/components/rk-icon.vue
index 9a224ff1f..f9f0360f6 100644
--- a/src/components/rk-icon.vue
+++ b/src/components/rk-icon.vue
@@ -18,6 +18,7 @@ limitations under the License. -->
:class="{
sm: size === 'sm',
lg: size === 'lg',
+ xll: size === 'xll',
offset: offset,
loading: loading,
}"
@@ -46,13 +47,17 @@ limitations under the License. -->
vertical-align: middle;
fill: currentColor;
&.sm {
- width: 13px;
+ width: 1px;
height: 13px;
}
&.lg {
width: 18px;
height: 18px;
}
+ &.xll {
+ width: 25px;
+ height: 25px;
+ }
&.offset {
margin-top: -2px;
}
diff --git a/src/components/rk-sidebox.vue b/src/components/rk-sidebox.vue
index 55b23a669..7cc1660c0 100644
--- a/src/components/rk-sidebox.vue
+++ b/src/components/rk-sidebox.vue
@@ -35,7 +35,9 @@ limitations under the License. -->
export default {
name: 'RkSidebox',
props: {
- show: {},
+ show: {
+ default: false,
+ },
title: {
default: '',
},
diff --git a/src/graph/index.ts b/src/graph/index.ts
index e6fa40967..d54560af2 100644
--- a/src/graph/index.ts
+++ b/src/graph/index.ts
@@ -44,14 +44,24 @@ class Graph {
return this;
}
public params(variablesData: any): AxiosPromise {
- return axios.post(
- '/graphql',
- {
- query: query[this.queryData],
- variables: variablesData,
- },
- { cancelToken: cancelToken() },
- );
+ return axios
+ .post(
+ '/graphql',
+ {
+ query: query[this.queryData],
+ variables: variablesData,
+ },
+ { cancelToken: cancelToken() },
+ )
+ .then((res: any) => {
+ if (res.data.errors) {
+ res.data.errors = res.data.errors.map((e: { message: string }) => e.message).join(' ');
+ }
+ return res;
+ })
+ .catch((err) => {
+ throw err;
+ });
}
}
diff --git a/src/store/modules/alarm/index.ts b/src/store/modules/alarm/index.ts
index 265eb1124..51633982d 100644
--- a/src/store/modules/alarm/index.ts
+++ b/src/store/modules/alarm/index.ts
@@ -24,11 +24,13 @@ import { Alarm, AlarmParams } from '@/types/alarm';
export interface State {
alarmService: Alarm[];
total: number;
+ alarmErrors: { [key: string]: string };
}
const initState: State = {
alarmService: [],
total: 0,
+ alarmErrors: {},
};
// getters
@@ -44,15 +46,25 @@ const mutations: MutationTree = {
state.alarmService = [];
state.total = 0;
},
+ [types.SET_ALARM_ERRORS](state: State, data: { msg: string; desc: string }) {
+ state.alarmErrors = {
+ ...state.alarmErrors,
+ [data.msg]: data.desc,
+ };
+ },
};
// actions
const actions: ActionTree = {
- GET_ALARM(context: { commit: Commit; state: State }, params: AlarmParams): Promise {
+ GET_ALARM(context: { commit: Commit; state: State }, params: AlarmParams): Promise {
return graph
.query('queryAlarms')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_ALARM_ERRORS, { msg: 'queryAlarms', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return;
+ }
if (res.data.data.getAlarm.items) {
context.commit(types.SET_ALARM, res.data.data.getAlarm);
}
diff --git a/src/store/modules/dashboard/dashboard-data-query.ts b/src/store/modules/dashboard/dashboard-data-query.ts
index 7318ccef4..1488ed3c2 100644
--- a/src/store/modules/dashboard/dashboard-data-query.ts
+++ b/src/store/modules/dashboard/dashboard-data-query.ts
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-import { Commit, ActionTree, Dispatch } from 'vuex';
+import { Commit, ActionTree, Dispatch, MutationTree } from 'vuex';
import { AxiosResponse } from 'axios';
+import * as types from './mutation-types';
import { State } from './dashboard-data';
import graph from '@/graph';
import { TopologyType } from '@/constants/constant';
@@ -236,6 +237,13 @@ const actions: ActionTree = {
.query(config.queryMetricType)
.params(variable)
.then((res: AxiosResponse) => {
+ if (res.data.errors) {
+ context.commit(types.SET_DASHBOARD_ERRORS, {
+ msg: variable.condition.name,
+ desc: res.data.errors,
+ });
+ return;
+ }
const resData = res.data.data;
return { ...resData, config, metricName: variable.condition.name };
diff --git a/src/store/modules/dashboard/dashboard-data.ts b/src/store/modules/dashboard/dashboard-data.ts
index 298a96cc3..da6054c9b 100644
--- a/src/store/modules/dashboard/dashboard-data.ts
+++ b/src/store/modules/dashboard/dashboard-data.ts
@@ -38,6 +38,7 @@ export interface State {
enableEvents: boolean;
eventsPageType: string;
currentSeriesType: Option[];
+ dashboardErrors: { [key: string]: string };
}
const initState: State = {
@@ -47,11 +48,12 @@ const initState: State = {
enableEvents: false,
eventsPageType: PageEventsType.DASHBOARD_EVENTS,
currentSeriesType: [],
+ dashboardErrors: {},
...dashboardLayout.state,
};
// mutations
-const mutations: MutationTree = {
+const mutations: MutationTree = {
...dashboardLayout.mutations,
[types.SET_DASHBOARD_EVENTS](state: State, param: { events: Event[]; type: string; duration: DurationTime }) {
const events = param.events.map((d: Event, index: number) => {
@@ -122,6 +124,12 @@ const mutations: MutationTree = {
item.checked = false;
}
},
+ [types.SET_DASHBOARD_ERRORS](state: State, data: { msg: string; desc: string }) {
+ state.dashboardErrors = {
+ ...state.dashboardErrors,
+ [data.msg]: data.desc,
+ };
+ },
};
// actions
@@ -179,6 +187,10 @@ const actions: ActionTree = {
.query('queryTypeOfMetrics')
.params({ name: item })
.then((res: AxiosResponse) => {
+ context.commit(types.SET_DASHBOARD_ERRORS, { msg: 'queryTypeOfMetrics', desc: res.data.errors });
+ if (res.data.errors) {
+ return;
+ }
return res.data.data;
});
}),
@@ -189,7 +201,8 @@ const actions: ActionTree = {
.query('queryGetAllTemplates')
.params({})
.then((res: AxiosResponse) => {
- if (!res.data.data) {
+ context.commit(types.SET_DASHBOARD_ERRORS, { msg: 'queryGetAllTemplates', desc: res.data.errors });
+ if (res.data.errors) {
return;
}
return res.data.data.getAllTemplates || [];
@@ -200,9 +213,11 @@ const actions: ActionTree = {
.query('queryEvents')
.params({ condition: params.condition })
.then((res: AxiosResponse) => {
- if (!(res.data.data && res.data.data.fetchEvents)) {
+ context.commit(types.SET_DASHBOARD_ERRORS, { msg: 'queryEvents', desc: res.data.errors });
+ if (res.data.errors) {
context.commit('SET_DASHBOARD_EVENTS', { events: [], type: params.type, duration: params.condition.time });
- return [];
+
+ return;
}
context.commit('SET_DASHBOARD_EVENTS', {
events: res.data.data.fetchEvents.events,
diff --git a/src/store/modules/dashboard/mutation-types.ts b/src/store/modules/dashboard/mutation-types.ts
index a526130a7..9d20042a8 100644
--- a/src/store/modules/dashboard/mutation-types.ts
+++ b/src/store/modules/dashboard/mutation-types.ts
@@ -45,6 +45,8 @@ export const SET_CLEAR_SELECTED_EVENTS = 'SET_CLEAR_SELECTED_EVENTS';
export const SET_SERVICE_DEPENDENCY = 'SET_SERVICE_DEPENDENCY';
export const SET_SERVICE_INSTANCE_DEPENDENCY = 'SET_SERVICE_INSTANCE_DEPENDENCY';
export const SET_ENDPOINT_DEPENDENCY = 'SET_ENDPOINT_DEPENDENCY';
+export const SET_SELECTOR_ERRORS = 'SET_SELECTOR_ERRORS';
+export const SET_DASHBOARD_ERRORS = 'SET_DASHBOARD_ERRORS';
// comp
export const SET_CURRENT_GROUP = 'SET_CURRENT_GROUP';
diff --git a/src/store/modules/event/index.ts b/src/store/modules/event/index.ts
index 03cb2b047..57c4e3895 100644
--- a/src/store/modules/event/index.ts
+++ b/src/store/modules/event/index.ts
@@ -27,11 +27,15 @@ const Scopes = ['Service', 'ServiceInstance', 'Endpoint'];
export interface State {
currentEvents: Event[];
totalSize: number;
+ errorMessage: string;
+ eventErrors: { [key: string]: string };
}
const initState: State = {
currentEvents: [],
totalSize: 1,
+ errorMessage: '',
+ eventErrors: {},
};
// mutations
@@ -46,6 +50,12 @@ const mutations: MutationTree = {
[types.SET_TOTAL_SIZE](state: State, total: number) {
state.totalSize = total;
},
+ [types.SET_EVENT_ERRORS](state: State, data: { msg: string; desc: string }) {
+ state.eventErrors = {
+ ...state.eventErrors,
+ [data.msg]: data.desc,
+ };
+ },
};
// actions
@@ -55,7 +65,8 @@ const actions: ActionTree = {
.query('queryEvents')
.params({ condition: params.condition })
.then((res: AxiosResponse) => {
- if (!(res.data.data && res.data.data.fetchEvents)) {
+ context.commit(types.SET_EVENT_ERRORS, { msg: 'queryEvents', desc: res.data.errors || '' });
+ if (res.data.errors) {
context.commit('UPDATE_EVENTS', { events: [], duration: params.condition.time });
context.commit('SET_TOTAL_SIZE', 1);
return [];
diff --git a/src/store/modules/global/selectors.ts b/src/store/modules/global/selectors.ts
index 03768ab4a..e30593c19 100644
--- a/src/store/modules/global/selectors.ts
+++ b/src/store/modules/global/selectors.ts
@@ -37,6 +37,7 @@ export interface State {
destService: Option;
destInstance: Option;
destEndpoint: Option;
+ selectorErrors: { [key: string]: string };
}
const initState: State = {
@@ -53,6 +54,7 @@ const initState: State = {
destService: { key: '', label: '' },
destInstance: { key: '', label: '' },
destEndpoint: { key: '', label: '' },
+ selectorErrors: {},
};
// mutations
@@ -134,6 +136,12 @@ const mutations: MutationTree = {
state.destEndpoint = { key: call.destEndpointId, label: call.destEndpointName };
state.updateDashboard = { key: TopologyType.TOPOLOGY_ENDPOINT_DEPENDENCY + call.id };
},
+ [types.SET_SELECTOR_ERRORS](state: State, data: { msg: string; desc: string }) {
+ state.selectorErrors = {
+ ...state.selectorErrors,
+ [data.msg]: data.desc,
+ };
+ },
};
// actions
@@ -146,6 +154,11 @@ const actions: ActionTree = {
.query('queryServices')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_SELECTOR_ERRORS, { msg: 'serviceErrors', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ context.commit(types.SET_SERVICES, []);
+ return;
+ }
context.commit(types.SET_SERVICES, res.data.data.services);
});
},
@@ -167,6 +180,11 @@ const actions: ActionTree = {
keyword: params.keyword,
})
.then((res: AxiosResponse) => {
+ context.commit(types.SET_SELECTOR_ERRORS, { msg: 'endpointErrors', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ context.commit(types.SET_ENDPOINTS, []);
+ return;
+ }
context.commit(types.SET_ENDPOINTS, res.data.data.getEndpoints);
});
},
@@ -179,6 +197,11 @@ const actions: ActionTree = {
.query('queryInstances')
.params({ serviceId: context.state.currentService.key || '', ...params })
.then((res: AxiosResponse) => {
+ context.commit(types.SET_SELECTOR_ERRORS, { msg: 'instanceErrors', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ context.commit(types.SET_INSTANCES, []);
+ return;
+ }
context.commit(types.SET_INSTANCES, res.data.data.getServiceInstances);
});
},
@@ -187,6 +210,11 @@ const actions: ActionTree = {
.query('queryDatabases')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_SELECTOR_ERRORS, { msg: 'databaseErrors', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ context.commit(types.SET_DATABASES, []);
+ return;
+ }
context.commit(types.SET_DATABASES, res.data.data.services);
});
},
@@ -288,6 +316,10 @@ const actions: ActionTree = {
.query('queryEndpoints')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_SELECTOR_ERRORS, { msg: 'itemEndpointErrors', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return [];
+ }
return res.data.data.getEndpoints;
});
},
@@ -296,6 +328,10 @@ const actions: ActionTree = {
.query('queryInstances')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_SELECTOR_ERRORS, { msg: 'itemInstanceErrors', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return [];
+ }
return res.data.data.getServiceInstances;
});
},
@@ -307,7 +343,11 @@ const actions: ActionTree = {
.query('queryServices')
.params(params)
.then((res: AxiosResponse) => {
- return res.data.data.services || [];
+ context.commit(types.SET_SELECTOR_ERRORS, { msg: 'itemServiceErrors', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return [];
+ }
+ return res.data.data.services;
});
},
};
diff --git a/src/store/modules/log/index.ts b/src/store/modules/log/index.ts
index 2890f1dbd..6a61f97df 100644
--- a/src/store/modules/log/index.ts
+++ b/src/store/modules/log/index.ts
@@ -30,6 +30,7 @@ export interface State {
loading: boolean;
conditions: any;
supportQueryLogsByKeywords: boolean;
+ logErrors: { [key: string]: string };
}
const categories: Option[] = [
@@ -63,6 +64,7 @@ const logState: State = {
: [],
},
supportQueryLogsByKeywords: true,
+ logErrors: {},
};
// mutations
@@ -100,6 +102,12 @@ const mutations: MutationTree = {
localStorage.removeItem('logTags');
localStorage.removeItem('logTraceId');
},
+ [types.SET_LOG_ERRORS](state: State, data: { msg: string; desc: string }) {
+ state.logErrors = {
+ ...state.logErrors,
+ [data.msg]: data.desc,
+ };
+ },
};
// actions
@@ -112,6 +120,7 @@ const actions: ActionTree = {
.query('queryBrowserErrorLogs')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_LOG_ERRORS, { msg: 'queryBrowserErrorLogs', desc: res.data.errors || '' });
if (res.data && res.data.errors) {
context.commit('SET_LOGS', []);
context.commit('SET_LOGS_TOTAL', 0);
@@ -129,6 +138,7 @@ const actions: ActionTree = {
.query('queryServiceLogs')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_LOG_ERRORS, { msg: 'queryServiceLogs', desc: res.data.errors || '' });
if (res.data && res.data.errors) {
context.commit('SET_LOGS', []);
context.commit('SET_LOGS_TOTAL', 0);
@@ -150,6 +160,7 @@ const actions: ActionTree = {
.query('queryLogsByKeywords')
.params({})
.then((res: AxiosResponse) => {
+ context.commit(types.SET_LOG_ERRORS, { msg: 'queryLogsByKeywords', desc: res.data.errors || '' });
if (res.data && res.data.errors) {
return;
}
diff --git a/src/store/modules/profile/profile-store.ts b/src/store/modules/profile/profile-store.ts
index 666fd8b11..b62bf9b95 100644
--- a/src/store/modules/profile/profile-store.ts
+++ b/src/store/modules/profile/profile-store.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { Commit, Dispatch } from 'vuex';
+import { Commit, Dispatch, MutationTree } from 'vuex';
import { AxiosResponse } from 'axios';
import graph from '@/graph';
@@ -41,6 +41,7 @@ export interface State {
profileAnalyzation: any;
highlightTop: boolean;
currentSpan: any;
+ profileErrors: { [key: string]: string };
}
const initState: State = {
headerSource: {
@@ -64,6 +65,7 @@ const initState: State = {
profileAnalyzation: [],
highlightTop: true,
currentSpan: {},
+ profileErrors: {},
};
// getters
const getters = {
@@ -73,7 +75,7 @@ const getters = {
};
// mutations
-const mutations = {
+const mutations: MutationTree = {
[types.SET_SERVICES](state: State, data: any[]) {
state.headerSource.serviceSource = [{ key: 'all', label: 'All' }, ...data];
state.headerSource.currentService = state.headerSource.serviceSource[0];
@@ -114,6 +116,12 @@ const mutations = {
[types.SET_HIGHLIGHT_TOP](state: State) {
state.highlightTop = !state.highlightTop;
},
+ [types.SET_PROFILE_ERRORS](state: State, data: { msg: string; desc: string }) {
+ state.profileErrors = {
+ ...state.profileErrors,
+ [data.msg]: data.desc,
+ };
+ },
};
// actions
@@ -126,8 +134,9 @@ const actions = {
.query('queryServices')
.params(params)
.then((res: AxiosResponse) => {
- if (!res.data.data) {
- return;
+ context.commit(types.SET_PROFILE_ERRORS, { msg: 'serviceErrors', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return context.commit(types.SET_SERVICES, []);
}
context.commit(types.SET_SERVICES, res.data.data.services);
context.dispatch('GET_TASK_LIST');
@@ -144,17 +153,17 @@ const actions = {
.query('getProfileTaskList')
.params(param)
.then((res: AxiosResponse) => {
- if (!res.data.data) {
- return;
+ context.commit(types.SET_PROFILE_ERRORS, { msg: 'getProfileTaskList', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return context.commit(types.SET_TASK_LIST, []);
}
context.commit(types.SET_TASK_LIST, res.data.data.getProfileTaskList);
- return res.data.data.getProfileTaskList;
- })
- .then((data: any) => {
- if (!data) {
+ const list = res.data.data.getProfileTaskList;
+ if (!list.length) {
return;
}
- context.dispatch('GET_SEGMENT_LIST', { taskID: data[0].id });
+ context.dispatch('GET_SEGMENT_LIST', { taskID: list[0].id });
+ return;
});
},
GET_SEGMENT_LIST(context: { commit: Commit; dispatch: Dispatch }, params: { taskID: string }) {
@@ -162,8 +171,9 @@ const actions = {
.query('getProfileTaskSegmentList')
.params(params)
.then((res: AxiosResponse) => {
- if (!res.data.data.getProfileTaskSegmentList) {
- return;
+ context.commit(types.SET_PROFILE_ERRORS, { msg: 'getProfileTaskSegmentList', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return context.commit(types.SET_SEGMENT_LIST, []);
}
const { getProfileTaskSegmentList } = res.data.data;
@@ -185,6 +195,10 @@ const actions = {
.query('queryProfileSegment')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_PROFILE_ERRORS, { msg: 'queryProfileSegment', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return context.commit(types.SET_SEGMENT_SPANS, []);
+ }
const { getProfiledSegment } = res.data.data;
if (!getProfiledSegment) {
return;
@@ -208,9 +222,13 @@ const actions = {
.query('getProfileAnalyze')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_PROFILE_ERRORS, { msg: 'getProfileAnalyze', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return context.commit(types.SET_PROFILE_ANALYZATION, []);
+ }
const { getProfileAnalyze, tip } = res.data.data;
if (tip) {
- return tip;
+ return { tip };
}
if (!getProfileAnalyze) {
context.commit(types.SET_PROFILE_ANALYZATION, []);
@@ -243,6 +261,10 @@ const actions = {
.query('saveProfileTask')
.params({ creationRequest })
.then((res: AxiosResponse) => {
+ context.commit(types.SET_PROFILE_ERRORS, { msg: 'saveProfileTask', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return;
+ }
if (res.data.data && res.data.data.createTask && res.data.data.createTask.errorReason) {
return res.data.data.createTask;
}
diff --git a/src/store/modules/topology/index.ts b/src/store/modules/topology/index.ts
index 2288f39e0..d1b84e93d 100644
--- a/src/store/modules/topology/index.ts
+++ b/src/store/modules/topology/index.ts
@@ -55,6 +55,11 @@ export interface State {
instanceDependencyMode: string;
editDependencyMetrics: boolean;
topoTemplatesType: { [key: string]: any };
+ endpointErrors: string;
+ getTopoErrors: string;
+ endpointTopoErrors: string;
+ instanceTopoErrors: string;
+ topoErrors: { [key: string]: string };
}
const DefaultConfig = {
@@ -98,6 +103,11 @@ const initState: State = {
editDependencyMetrics: false,
topoEndpointDependency: {},
topoTemplatesType: JSON.parse(localStorage.getItem('topoTemplateTypes') || JSON.stringify({})),
+ endpointErrors: '',
+ getTopoErrors: '',
+ endpointTopoErrors: '',
+ instanceTopoErrors: '',
+ topoErrors: {},
};
// getters
@@ -552,6 +562,12 @@ const mutations = {
state.topoTemplatesType = data;
localStorage.setItem('topoTemplateTypes', JSON.stringify(data));
},
+ [types.SET_TOPO_ERRORS](state: State, data: { msg: string; desc: string }) {
+ state.topoErrors = {
+ ...state.topoErrors,
+ [data.msg]: data.desc,
+ };
+ },
};
// actions
@@ -564,6 +580,10 @@ const actions: ActionTree = {
.query('queryServices')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_TOPO_ERRORS, { msg: 'serviceErrors', desc: res.data.errors });
+ if (res.data.errors) {
+ return [];
+ }
return res.data.data.services || [];
});
},
@@ -578,6 +598,10 @@ const actions: ActionTree = {
.query('queryEndpoints')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_TOPO_ERRORS, { msg: 'endpointErrors', desc: res.data.errors });
+ if (res.data.errors) {
+ return [];
+ }
return res.data.data.getEndpoints || [];
});
},
@@ -599,6 +623,7 @@ const actions: ActionTree = {
.query(query)
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_TOPO_ERRORS, { msg: query, desc: res.data.errors || '' });
if (res.data.errors) {
context.commit(types.SET_TOPO, { calls: [], nodes: [] });
return;
@@ -612,6 +637,11 @@ const actions: ActionTree = {
.query('queryTopoInfo')
.params({ ...params, ids, idsC, idsS })
.then((info: AxiosResponse) => {
+ context.commit(types.SET_TOPO_ERRORS, { msg: 'queryTopoInfo', desc: info.data.errors || '' });
+ if (info.data.errors) {
+ context.commit(types.SET_TOPO, { calls: [], nodes: [] });
+ return;
+ }
const resInfo = info.data.data;
if (!resInfo.sla) {
return context.commit(types.SET_TOPO, { calls, nodes });
@@ -732,6 +762,9 @@ const actions: ActionTree = {
.post('/graphql', { query: querys, variables: { duration: params.duration } }, { cancelToken: cancelToken() })
.then((res: AxiosResponse) => {
if (res.data.errors) {
+ const msg = res.data.errors.map((e: { message: string }) => e.message).join(' ');
+
+ context.commit(types.SET_TOPO_ERRORS, { msg: 'endpointDependencyError', desc: msg });
context.commit(types.SET_ENDPOINT_DEPENDENCY, { calls: [], nodes: [] });
return;
}
@@ -743,6 +776,7 @@ const actions: ActionTree = {
nodes.push(...topo[key].nodes);
}
if (!nodes.length) {
+ context.commit(types.SET_TOPO_ERRORS, { msg: 'endpointDependencyError', desc: '' });
context.commit(types.SET_ENDPOINT_DEPENDENCY, { calls: [], nodes: [] });
return;
}
@@ -795,9 +829,13 @@ const actions: ActionTree = {
.post('/graphql', { query, variables: { duration: params.duration } }, { cancelToken: cancelToken() })
.then((json: AxiosResponse) => {
if (json.data.errors) {
+ const msg = json.data.errors.map((e: { message: string }) => e.message).join(' ');
+
+ context.commit(types.SET_TOPO_ERRORS, { msg: 'endpointDependencyError', desc: msg });
context.commit(types.SET_ENDPOINT_DEPENDENCY, { calls: [], nodes: [] });
return;
}
+ context.commit(types.SET_TOPO_ERRORS, { msg: 'endpointDependencyError', desc: '' });
const cpms = json.data.data;
const keys = Object.keys(cpms);
for (const key of keys) {
@@ -823,8 +861,9 @@ const actions: ActionTree = {
.query('queryTopoInstanceDependency')
.params(params)
.then((res: AxiosResponse) => {
- if (!(res.data && res.data.data)) {
- return;
+ context.commit(types.SET_TOPO_ERRORS, { msg: 'queryTopoInstanceDependency', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ return [];
}
const clientIdsC = [] as string[];
const serverIdsC = [] as string[];
@@ -846,6 +885,13 @@ const actions: ActionTree = {
duration: params.duration,
})
.then((json: AxiosResponse) => {
+ context.commit(types.SET_TOPO_ERRORS, {
+ msg: 'queryDependencyInstanceClientMetric',
+ desc: json.data.errors || '',
+ });
+ if (json.data.errors) {
+ return [];
+ }
const clientCalls = [] as string[];
for (const call of topoCalls) {
for (const cpm of json.data.data.cpmC.values) {
@@ -870,6 +916,13 @@ const actions: ActionTree = {
duration: params.duration,
})
.then((jsonResp: AxiosResponse) => {
+ context.commit(types.SET_TOPO_ERRORS, {
+ msg: 'queryDependencyInstanceServerMetric',
+ desc: jsonResp.data.errors || '',
+ });
+ if (jsonResp.data.errors) {
+ return [];
+ }
const serverCalls = [] as string[];
for (const call of topoCalls) {
for (const cpm of jsonResp.data.data.cpmC.values) {
diff --git a/src/store/modules/trace/index.ts b/src/store/modules/trace/index.ts
index 2fbdd3dd5..fd430d443 100644
--- a/src/store/modules/trace/index.ts
+++ b/src/store/modules/trace/index.ts
@@ -33,6 +33,10 @@ export interface State {
currentTrace: Trace;
traceSpanLogs: any[];
traceSpanLogsTotal: number;
+ traceListErrors: string;
+ traceSpanErrors: string;
+ traceSpanLogErrors: string;
+ traceErrors: { [key: string]: string };
}
const initState: State = {
@@ -56,6 +60,10 @@ const initState: State = {
},
traceSpanLogs: [],
traceSpanLogsTotal: 0,
+ traceListErrors: '',
+ traceSpanErrors: '',
+ traceSpanLogErrors: '',
+ traceErrors: {},
};
// mutations
@@ -119,6 +127,12 @@ const mutations: MutationTree = {
[types.SET_TRACE_SPAN_LOGS_TOTAL](state: State, data: number) {
state.traceSpanLogsTotal = data;
},
+ [types.SET_TRACE_ERRORS](state: State, data: { msg: string; desc: string }) {
+ state.traceErrors = {
+ ...state.traceErrors,
+ [data.msg]: data.desc,
+ };
+ },
};
// actions
@@ -131,6 +145,11 @@ const actions: ActionTree = {
.query('queryServices')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_TRACE_ERRORS, { msg: 'serviceError', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ context.commit(types.SET_SERVICES, []);
+ return;
+ }
context.commit(types.SET_SERVICES, res.data.data.services);
});
},
@@ -139,6 +158,11 @@ const actions: ActionTree = {
.query('queryServiceInstance')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_TRACE_ERRORS, { msg: 'instanceError', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ context.commit(types.SET_INSTANCES, []);
+ return;
+ }
context.commit(types.SET_INSTANCES, res.data.data.instanceId);
});
},
@@ -147,6 +171,11 @@ const actions: ActionTree = {
.query('queryEndpoints')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_TRACE_ERRORS, { msg: 'endpointError', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ context.commit(types.SET_ENDPOINTS, []);
+ return;
+ }
context.commit(types.SET_ENDPOINTS, res.data.data.getEndpoints);
});
},
@@ -159,6 +188,12 @@ const actions: ActionTree = {
.query('queryTraces')
.params({ condition: context.state.traceForm })
.then((res: AxiosResponse) => {
+ context.commit(types.SET_TRACE_ERRORS, { msg: 'queryTraces', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ context.commit(types.SET_TRACELIST, []);
+ context.commit(types.SET_TRACELIST_TOTAL, 0);
+ return;
+ }
context.commit(types.SET_TRACELIST, res.data.data.data.traces);
context.commit(types.SET_TRACELIST_TOTAL, res.data.data.data.total);
});
@@ -169,6 +204,11 @@ const actions: ActionTree = {
.query('queryTrace')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_TRACE_ERRORS, { msg: 'queryTraceSpan', desc: res.data.errors || '' });
+ if (res.data.errors) {
+ context.commit(types.SET_TRACE_SPANS, []);
+ return;
+ }
context.commit(types.SET_TRACE_SPANS, res.data.data.trace.spans);
});
},
@@ -177,10 +217,10 @@ const actions: ActionTree = {
.query('queryServiceLogs')
.params(params)
.then((res: AxiosResponse) => {
+ context.commit(types.SET_TRACE_ERRORS, { msg: 'queryServiceLogs', desc: res.data.errors || '' });
if (res.data && res.data.errors) {
context.commit('SET_TRACE_SPAN_LOGS', []);
context.commit('SET_TRACE_SPAN_LOGS_TOTAL', 0);
-
return;
}
context.commit('SET_TRACE_SPAN_LOGS', res.data.data.queryLogs.logs);
diff --git a/src/store/mutation-types.ts b/src/store/mutation-types.ts
index a348f5e3a..be751d714 100644
--- a/src/store/mutation-types.ts
+++ b/src/store/mutation-types.ts
@@ -59,6 +59,7 @@ export const SET_INSTANCE_INFO = 'SET_INSTANCE_INFO';
// alarm
export const SET_ALARM = 'SET_ALARM';
export const CLEAR_ALARM = 'CLEAR_ALARM';
+export const SET_ALARM_ERRORS = 'SET_ALARM_ERRORS';
// trace
export const SET_TRACELIST = 'SET_TRACELIST';
@@ -72,6 +73,7 @@ export const SET_TRACE_LOGS = 'SET_TRACE_LOGS';
export const SET_TRACE_LOGS_TOTAL = 'SET_TRACE_LOGS_TOTAL';
export const SET_TRACE_SPAN_LOGS_TOTAL = 'SET_TRACE_SPAN_LOGS_TOTAL';
export const SET_TRACE_SPAN_LOGS = 'SET_TRACE_SPAN_LOGS';
+export const SET_TRACE_ERRORS = 'SET_TRACE_ERRORS';
// topo
export const SET_TOPO = 'SET_TOPO';
@@ -121,6 +123,7 @@ export const ADD_TOPO_ENDPOINT_DEPENDENCY_COMP = 'ADD_TOPO_ENDPOINT_DEPENDENCY_C
export const EDIT_ENDPOINT_DEPENDENCY_CONFIG = 'EDIT_ENDPOINT_DEPENDENCY_CONFIG';
export const DELETE_TOPO_ENDPOINT_DEPENDENCY = 'DELETE_TOPO_ENDPOINT_DEPENDENCY';
export const UPDATE_TOPO_TEMPLATE_TYPES = 'UPDATE_TOPO_TEMPLATE_TYPES';
+export const SET_TOPO_ERRORS = 'SET_TOPO_ERRORS';
// profile
export const SET_TASK_OPTIONS = 'SET_TASK_OPTIONS';
@@ -133,6 +136,7 @@ export const SET_CURRENT_SEGMENT = 'SET_CURRENT_SEGMENT';
export const SET_PROFILE_ANALYZATION = 'SET_PROFILE_ANALYZATION';
export const SET_HIGHLIGHT_TOP = 'SET_HIGHLIGHT_TOP';
export const SET_CURRENT_SPAN = 'SET_CURRENT_SPAN';
+export const SET_PROFILE_ERRORS = 'SET_PROFILE_ERRORS';
// Log
export const SELECT_LOG_TYPE = 'SELECT_LOG_TYPE';
@@ -149,10 +153,12 @@ export const SET_CURRENT_LOG_INSTANCE = 'SET_CURRENT_LOG_INSTANCE';
export const SET_LOG_CONDITIONS = 'SET_LOG_CONDITIONS';
export const SET_SUPPORT_QUERY_LOGS_KEYWORDS = 'SET_SUPPORT_QUERY_LOGS_KEYWORDS';
export const CLEAR_LOG_CONDITIONS = 'CLEAR_LOG_CONDITIONS';
+export const SET_LOG_ERRORS = 'SET_LOG_ERRORS';
// Event
export const UPDATE_EVENTS = 'UPDATE_EVENTS';
export const SET_TOTAL_SIZE = 'SET_TOTAL_SIZE';
+export const SET_EVENT_ERRORS = 'SET_EVENT_ERRORS';
// debug
export const SET_TAB_TYPE = 'SET_TAB_TYPE';
diff --git a/src/utils/tooltip.ts b/src/utils/tooltip.ts
index 3ce60aa08..e0e10fd2f 100644
--- a/src/utils/tooltip.ts
+++ b/src/utils/tooltip.ts
@@ -47,9 +47,7 @@ function setAttributes($inner: any, el: any) {
return;
}
const isShow =
- !popper._disabled &&
- (popper._visible || popper._always) &&
- (!popper._ellipsis || isEllipsisTooltip(el));
+ !popper._disabled && (popper._visible || popper._always) && (!popper._ellipsis || isEllipsisTooltip(el));
if (popper._appendToBody) {
if (isShow && popper.popper.parentNode !== document.body) {
@@ -82,13 +80,11 @@ function handleClosePopper(e: any) {
}
}
-// 添加事件
function addEvent(el: any) {
el.addEventListener('mouseenter', handleShowPopper);
el.addEventListener('mouseleave', handleClosePopper);
}
-// 移除事件
function removeEvent(el: any) {
el.removeEventListener('mouseenter', handleShowPopper);
el.removeEventListener('mouseleave', handleClosePopper);
@@ -122,9 +118,7 @@ export default {
$popper.style.display = 'none';
el.appendChild($popper);
} else {
- $popper.className += ` append-to-body ${
- binding.value.popperCls ? binding.value.popperCls.join(' ') : ''
- }`;
+ $popper.className += ` append-to-body ${binding.value.popperCls ? binding.value.popperCls.join(' ') : ''}`;
}
}
@@ -145,10 +139,7 @@ export default {
if (el.popper.popper) {
el.removeChild(el.popper.popper);
}
- } else if (
- el.popper.popper &&
- el.popper.popper.parentNode === document.body
- ) {
+ } else if (el.popper.popper && el.popper.popper.parentNode === document.body) {
document.body.removeChild(el.popper.popper);
}
},
diff --git a/src/views/components/common/alerts-content.vue b/src/views/components/common/alerts-content.vue
new file mode 100644
index 000000000..9fdc638ee
--- /dev/null
+++ b/src/views/components/common/alerts-content.vue
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/rk-footer.vue b/src/views/components/common/rk-footer.vue
similarity index 96%
rename from src/components/rk-footer.vue
rename to src/views/components/common/rk-footer.vue
index 0b2427446..8a4074c68 100644
--- a/src/components/rk-footer.vue
+++ b/src/views/components/common/rk-footer.vue
@@ -27,9 +27,8 @@ limitations under the License. -->