fix(select): make to consider the case sensitive in case of d3 format selector (#19159)

This commit is contained in:
smileydev 2022-03-17 13:04:03 -04:00 committed by GitHub
parent 3230415e22
commit d099f5ed4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 22 deletions

View File

@ -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'),
@ -430,7 +435,8 @@ const size: SharedControlConfig<'MetricsControl'> = {
default: null,
};
const y_axis_format: SharedControlConfig<'SelectControl'> = {
const y_axis_format: SharedControlConfig<'SelectControl', SelectDefaultOption> =
{
type: 'SelectControl',
freeForm: true,
label: t('Y Axis Format'),
@ -438,8 +444,11 @@ const y_axis_format: SharedControlConfig<'SelectControl'> = {
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';
const showWarning =
state.controls?.comparison_type?.value === 'percentage';
return {
warning: showWarning
? t(
@ -452,7 +461,10 @@ const y_axis_format: SharedControlConfig<'SelectControl'> = {
},
};
const x_axis_time_format: SharedControlConfig<'SelectControl'> = {
const x_axis_time_format: SharedControlConfig<
'SelectControl',
SelectDefaultOption
> = {
type: 'SelectControl',
freeForm: true,
label: t('Time format'),
@ -460,6 +472,8 @@ const x_axis_time_format: SharedControlConfig<'SelectControl'> = {
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'> = {