diff --git a/src/store/modules/network-profiling.ts b/src/store/modules/network-profiling.ts index 65b1881e..88cd54d4 100644 --- a/src/store/modules/network-profiling.ts +++ b/src/store/modules/network-profiling.ts @@ -115,10 +115,6 @@ export const networkProfilingStore = defineStore({ if (res.data.errors) { return res.data; } - await this.getTaskList({ - ...param, - targets: ["NETWORK"], - }); return res.data; }, async getTaskList(params: { diff --git a/src/views/dashboard/related/network-profiling/components/Tasks.vue b/src/views/dashboard/related/network-profiling/components/Tasks.vue index 3c1d296b..724cd170 100644 --- a/src/views/dashboard/related/network-profiling/components/Tasks.vue +++ b/src/views/dashboard/related/network-profiling/components/Tasks.vue @@ -17,7 +17,6 @@ limitations under the License. -->
{{ t("taskList") }} - new Date().getTime() - ? true - : false; + const task = networkProfilingStore.networkTasks[0] || {}; + if (task.taskId === taskId) { + inProcess.value = + task.taskStartTime + task.fixedTriggerDuration * 1000 > + new Date().getTime() + ? true + : false; + } if (!inProcess.value) { intervalFn.value && clearInterval(intervalFn.value); } @@ -173,8 +177,9 @@ async function createTask() { }); if (res.errors) { ElMessage.error(res.errors); + return; } - await getTopology(); + await fetchTasks(); } async function enableInterval() { const res = await networkProfilingStore.keepNetworkProfiling( @@ -184,9 +189,7 @@ async function enableInterval() { return ElMessage.error(res.errors); } if (networkProfilingStore.aliveNetwork) { - intervalFn.value = setInterval(() => { - getTopology(); - }, 60000); + intervalFn.value = setInterval(getTopology, 6000); } } async function fetchTasks() { diff --git a/src/views/dashboard/related/network-profiling/components/TimeLine.vue b/src/views/dashboard/related/network-profiling/components/TimeLine.vue index 853154a0..aff1b771 100644 --- a/src/views/dashboard/related/network-profiling/components/TimeLine.vue +++ b/src/views/dashboard/related/network-profiling/components/TimeLine.vue @@ -83,8 +83,12 @@ function visTimeline() { if (fixedTriggerDuration > 1800) { startTime = taskStartTime + fixedTriggerDuration * 1000 - 30 * 60 * 1000; } + const d = networkProfilingStore.networkTasks[0] || {}; let endTime = taskStartTime + fixedTriggerDuration * 1000; - if (taskStartTime + fixedTriggerDuration * 1000 > new Date().getTime()) { + if ( + taskStartTime + fixedTriggerDuration * 1000 > new Date().getTime() && + taskId === d.taskId + ) { endTime = new Date().getTime(); } task.value = [