Skip to content

Commit

Permalink
fix(chart & alert): make to show metrics properly (#19939)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
prosdev0107 authored May 16, 2022
1 parent 4126c36 commit 55aef4d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions superset-frontend/src/components/AlteredSliceTag/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 55aef4d

Please sign in to comment.