You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2022/05/16 20:22:55 UTC
[superset] branch master updated: fix(chart & alert): make to show metrics properly (#19939)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 55aef4db3c fix(chart & alert): make to show metrics properly (#19939)
55aef4db3c is described below
commit 55aef4db3c85d54064498a0828a55afe97fa2b85
Author: smileydev <47...@users.noreply.github.com>
AuthorDate: Mon May 16 15:22:47 2022 -0500
fix(chart & alert): make to show metrics properly (#19939)
* fix(chart & alert): make to show metrics properly
* fix(chart & alert): make to remove duplicate metrics
* fix(chart & alert): make to restore metrics control alert slice
* fix(chart & alert): make to fix lint issue
---
superset-frontend/src/components/AlteredSliceTag/index.jsx | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/src/components/AlteredSliceTag/index.jsx b/superset-frontend/src/components/AlteredSliceTag/index.jsx
index 26e72915e6..ecae44ad0c 100644
--- a/superset-frontend/src/components/AlteredSliceTag/index.jsx
+++ b/superset-frontend/src/components/AlteredSliceTag/index.jsx
@@ -109,15 +109,19 @@ export default class AlteredSliceTag extends React.Component {
if (controlsMap[key]?.type === 'CollectionControl') {
return value.map(v => safeStringify(v)).join(', ');
}
- if (controlsMap[key]?.type === 'MetricsControl' && Array.isArray(value)) {
- const formattedValue = value.map(v => (v.label ? v.label : v));
+ if (
+ controlsMap[key]?.type === 'MetricsControl' &&
+ value.constructor === Array
+ ) {
+ const formattedValue = value.map(v => v?.label ?? v);
return formattedValue.length ? formattedValue.join(', ') : '[]';
}
if (typeof value === 'boolean') {
return value ? 'true' : 'false';
}
if (value.constructor === Array) {
- return value.length ? value.join(', ') : '[]';
+ const formattedValue = value.map(v => v?.label ?? v);
+ return formattedValue.length ? formattedValue.join(', ') : '[]';
}
if (typeof value === 'string' || typeof value === 'number') {
return value;