fix condition

This commit is contained in:
Qiuxia Fan 2022-06-21 15:38:00 +08:00
parent a9f4fdd5ec
commit bb744fc0f4
2 changed files with 6 additions and 3 deletions

View File

@ -18,7 +18,7 @@ limitations under the License. -->
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { useEventStore } from "../../../../store/modules/event"; import { useEventStore } from "@/store/modules/event";
import { DataSet, Timeline } from "vis-timeline/standalone"; import { DataSet, Timeline } from "vis-timeline/standalone";
import "vis-timeline/styles/vis-timeline-graph2d.css"; import "vis-timeline/styles/vis-timeline-graph2d.css";
const eventStore = useEventStore(); const eventStore = useEventStore();
@ -34,6 +34,9 @@ function visTimeline() {
if (!timeline.value) { if (!timeline.value) {
return; return;
} }
if (visGraph.value) {
visGraph.value.destroy();
}
const h = timeline.value.getBoundingClientRect().height; const h = timeline.value.getBoundingClientRect().height;
const events = eventStore.events.map((d, index) => { const events = eventStore.events.map((d, index) => {
return { return {

View File

@ -140,8 +140,8 @@ async function getInstances(id?: string) {
state.instance = eventStore.instances[0]; state.instance = eventStore.instances[0];
} }
async function queryEvents() { async function queryEvents() {
let endpoint = "", let endpoint = state.endpoint.value,
instance = ""; instance = state.instance.value;
if (dashboardStore.entity === EntityType[2].value) { if (dashboardStore.entity === EntityType[2].value) {
endpoint = selectorStore.currentPod.id; endpoint = selectorStore.currentPod.id;
} }