From 95ae09e80c35ec24f21379a246f9c3c8e2654a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Tue, 22 Aug 2023 12:11:15 +0200 Subject: [PATCH] Fix metric drill down not working for metrics with no labels --- .../src/components/PageBlocks/MetricBase.vue | 2 +- .../PageBlocks/MetricConfigurator/index.vue | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/client/web/compose/src/components/PageBlocks/MetricBase.vue b/client/web/compose/src/components/PageBlocks/MetricBase.vue index 15bd3cb58..64dd5bf1c 100644 --- a/client/web/compose/src/components/PageBlocks/MetricBase.vue +++ b/client/web/compose/src/components/PageBlocks/MetricBase.vue @@ -182,7 +182,7 @@ export default { * Based on drill down configuration, either changes the linked block on the page * or opens it in a modal wit the filter and dimensions from the chart and the clicked value */ - drillDown ({ label: name, filter, moduleID, drillDown }, metricIndex) { + drillDown ({ label: name = '', filter, moduleID, drillDown }, metricIndex) { if (!drillDown.enabled) { return } diff --git a/client/web/compose/src/components/PageBlocks/MetricConfigurator/index.vue b/client/web/compose/src/components/PageBlocks/MetricConfigurator/index.vue index 1d594e821..0d3d3c87e 100644 --- a/client/web/compose/src/components/PageBlocks/MetricConfigurator/index.vue +++ b/client/web/compose/src/components/PageBlocks/MetricConfigurator/index.vue @@ -186,6 +186,7 @@ :reduce="f => f.name" :calculate-position="calculateDropdownPosition" class="bg-white" + @input="onMetricFieldChange" /> @@ -415,11 +416,6 @@ export default { this.edit.dateFormat = this.edit.dateFormat || 'YYYY-MM-DD' } }, - 'edit.metricField': function (mf) { - if (mf === 'count') { - this.edit.operation = undefined - } - }, }, created () { @@ -472,6 +468,14 @@ export default { return operation }, + onMetricFieldChange (field) { + if (field === 'count') { + this.edit.operation = undefined + } else if (!this.edit.operation) { + this.edit.operation = this.aggregationOperations[0].operation + } + }, + setDefaultValues () { this.edit = undefined this.dimensionModifiers = []