mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Hide Value and Funtional boost for geolocation (#93683)
This commit is contained in:
parent
0d4ca46cf0
commit
8381fdd60e
2 changed files with 17 additions and 1 deletions
|
@ -64,6 +64,20 @@ describe('Boosts', () => {
|
|||
expect(select.prop('options').map((o: any) => o.value)).toEqual(['add-boost', 'value']);
|
||||
});
|
||||
|
||||
it('will not render functional or value options if "type" prop is "geolocation"', () => {
|
||||
const wrapper = shallow(
|
||||
<Boosts
|
||||
{...{
|
||||
...props,
|
||||
type: 'geolocation' as SchemaTypes,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
const select = wrapper.find(EuiSuperSelect);
|
||||
expect(select.prop('options').map((o: any) => o.value)).toEqual(['add-boost', 'proximity']);
|
||||
});
|
||||
|
||||
it('will add a boost of the selected type when a selection is made', () => {
|
||||
const wrapper = shallow(<Boosts {...props} />);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiTitle, EuiSuperSelect } from '@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { TEXT } from '../../../../shared/constants/field_types';
|
||||
import { GEOLOCATION, TEXT } from '../../../../shared/constants/field_types';
|
||||
import { SchemaTypes } from '../../../../shared/types';
|
||||
|
||||
import { BoostIcon } from '../boost_icon';
|
||||
|
@ -68,6 +68,8 @@ const BASE_OPTIONS = [
|
|||
const filterInvalidOptions = (value: BoostType, type: SchemaTypes) => {
|
||||
// Proximity and Functional boost types are not valid for text fields
|
||||
if (type === TEXT && [BoostType.Proximity, BoostType.Functional].includes(value)) return false;
|
||||
// Value and Functional boost types are not valid for geolocation fields
|
||||
if (type === GEOLOCATION && [BoostType.Functional, BoostType.Value].includes(value)) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue