From 1d7eb0f0e518f2454b5797ce69c5449668978a10 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Tue, 7 Jun 2022 17:00:49 +0800 Subject: [PATCH] fix time range --- .../dashboard/related/demand-log/Header.vue | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/views/dashboard/related/demand-log/Header.vue b/src/views/dashboard/related/demand-log/Header.vue index 3164bc9c..65615f22 100644 --- a/src/views/dashboard/related/demand-log/Header.vue +++ b/src/views/dashboard/related/demand-log/Header.vue @@ -165,21 +165,23 @@ const state = reactive({ }); /*global Nullable */ const intervalFn = ref>(null); -const rangeTime = computed(() => { - const times = { - start: getLocalTime( - appStore.utc, - new Date(new Date().getTime() - state.duration.value * 1000) - ), - end: getLocalTime(appStore.utc, new Date()), - step: "SECOND", - }; - return { - start: dateFormatStep(times.start, times.step, false), - end: dateFormatStep(times.end, times.step, false), - step: times.step, - }; -}); +function rangeTime() { + { + const times = { + start: getLocalTime( + appStore.utc, + new Date(new Date().getTime() - state.duration.value * 1000) + ), + end: getLocalTime(appStore.utc, new Date()), + step: "SECOND", + }; + return { + start: dateFormatStep(times.start, times.step, false), + end: dateFormatStep(times.end, times.step, false), + step: times.step, + }; + } +} onMounted(() => { fetchSelectors(); @@ -236,7 +238,7 @@ function searchLogs() { demandLogStore.setLogCondition({ serviceInstanceId: instance || state.instance.id || "", container: state.container.value, - duration: rangeTime.value, + duration: rangeTime(), keywordsOfContent: keywordsOfContent.value.length ? keywordsOfContent.value : undefined,