Skip to content

Commit

Permalink
fix: number format should editable when AA in time comparison (#19351)
Browse files Browse the repository at this point in the history
(cherry picked from commit e15573d)
  • Loading branch information
zhaoyongjie authored and villebro committed Apr 3, 2022
1 parent d659549 commit da4a79f
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
legacyValidateInteger,
validateNonEmpty,
JsonArray,
ComparisionType,
} from '@superset-ui/core';

import {
Expand Down Expand Up @@ -456,16 +457,12 @@ const y_axis_format: SharedControlConfig<'SelectControl', SelectDefaultOption> =
filterOption: ({ data: option }, search) =>
option.label.includes(search) || option.value.includes(search),
mapStateToProps: state => {
const showWarning =
state.controls?.comparison_type?.value === 'percentage';
const isPercentage =
state.controls?.comparison_type?.value === ComparisionType.Percentage;
return {
warning: showWarning
? t(
'When `Calculation type` is set to "Percentage change", the Y ' +
'Axis Format is forced to `.1%`',
)
: null,
disabled: showWarning,
choices: isPercentage
? D3_FORMAT_OPTIONS.filter(option => option[0].includes('%'))
: D3_FORMAT_OPTIONS,
};
},
};
Expand Down

0 comments on commit da4a79f

Please sign in to comment.