Skip to content

Commit

Permalink
fix(select): make to consider the case sensitive in case of d3 format…
Browse files Browse the repository at this point in the history
… selector (#19159)
  • Loading branch information
prosdev0107 authored Mar 17, 2022
1 parent 3230415 commit d099f5e
Showing 1 changed file with 37 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ type Control = {
default?: unknown;
};

type SelectDefaultOption = {
label: string;
value: string;
};

const groupByControl: SharedControlConfig<'SelectControl', ColumnMeta> = {
type: 'SelectControl',
label: t('Group by'),
Expand Down Expand Up @@ -430,36 +435,45 @@ const size: SharedControlConfig<'MetricsControl'> = {
default: null,
};

const y_axis_format: SharedControlConfig<'SelectControl'> = {
type: 'SelectControl',
freeForm: true,
label: t('Y Axis Format'),
renderTrigger: true,
default: DEFAULT_NUMBER_FORMAT,
choices: D3_FORMAT_OPTIONS,
description: D3_FORMAT_DOCS,
mapStateToProps: state => {
const showWarning = state.controls?.comparison_type?.value === 'percentage';
return {
warning: showWarning
? t(
'When `Calculation type` is set to "Percentage change", the Y ' +
'Axis Format is forced to `.1%`',
)
: null,
disabled: showWarning,
};
},
};

const x_axis_time_format: SharedControlConfig<'SelectControl'> = {
const y_axis_format: SharedControlConfig<'SelectControl', SelectDefaultOption> =
{
type: 'SelectControl',
freeForm: true,
label: t('Y Axis Format'),
renderTrigger: true,
default: DEFAULT_NUMBER_FORMAT,
choices: D3_FORMAT_OPTIONS,
description: D3_FORMAT_DOCS,
filterOption: ({ data: option }, search) =>
option.label.includes(search) || option.value.includes(search),
mapStateToProps: state => {
const showWarning =
state.controls?.comparison_type?.value === 'percentage';
return {
warning: showWarning
? t(
'When `Calculation type` is set to "Percentage change", the Y ' +
'Axis Format is forced to `.1%`',
)
: null,
disabled: showWarning,
};
},
};

const x_axis_time_format: SharedControlConfig<
'SelectControl',
SelectDefaultOption
> = {
type: 'SelectControl',
freeForm: true,
label: t('Time format'),
renderTrigger: true,
default: DEFAULT_TIME_FORMAT,
choices: D3_TIME_FORMAT_OPTIONS,
description: D3_TIME_FORMAT_DOCS,
filterOption: ({ data: option }, search) =>
option.label.includes(search) || option.value.includes(search),
};

const adhoc_filters: SharedControlConfig<'AdhocFilterControl'> = {
Expand Down

0 comments on commit d099f5e

Please sign in to comment.