From 591cec17db37af7af40637cf4e11ab692a11c369 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Mon, 20 Jun 2022 16:19:52 +0800 Subject: [PATCH] add event header --- src/store/modules/event.ts | 16 +- src/views/dashboard/controls/Event.vue | 49 +++- src/views/dashboard/related/event/Header.vue | 233 +++++++++++++++++++ src/views/dashboard/related/event/data.ts | 30 +++ src/views/event/Header.vue | 1 - 5 files changed, 324 insertions(+), 5 deletions(-) create mode 100644 src/views/dashboard/related/event/Header.vue create mode 100644 src/views/dashboard/related/event/data.ts diff --git a/src/store/modules/event.ts b/src/store/modules/event.ts index 01b6788a..3193f00b 100644 --- a/src/store/modules/event.ts +++ b/src/store/modules/event.ts @@ -21,6 +21,7 @@ import { AxiosResponse } from "axios"; import { Event, QueryEventCondition } from "@/types/events"; import { Instance, Endpoint, Service } from "@/types/selector"; import { useAppStoreWithOut } from "@/store/modules/app"; +import { useSelectorStore } from "@/store/modules/selectors"; interface eventState { loading: boolean; @@ -45,7 +46,7 @@ export const eventStore = defineStore({ }), actions: { setEventCondition(data: any) { - this.condition = { ...this.condition, ...data }; + this.condition = data; }, async getServices(layer: string) { if (!layer) { @@ -61,7 +62,10 @@ export const eventStore = defineStore({ this.services = res.data.data.services; return res.data; }, - async getInstances(serviceId: string) { + async getInstances() { + const serviceId = useSelectorStore().currentService + ? useSelectorStore().currentService.id + : ""; const res: AxiosResponse = await graphql.query("queryInstances").params({ serviceId, duration: useAppStoreWithOut().durationTime, @@ -75,7 +79,13 @@ export const eventStore = defineStore({ ]; return res.data; }, - async getEndpoints(serviceId: string) { + async getEndpoints() { + const serviceId = useSelectorStore().currentService + ? useSelectorStore().currentService.id + : ""; + if (!serviceId) { + return; + } const res: AxiosResponse = await graphql.query("queryEndpoints").params({ serviceId, duration: useAppStoreWithOut().durationTime, diff --git a/src/views/dashboard/controls/Event.vue b/src/views/dashboard/controls/Event.vue index e18c7694..3c089ae6 100644 --- a/src/views/dashboard/controls/Event.vue +++ b/src/views/dashboard/controls/Event.vue @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + diff --git a/src/views/dashboard/related/event/Header.vue b/src/views/dashboard/related/event/Header.vue new file mode 100644 index 00000000..b29f99ed --- /dev/null +++ b/src/views/dashboard/related/event/Header.vue @@ -0,0 +1,233 @@ + + + + diff --git a/src/views/dashboard/related/event/data.ts b/src/views/dashboard/related/event/data.ts new file mode 100644 index 00000000..e5c7d5da --- /dev/null +++ b/src/views/dashboard/related/event/data.ts @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export const EventsDetailKeys = [ + { text: "eventID", class: "uuid" }, + { text: "eventName", class: "name" }, + { text: "eventsType", class: "type" }, + { text: "startTime", class: "startTime" }, + { text: "endTime", class: "endTime" }, + { text: "eventsMessage", class: "message" }, + { text: "eventSource", class: "source" }, +]; +export const EventTypes = [ + { label: "All", value: "" }, + { label: "Normal", value: "Normal" }, + { label: "Error", value: "Error" }, +]; diff --git a/src/views/event/Header.vue b/src/views/event/Header.vue index 3b2da10f..2ca289f6 100644 --- a/src/views/event/Header.vue +++ b/src/views/event/Header.vue @@ -80,7 +80,6 @@ limitations under the License. --> @current-change="updatePage" :pager-count="5" small - :style="`--el-pagination-bg-color: #f0f2f5; --el-pagination-button-disabled-bg-color: #f0f2f5;`" />