From 017f5bf7094b29871d63f2a5b15761ca5520d253 Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Wed, 20 Jul 2022 19:42:41 +0800 Subject: [PATCH] fix errors (#124) --- src/views/dashboard/controls/Event.vue | 2 +- src/views/dashboard/related/event/Content.vue | 11 +++++++++-- src/views/dashboard/related/event/Header.vue | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/views/dashboard/controls/Event.vue b/src/views/dashboard/controls/Event.vue index c4cc16ac..8066969d 100644 --- a/src/views/dashboard/controls/Event.vue +++ b/src/views/dashboard/controls/Event.vue @@ -36,7 +36,7 @@ limitations under the License. -->
- +
diff --git a/src/views/dashboard/related/event/Content.vue b/src/views/dashboard/related/event/Content.vue index 14d2c3b4..36511eee 100644 --- a/src/views/dashboard/related/event/Content.vue +++ b/src/views/dashboard/related/event/Content.vue @@ -30,7 +30,13 @@ import { dateFormatTime } from "@/utils/dateFormat"; import { useAppStoreWithOut } from "@/store/modules/app"; const eventStore = useEventStore(); -/*global Nullable */ +/*global defineProps, Nullable */ +const props = defineProps({ + data: { + type: Object, + default: () => ({}), + }, +}); const timeline = ref>(null); const visGraph = ref>(null); const oldVal = ref<{ width: number; height: number }>({ width: 0, height: 0 }); @@ -97,9 +103,10 @@ function visTimeline() { }; visGraph.value = new Timeline(timeline.value, items, options); visGraph.value.on("select", (properties: { items: number[] }) => { - if (!dashboardStore.selectedGrid.eventAssociate) { + if (!props.data.eventAssociate) { return; } + dashboardStore.selectWidget(props.data); const all = getDashboard(dashboardStore.currentDashboard).widgets; const widgets = all.filter( (d: { value: string; label: string } & LayoutConfig) => { diff --git a/src/views/dashboard/related/event/Header.vue b/src/views/dashboard/related/event/Header.vue index 5ce838ff..81550438 100644 --- a/src/views/dashboard/related/event/Header.vue +++ b/src/views/dashboard/related/event/Header.vue @@ -125,6 +125,9 @@ function fetchSelectors() { async function getEndpoints(id?: string) { const resp = await eventStore.getEndpoints(id); + if (!resp) { + return; + } if (resp.errors) { ElMessage.error(resp.errors); return; @@ -148,6 +151,9 @@ async function queryEvents() { if (dashboardStore.entity === EntityType[3].value) { instance = selectorStore.currentPod.id; } + if (!selectorStore.currentService) { + return; + } eventStore.setEventCondition({ // layer: dashboardStore.layerId, paging: {