diff --git a/src/store/modules/event.ts b/src/store/modules/event.ts index 031a6b3d..2fbd14e7 100644 --- a/src/store/modules/event.ts +++ b/src/store/modules/event.ts @@ -89,14 +89,28 @@ export const eventStore = defineStore({ return res.data; }, async getEvents() { + this.loading = true; const res: AxiosResponse = await graphql .query("queryEvents") .params({ condition: this.condition }); + this.loading = false; if (res.data.errors) { return res.data; } if (res.data.data.fetchEvents) { - this.events = res.data.data.fetchEvents.events; + this.events = (res.data.data.fetchEvents.events || []).map( + (item: Event) => { + let scope = "Service"; + if (item.source.serviceInstance) { + scope = "ServiceInstance"; + } + if (item.source.endpoint) { + scope = "Endpoint"; + } + item.scope = scope; + return item; + } + ); this.total = res.data.data.fetchEvents.total; } return res.data; diff --git a/src/types/events.d.ts b/src/types/events.d.ts index 5493588a..e4684134 100644 --- a/src/types/events.d.ts +++ b/src/types/events.d.ts @@ -37,3 +37,9 @@ export interface QueryEventCondition { order: string; paging: { pageNum: number; pageSize: number; needTotal: boolean }; } + +type SourceInput = { + service: string; + serviceInstance: string; + endpoint: string; +}; diff --git a/src/views/Event.vue b/src/views/Event.vue index bb982a8e..b308ce8c 100644 --- a/src/views/Event.vue +++ b/src/views/Event.vue @@ -15,11 +15,13 @@ limitations under the License. --> +