diff --git a/src/store/modules/async-profiling.ts b/src/store/modules/async-profiling.ts index 71833382..c76723d4 100644 --- a/src/store/modules/async-profiling.ts +++ b/src/store/modules/async-profiling.ts @@ -25,13 +25,12 @@ import type { import { store } from "@/store"; import graphql from "@/graphql"; import { useAppStoreWithOut } from "@/store/modules/app"; +import { useSelectorStore } from "@/store/modules/selectors"; import type { AxiosResponse } from "axios"; import type { Instance } from "@/types/selector"; interface AsyncProfilingState { taskList: Array>; - labels: Option[]; - asyncProfilingTips: string; selectedTask: Recordable; taskProgress: Recordable; instances: Instance[]; @@ -42,8 +41,6 @@ export const asyncProfilingStore = defineStore({ id: "asyncProfiling", state: (): AsyncProfilingState => ({ taskList: [], - labels: [{ value: "", label: "" }], - asyncProfilingTips: "", selectedTask: {}, taskProgress: {}, instances: [], @@ -53,15 +50,11 @@ export const asyncProfilingStore = defineStore({ setSelectedTask(task: Recordable) { this.selectedTask = task || {}; }, - async getTaskList(params: { serviceId: string; startTime: number; endTime: number }) { - if (!params.serviceId) { - return new Promise((resolve) => resolve({})); - } + async getTaskList(params?: { startTime: number; endTime: number }) { + const selectorStore = useSelectorStore(); const res: AxiosResponse = await graphql .query("getAsyncTaskList") - .params({ request: { ...params, limit: 10000 } }); - - this.asyncProfilingTips = ""; + .params({ request: { ...params, limit: 10000, serviceId: selectorStore.currentService.id } }); if (res.data.errors) { return res.data; } diff --git a/src/views/dashboard/related/async-profiling/components/NewTask.vue b/src/views/dashboard/related/async-profiling/components/NewTask.vue index daeb4b51..3fd9e273 100644 --- a/src/views/dashboard/related/async-profiling/components/NewTask.vue +++ b/src/views/dashboard/related/async-profiling/components/NewTask.vue @@ -77,12 +77,10 @@ limitations under the License. --> } async function createTask() { - emits("close"); const params = { serviceId: selectorStore.currentService.id, serviceInstanceIds: serviceInstanceIds.value, duration: Number(duration.value), - createTime: new Date().getTime(), events: asyncEvents.value, execArgs: execArgs.value, }; @@ -96,6 +94,7 @@ limitations under the License. --> ElMessage.error(tip); return; } + emits("close"); ElMessage.success("Task created successfully"); } diff --git a/src/views/dashboard/related/async-profiling/components/TaskList.vue b/src/views/dashboard/related/async-profiling/components/TaskList.vue index e2bd9b4a..70b95547 100644 --- a/src/views/dashboard/related/async-profiling/components/TaskList.vue +++ b/src/views/dashboard/related/async-profiling/components/TaskList.vue @@ -153,9 +153,7 @@ limitations under the License. --> }); async function fetchTasks() { - const res = await asyncProfilingStore.getTaskList({ - serviceId: selectorStore.currentService.id, - }); + const res = await asyncProfilingStore.getTaskList(); if (res.errors) { ElMessage.error(res.errors); }