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[]; instances: Instance[];
analyzeTrees: AsyncProfilerStackElement[]; analyzeTrees: AsyncProfilerStackElement[];
loadingTree: boolean; loadingTree: boolean;
loadingTasks: boolean;
} }
export const asyncProfilingStore = defineStore({ export const asyncProfilingStore = defineStore({
@ -46,6 +47,7 @@ export const asyncProfilingStore = defineStore({
instances: [], instances: [],
analyzeTrees: [], analyzeTrees: [],
loadingTree: false, loadingTree: false,
loadingTasks: false,
}), }),
actions: { actions: {
setSelectedTask(task: Recordable<AsyncProfilingTask>) { setSelectedTask(task: Recordable<AsyncProfilingTask>) {
@ -55,14 +57,14 @@ export const asyncProfilingStore = defineStore({
this.analyzeTrees = tree; this.analyzeTrees = tree;
}, },
async getTaskList() { async getTaskList() {
const { durationTime } = useAppStoreWithOut();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
this.loadingTasks = true;
const res: AxiosResponse = await graphql.query("getAsyncTaskList").params({ const res: AxiosResponse = await graphql.query("getAsyncTaskList").params({
request: { request: {
queryDuration: durationTime,
serviceId: selectorStore.currentService.id, serviceId: selectorStore.currentService.id,
}, },
}); });
this.loadingTasks = false;
if (res.data.errors) { if (res.data.errors) {
return res.data; 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 See the License for the specific language governing permissions and
limitations under the License. --> limitations under the License. -->
<template> <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-tool flex-h">{{ t("taskList") }}</div>
<div class="profile-t-wrapper"> <div class="profile-t-wrapper">
<div class="no-data" v-show="!asyncProfilingStore.taskList.length"> <div class="no-data" v-show="!asyncProfilingStore.taskList.length">
@ -141,16 +141,13 @@ limitations under the License. -->
const instanceLogs = ref<TaskLog | any>({}); const instanceLogs = ref<TaskLog | any>({});
const errorInstances = ref<Instance[]>([]); const errorInstances = ref<Instance[]>([]);
const successInstances = ref<Instance[]>([]); const successInstances = ref<Instance[]>([]);
const loading = ref<boolean>(false);
onMounted(() => { onMounted(() => {
fetchTasks(); fetchTasks();
}); });
async function fetchTasks() { async function fetchTasks() {
loading.value = true;
const res = await asyncProfilingStore.getTaskList(); const res = await asyncProfilingStore.getTaskList();
loading.value = false;
if (res.errors) { if (res.errors) {
return ElMessage.error(res.errors); return ElMessage.error(res.errors);
} }