Skip to content

Commit 6c4991b

Browse files
authored
fix: view related trace (#285)
1 parent 77c1694 commit 6c4991b

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

src/hooks/data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ export const RespFields: Indexable = {
122122
}
123123
}
124124
values {
125-
id
125+
name: id
126126
value
127-
traceID
127+
refId: traceID
128128
}
129129
}
130130
error

src/views/dashboard/Widget.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ limitations under the License. -->
3737
metricConfig: config.metricConfig,
3838
metricMode: config.metricMode,
3939
expressions: config.expressions || [],
40-
typesOfMQE: config.typesOfMQE || [],
40+
typesOfMQE: typesOfMQE || [],
4141
subExpressions: config.subExpressions || [],
4242
subTypesOfMQE: config.subTypesOfMQE || [],
4343
}"
@@ -80,6 +80,7 @@ limitations under the License. -->
8080
const dashboardStore = useDashboardStore();
8181
const title = computed(() => (config.value.widget && config.value.widget.title) || "");
8282
const tips = computed(() => (config.value.widget && config.value.widget.tips) || "");
83+
const typesOfMQE = ref<string[]>([]);
8384
8485
init();
8586
async function init() {
@@ -137,8 +138,10 @@ limitations under the License. -->
137138
metricConfig: config.value.metricConfig || [],
138139
subExpressions: config.value.subExpressions || [],
139140
});
141+
140142
loading.value = false;
141143
source.value = params.source || {};
144+
typesOfMQE.value = params.typesOfMQE;
142145
return;
143146
}
144147
const params = await useQueryProcessor({ ...config.value });
@@ -173,6 +176,7 @@ limitations under the License. -->
173176
config,
174177
title,
175178
tips,
179+
typesOfMQE,
176180
};
177181
},
178182
});

src/views/dashboard/controls/Widget.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ limitations under the License. -->
6161
associate: data.associate || [],
6262
metricMode: data.metricMode,
6363
expressions: data.expressions || [],
64-
typesOfMQE: data.typesOfMQE || [],
64+
typesOfMQE: typesOfMQE || [],
6565
subExpressions: data.subExpressions || [],
6666
subTypesOfMQE: data.subTypesOfMQE || [],
6767
}"
@@ -114,6 +114,7 @@ limitations under the License. -->
114114
const graph = computed(() => props.data.graph || {});
115115
const widget = computed(() => props.data.widget || {});
116116
const isList = computed(() => ListChartTypes.includes((props.data.graph && props.data.graph.type) || ""));
117+
const typesOfMQE = ref<string[]>([]);
117118
118119
if ((props.needQuery || !dashboardStore.currentDashboard.id) && !isList.value) {
119120
queryMetrics();
@@ -131,6 +132,7 @@ limitations under the License. -->
131132
const params = (await useExpressionsQueryProcessor(e)) || {};
132133
loading.value = false;
133134
state.source = params.source || {};
135+
typesOfMQE.value = params.typesOfMQE;
134136
return;
135137
}
136138
const params = await useQueryProcessor({ ...props.data });
@@ -259,6 +261,7 @@ limitations under the License. -->
259261
t,
260262
graph,
261263
widget,
264+
typesOfMQE,
262265
clickHandle,
263266
};
264267
},

src/views/dashboard/graphs/TopList.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License. -->
2020
<div class="desc">
2121
<span class="calls mr-10">{{ i.value }}</span>
2222
<span class="cp mr-20">
23-
{{ i.name || i.id }}
23+
{{ i.name }}
2424
</span>
2525
</div>
2626
<el-popover placement="bottom" trigger="click">
@@ -64,21 +64,23 @@ limitations under the License. -->
6464
import copy from "@/utils/copy";
6565
import { TextColors } from "@/views/dashboard/data";
6666
import Trace from "@/views/dashboard/related/trace/Index.vue";
67-
import { QueryOrders, Status, RefIdTypes, ProtocolTypes } from "../data";
67+
import { QueryOrders, Status, RefIdTypes, ProtocolTypes, ExpressionResultType } from "../data";
6868
6969
/*global defineProps */
7070
const props = defineProps({
7171
data: {
7272
type: Object as PropType<{
73-
[key: string]: { name: string; value: number; id: string }[];
73+
[key: string]: { name: string; value: number; refId: string }[];
7474
}>,
7575
default: () => ({}),
7676
},
7777
config: {
7878
type: Object as PropType<{
79+
metricMode: string;
7980
color: string;
8081
metrics: string[];
8182
metricTypes: string[];
83+
typesOfMQE: string[];
8284
relatedTrace: any;
8385
}>,
8486
default: () => ({ color: "purple" }),
@@ -107,14 +109,17 @@ limitations under the License. -->
107109
function handleClick(i: string) {
108110
copy(i);
109111
}
110-
function viewTrace(item: { name: string; id: string; value: unknown }) {
112+
function viewTrace(item: { name: string; refId: string; value: unknown }) {
111113
const filters = {
112114
...item,
113115
queryOrder: QueryOrders[1].value,
114116
status: Status[2].value,
115-
id: item.id || item.name,
117+
id: item.refId,
116118
metricValue: [{ label: props.config.metrics[0], data: item.value, value: item.name }],
117-
isReadRecords: props.config.metricTypes.includes(ProtocolTypes.ReadRecords) || undefined,
119+
isReadRecords:
120+
props.config.typesOfMQE.includes(ExpressionResultType.RECORD_LIST) ||
121+
props.config.metricTypes.includes(ProtocolTypes.ReadRecords) ||
122+
undefined,
118123
};
119124
traceOptions.value = {
120125
...traceOptions.value,
@@ -163,7 +168,7 @@ limitations under the License. -->
163168
}
164169
165170
.chart-slow-link {
166-
padding: 4px 10px 7px 10px;
171+
padding: 4px 10px 7px;
167172
border-radius: 4px;
168173
border: 1px solid #ddd;
169174
color: #333;

src/views/dashboard/panel/Tool.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,6 @@ limitations under the License. -->
363363
async function changePods(pod: Option[]) {
364364
selectorStore.setCurrentPod(pod[0] || null);
365365
if ([EntityType[7].value, EntityType[8].value].includes(dashboardStore.entity)) {
366-
selectorStore.setCurrentProcess(null);
367-
states.currentProcess = "";
368366
fetchProcess(true);
369367
}
370368
}
@@ -594,6 +592,9 @@ limitations under the License. -->
594592
if (currentProcess) {
595593
selectorStore.setCurrentProcess(currentProcess);
596594
states.currentProcess = currentProcess.label;
595+
} else {
596+
selectorStore.setCurrentProcess(null);
597+
states.currentProcess = "";
597598
}
598599
}
599600
return resp;

0 commit comments

Comments
 (0)