Skip to content
代码片段 群组 项目
提交 e1c8571f 编辑于 作者: Jiaan Louw's avatar Jiaan Louw
浏览文件

Hide the widget when a metric does not have related traces

上级 15010ea0
No related branches found
No related tags found
无相关合并请求
......@@ -144,6 +144,9 @@ export default {
createIssueUrl: this.createIssueUrl,
});
},
metricHasRelatedTraces() {
return this.metricData?.some(({ values }) => values.some((value) => value[2]?.length > 0));
},
},
created() {
this.validateAndFetch();
......@@ -317,6 +320,7 @@ export default {
/>
<related-traces
v-if="metricHasRelatedTraces"
class="gl-mb-5 gl-ml-11"
:data-points="selectedDatapoints"
:tracing-index-url="tracingIndexUrl"
......
......@@ -128,7 +128,7 @@ describe('MetricsDetails', () => {
env: 'production',
},
values: [
[1700118610000, 0.25595267476015443],
[1700118610000, 0.25595267476015443, ['trace-1', 'trace-2']],
[1700118660000, 0.1881374588830907],
[1700118720000, 0.28915416028993485],
],
......@@ -593,6 +593,23 @@ describe('MetricsDetails', () => {
});
});
describe('when the metric has no related traces', () => {
beforeEach(async () => {
observabilityClientMock.fetchMetric.mockResolvedValue([
{
...mockMetricData[0],
values: [[1700118660000, 0.1881374588830907]],
},
]);
await mountComponent();
});
it('does not render the related traces component', () => {
expect(findRelatedTraces().exists()).toBe(false);
});
});
describe('with no data', () => {
beforeEach(async () => {
observabilityClientMock.fetchMetric.mockResolvedValue([]);
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册