Skip to content

Commit

Permalink
disable suggestions for version fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Dosant committed Jan 26, 2022
1 parent 7659bf6 commit 69e47bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,16 @@ export const setupValueSuggestionProvider = (
useTimeRange ?? core!.uiSettings.get<boolean>(UI_SETTINGS.AUTOCOMPLETE_USE_TIMERANGE);
const { title } = indexPattern;

const isVersionFieldType = field.type === 'string' && field.esTypes?.includes('version');

if (field.type === 'boolean') {
return [true, false];
} else if (!shouldSuggestValues || !field.aggregatable || field.type !== 'string') {
} else if (
!shouldSuggestValues ||
!field.aggregatable ||
field.type !== 'string' ||
isVersionFieldType // suggestions don't work for version fields
) {
return [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ export class PhraseSuggestorUI<T extends PhraseSuggestorProps> extends React.Com
UI_SETTINGS.FILTERS_EDITOR_SUGGEST_VALUES
);
const { field } = this.props;
return shouldSuggestValues && field && field.aggregatable && field.type === 'string';
const isVersionFieldType = field?.esTypes?.includes('version');

return (
shouldSuggestValues &&
field &&
field.aggregatable &&
field.type === 'string' &&
!isVersionFieldType // suggestions don't work for version fields
);
}

protected onSearchChange = (value: string | number | boolean) => {
Expand Down

0 comments on commit 69e47bb

Please sign in to comment.