This commit is contained in:
Fine 2024-12-03 11:15:04 +08:00
parent ca5d7e8ebe
commit 7d1e399441
2 changed files with 5 additions and 6 deletions

View File

@ -35,6 +35,7 @@ interface AsyncProfilingState {
instances: Instance[];
analyzeTrees: AsyncProfilerStackElement[];
loadingTree: boolean;
loadingTasks: boolean;
}
export const asyncProfilingStore = defineStore({
@ -46,6 +47,7 @@ export const asyncProfilingStore = defineStore({
instances: [],
analyzeTrees: [],
loadingTree: false,
loadingTasks: false,
}),
actions: {
setSelectedTask(task: Recordable<AsyncProfilingTask>) {
@ -55,14 +57,14 @@ export const asyncProfilingStore = defineStore({
this.analyzeTrees = tree;
},
async getTaskList() {
const { durationTime } = useAppStoreWithOut();
const selectorStore = useSelectorStore();
this.loadingTasks = true;
const res: AxiosResponse = await graphql.query("getAsyncTaskList").params({
request: {
queryDuration: durationTime,
serviceId: selectorStore.currentService.id,
},
});
this.loadingTasks = false;
if (res.data.errors) {
return res.data;
}

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
<template>
<div class="profile-task-list flex-v" v-loading="loading">
<div class="profile-task-list flex-v" v-loading="asyncProfilingStore.loadingTasks">
<div class="profile-t-tool flex-h">{{ t("taskList") }}</div>
<div class="profile-t-wrapper">
<div class="no-data" v-show="!asyncProfilingStore.taskList.length">
@ -141,16 +141,13 @@ limitations under the License. -->
const instanceLogs = ref<TaskLog | any>({});
const errorInstances = ref<Instance[]>([]);
const successInstances = ref<Instance[]>([]);
const loading = ref<boolean>(false);
onMounted(() => {
fetchTasks();
});
async function fetchTasks() {
loading.value = true;
const res = await asyncProfilingStore.getTaskList();
loading.value = false;
if (res.errors) {
return ElMessage.error(res.errors);
}