From 042ee3b9b15d7e6e8e4d2ac673ab0dbd8b6317ee Mon Sep 17 00:00:00 2001 From: Fine Date: Fri, 29 Nov 2024 11:24:39 +0800 Subject: [PATCH] update --- src/store/modules/profile.ts | 6 +- .../profile/components/SegmentList.vue | 7 +-- .../related/profile/components/TaskList.vue | 63 +++++++++---------- 3 files changed, 34 insertions(+), 42 deletions(-) diff --git a/src/store/modules/profile.ts b/src/store/modules/profile.ts index 4fd4b200..55ac9a5b 100644 --- a/src/store/modules/profile.ts +++ b/src/store/modules/profile.ts @@ -80,7 +80,7 @@ export const profileStore = defineStore({ this.analyzeTrees = []; }, setCurrentSegment(segment: Trace) { - this.currentSegment = segment; + this.currentSegment = segment || {}; this.segmentSpans = segment.spans || []; if (segment.spans) { this.currentSpan = segment.spans[0] || {}; @@ -155,10 +155,10 @@ export const profileStore = defineStore({ return res.data; } if (segmentList[0]) { - this.currentSegment = segmentList[0]; + this.setCurrentSegment(segmentList[0]); this.getSegmentSpans(segmentList[0].segmentId); } else { - this.currentSegment = {}; + this.setCurrentSegment({}); } return res.data; }, diff --git a/src/views/dashboard/related/profile/components/SegmentList.vue b/src/views/dashboard/related/profile/components/SegmentList.vue index e0069ff1..03101d77 100644 --- a/src/views/dashboard/related/profile/components/SegmentList.vue +++ b/src/views/dashboard/related/profile/components/SegmentList.vue @@ -56,12 +56,7 @@ limitations under the License. --> const { t } = useI18n(); const profileStore = useProfileStore(); const key = computed( - () => - (profileStore.currentSegment && - profileStore.currentSegment.spans && - profileStore.currentSegment.spans.length && - profileStore.currentSegment.spans[0].segmentId) || - "", + () => (profileStore.currentSegment.spans?.length && profileStore.currentSegment.spans[0].segmentId) || "", ); async function selectSegment(item: Trace) { diff --git a/src/views/dashboard/related/profile/components/TaskList.vue b/src/views/dashboard/related/profile/components/TaskList.vue index 39a26249..9efc0b0f 100644 --- a/src/views/dashboard/related/profile/components/TaskList.vue +++ b/src/views/dashboard/related/profile/components/TaskList.vue @@ -14,38 +14,36 @@ See the License for the specific language governing permissions and limitations under the License. -->