clear data

This commit is contained in:
Fine 2024-11-28 15:56:30 +08:00
parent c2e551e13e
commit ede9fc40ea
3 changed files with 16 additions and 2 deletions

View File

@ -49,6 +49,9 @@ export const asyncProfilingStore = defineStore({
setSelectedTask(task: Recordable<AsyncProfilingTask>) {
this.selectedTask = task || {};
},
setAnalyzeTrees(tree: AsyncProfilerStackElement[]) {
this.analyzeTrees = tree;
},
async getTaskList() {
const { duration } = useAppStoreWithOut();
const selectorStore = useSelectorStore();
@ -64,6 +67,7 @@ export const asyncProfilingStore = defineStore({
}
this.taskList = res.data.data.asyncTaskList.tasks || [];
this.selectedTask = this.taskList[0] || {};
this.setAnalyzeTrees([]);
this.setSelectedTask(this.selectedTask);
if (!this.taskList.length) {
return res.data;

View File

@ -37,7 +37,7 @@ limitations under the License. -->
</div>
</template>
<script lang="ts" setup>
import { computed, ref } from "vue";
import { computed, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import { ElMessage } from "element-plus";
import { useAsyncProfilingStore } from "@/store/modules/async-profiling";
@ -60,10 +60,12 @@ limitations under the License. -->
function changeInstances(options: Option[]) {
serviceInstanceIds.value = options.map((d: Option) => d.value);
asyncProfilingStore.setAnalyzeTrees([]);
}
function changeEventType(options: Option[]) {
selectedEventType.value = options[0].value;
asyncProfilingStore.setAnalyzeTrees([]);
}
async function analyzeProfiling() {
@ -80,6 +82,14 @@ limitations under the License. -->
return;
}
}
watch(
() => asyncProfilingStore.selectedTask.successInstanceIds,
() => {
serviceInstanceIds.value = [];
selectedEventType.value = "";
},
);
</script>
<style>
.filter-selector {

View File

@ -160,6 +160,7 @@ limitations under the License. -->
async function changeTask(item: TaskListItem) {
asyncProfilingStore.setSelectedTask(item);
asyncProfilingStore.setAnalyzeTrees([]);
service.value = (selectorStore.services.filter((s: Service) => s.id === item.serviceId)[0] ?? {}).label;
const res = await asyncProfilingStore.getTaskLogs({ taskId: item.id });
@ -189,7 +190,6 @@ limitations under the License. -->
instanceLogs.value[d.instanceName] = [{ operationType: d.operationType, operationTime: d.operationTime }];
}
}
asyncProfilingStore.setSelectedTask(item);
}
watch(