From e4a70fb14b18328123a5b41f07bc4463f979fccb Mon Sep 17 00:00:00 2001 From: Fine Date: Mon, 22 Aug 2022 18:33:30 +0800 Subject: [PATCH] update interval --- src/store/modules/network-profiling.ts | 4 +++- .../related/network-profiling/components/Tasks.vue | 13 +++++++++---- .../network-profiling/components/TimeLine.vue | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/store/modules/network-profiling.ts b/src/store/modules/network-profiling.ts index 99d201ea..65b1881e 100644 --- a/src/store/modules/network-profiling.ts +++ b/src/store/modules/network-profiling.ts @@ -155,7 +155,9 @@ export const networkProfilingStore = defineStore({ return res.data; } this.aliveNetwork = res.data.data.keepEBPFNetworkProfiling.status; - ElMessage.warning(res.data.data.keepEBPFNetworkProfiling.errorReason); + if (!this.aliveNetwork) { + ElMessage.warning(res.data.data.keepEBPFNetworkProfiling.errorReason); + } return res.data; }, async getProcessTopology(params: { diff --git a/src/views/dashboard/related/network-profiling/components/Tasks.vue b/src/views/dashboard/related/network-profiling/components/Tasks.vue index 4bc37489..0538e0cb 100644 --- a/src/views/dashboard/related/network-profiling/components/Tasks.vue +++ b/src/views/dashboard/related/network-profiling/components/Tasks.vue @@ -174,12 +174,17 @@ async function createTask() { } await getTopology(); } -function enableInterval() { +async function enableInterval() { enableTasks.value = !enableTasks.value; if (enableTasks.value) { - intervalFn.value = setInterval(() => { - fetchTasks(); - }, 180000); + await networkProfilingStore.keepNetworkProfiling( + networkProfilingStore.selectedNetworkTask.taskId + ); + if (networkProfilingStore.aliveNetwork) { + intervalFn.value = setInterval(() => { + fetchTasks(); + }, 180000); + } return; } intervalFn.value && clearInterval(intervalFn.value); diff --git a/src/views/dashboard/related/network-profiling/components/TimeLine.vue b/src/views/dashboard/related/network-profiling/components/TimeLine.vue index e7ead4da..2c3ec170 100644 --- a/src/views/dashboard/related/network-profiling/components/TimeLine.vue +++ b/src/views/dashboard/related/network-profiling/components/TimeLine.vue @@ -98,14 +98,14 @@ function visTimeline() { task.value = properties.data; }); const itemsAlwaysDraggable = - fixedTriggerDuration > 500 + fixedTriggerDuration > 1800 ? { item: true, range: true, } : undefined; const editable = - fixedTriggerDuration > 500 + fixedTriggerDuration > 1800 ? { updateTime: true, }