You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by qi...@apache.org on 2024/11/07 02:31:12 UTC

(skywalking-booster-ui) branch main updated: feat: implement owner option for TopList widgets in related trace options (#426)

This is an automated email from the ASF dual-hosted git repository.

qiuxiafan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-booster-ui.git


The following commit(s) were added to refs/heads/main by this push:
     new aeddb396 feat: implement owner option for TopList widgets in related trace options (#426)
aeddb396 is described below

commit aeddb39637740e3a43ca43671d4e045709666718
Author: Fine0830 <fa...@gmail.com>
AuthorDate: Thu Nov 7 10:31:06 2024 +0800

    feat: implement owner option for TopList widgets in related trace options (#426)
---
 .../dashboard/configuration/widget/RelatedTraceOptions.vue  |  2 +-
 src/views/dashboard/data.ts                                 |  3 ++-
 src/views/dashboard/graphs/TopList.vue                      |  9 +++++----
 src/views/dashboard/related/trace/Header.vue                | 13 ++++++++-----
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/views/dashboard/configuration/widget/RelatedTraceOptions.vue b/src/views/dashboard/configuration/widget/RelatedTraceOptions.vue
index 2cc27e2e..9b980723 100644
--- a/src/views/dashboard/configuration/widget/RelatedTraceOptions.vue
+++ b/src/views/dashboard/configuration/widget/RelatedTraceOptions.vue
@@ -81,7 +81,7 @@ limitations under the License. -->
   const latency = ref<boolean>(traceOpt.latency || false);
   const enableRelate = ref<boolean>(traceOpt.enableRelate || false);
   const type = ref<string>((graph && graph.type) || "");
-  const refIdType = ref<string>(traceOpt.refIdType || "traceId");
+  const refIdType = ref<string>(traceOpt.refIdType || "");
 
   function updateConfig(param: { [key: string]: unknown }) {
     const relatedTrace = {
diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts
index c691ba02..07032df1 100644
--- a/src/views/dashboard/data.ts
+++ b/src/views/dashboard/data.ts
@@ -266,8 +266,9 @@ export const TextColors: { [key: string]: string } = {
 };
 
 export const RefIdTypes = [
-  { label: "Trace ID", value: "traceId" },
   { label: "None", value: "none" },
+  { label: "Trace ID", value: "traceId" },
+  { label: "Owner", value: "owner" },
 ];
 export const RefreshOptions = [
   { label: "Last 30 minutes", value: "30", step: "MINUTE" },
diff --git a/src/views/dashboard/graphs/TopList.vue b/src/views/dashboard/graphs/TopList.vue
index 2c1349f3..9f43b88b 100644
--- a/src/views/dashboard/graphs/TopList.vue
+++ b/src/views/dashboard/graphs/TopList.vue
@@ -32,7 +32,7 @@ limitations under the License. -->
           <div class="operation" @click="handleClick(i.name)">
             <span>{{ t("copy") }}</span>
           </div>
-          <div class="operation" @click="viewTrace(i)" v-show="refIdType === RefIdTypes[0].value">
+          <div class="operation" @click="viewTrace(i)" v-show="![RefIdTypes[0].value].includes(refIdType)">
             <span>{{ t("viewTrace") }}</span>
           </div>
           <div class="operation" @click="viewDashboard(i)">
@@ -75,7 +75,7 @@ limitations under the License. -->
   const props = defineProps({
     data: {
       type: Object as PropType<{
-        [key: string]: { name: string; value: number; refId: string }[];
+        [key: string]: { name: string; value: number; refId: string; owner: object }[];
       }>,
       default: () => ({}),
     },
@@ -114,14 +114,15 @@ limitations under the License. -->
   function handleClick(i: string) {
     copy(i);
   }
-  function viewTrace(item: { name: string; refId: string; value: unknown }) {
+  function viewTrace(item: { name: string; refId: string; value: unknown; owner: object }) {
     const filters = {
       ...item,
       queryOrder: QueryOrders[1].value,
       status: Status[2].value,
-      id: item.refId,
+      id: refIdType.value === RefIdTypes[1].value ? item.refId : undefined,
       metricValue: [{ label: props.config.expressions[0], data: item.value, value: item.name }],
       isReadRecords: props.config.typesOfMQE.includes(ExpressionResultType.RECORD_LIST) || undefined,
+      owner: refIdType.value === RefIdTypes[2].value ? item.owner : null,
     };
     traceOptions.value = {
       ...traceOptions.value,
diff --git a/src/views/dashboard/related/trace/Header.vue b/src/views/dashboard/related/trace/Header.vue
index f845ebbb..18999296 100644
--- a/src/views/dashboard/related/trace/Header.vue
+++ b/src/views/dashboard/related/trace/Header.vue
@@ -133,12 +133,15 @@ limitations under the License. -->
     }
     conditions.value = (items.value[0] && items.value[0].label) || "";
     if (!filters.id) {
-      state.service = selectorStore.currentService.id;
-      if (dashboardStore.entity === EntityType[2].value) {
-        state.endpoint = selectorStore.currentPod.id;
+      if (!filters.owner) {
+        return;
+      }
+      state.service = filters.owner.serviceID;
+      if (filters.owner.scope === EntityType[2].value) {
+        state.endpoint = filters.owner.endpointID;
       }
-      if (dashboardStore.entity === EntityType[3].value) {
-        state.instance = selectorStore.currentPod.id;
+      if (filters.owner?.scope === EntityType[3].value) {
+        state.instance = filters.owner.serviceInstanceID;
       }
       await queryTraces();
       return;