This commit is contained in:
Qiuxia Fan 2022-04-24 12:55:25 +08:00
parent 96164e5623
commit 1f173b5c62
2 changed files with 10 additions and 3 deletions

View File

@ -117,7 +117,7 @@ const handleSelectionChange = (arr: Process[]) => {
}; };
async function analyzeEBPF() { async function analyzeEBPF() {
let arr: string[] = []; let arr: string[] = selectedLabels.value;
if (selectedLabels.value.includes("0")) { if (selectedLabels.value.includes("0")) {
arr = labels.value.map((d: Option) => d.value); arr = labels.value.map((d: Option) => d.value);
} }
@ -125,7 +125,7 @@ async function analyzeEBPF() {
const scheduleIdList = ebpfStore.eBPFSchedules.flatMap( const scheduleIdList = ebpfStore.eBPFSchedules.flatMap(
(d: EBPFProfilingSchedule) => { (d: EBPFProfilingSchedule) => {
const l = d.process.labels.find((d: string) => arr.includes(d)); const l = d.process.labels.find((d: string) => arr.includes(d));
const i = selectedLabels.value.includes(d.process.id); const i = selectedProcesses.value.includes(d.process.id);
if (l || i) { if (l || i) {
ranges.push({ ranges.push({
start: d.startTime, start: d.startTime,
@ -164,6 +164,7 @@ function visTimeline() {
visGraph.value.destroy(); visGraph.value.destroy();
} }
labels.value = [{ label: "All", value: "0" }]; labels.value = [{ label: "All", value: "0" }];
selectedLabels.value = ["0"];
processes.value = []; processes.value = [];
const schedules = ebpfStore.eBPFSchedules.map( const schedules = ebpfStore.eBPFSchedules.map(
(d: EBPFProfilingSchedule, index: number) => { (d: EBPFProfilingSchedule, index: number) => {

View File

@ -103,7 +103,7 @@ limitations under the License. -->
</el-dialog> </el-dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { ref, watch } from "vue";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { useEbpfStore } from "@/store/modules/ebpf"; import { useEbpfStore } from "@/store/modules/ebpf";
@ -126,6 +126,12 @@ async function changeTask(item: EBPFTaskList) {
ElMessage.error(res.errors); ElMessage.error(res.errors);
} }
} }
watch(
() => ebpfStore.taskList,
() => {
selectedTask.value = ebpfStore.taskList[0] || {};
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.profile-task-list { .profile-task-list {