Skip to content

Commit

Permalink
fix(chart & alert): make to restore metrics control alert slice
Browse files Browse the repository at this point in the history
  • Loading branch information
prosdev0107 committed May 4, 2022
1 parent 02fb6ef commit 30d7f09
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion superset-frontend/src/components/AlteredSliceTag/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,15 @@ export default class AlteredSliceTag extends React.Component {
if (controlsMap[key]?.type === 'CollectionControl') {
return value.map(v => safeStringify(v)).join(', ');
}
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) {
const formattedValue = value.map(v => (v.label ? v.label : v));
const formattedValue = value.map(v => (v?.label ?? v));
return formattedValue.length ? formattedValue.join(', ') : '[]';
}
if (typeof value === 'string' || typeof value === 'number') {
Expand Down

0 comments on commit 30d7f09

Please sign in to comment.