Skip to content

Commit 5201829

Browse files
committed
Merge remote-tracking branch 'upstream/master' into kbn-77020-migrate-optimizer-mixin
2 parents 86b8f47 + ad0517a commit 5201829

File tree

159 files changed

+1567
-1203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+1567
-1203
lines changed

x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_table.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const EnginesTable: React.FC<EnginesTableProps> = ({
5454
const { navigateToUrl } = useValues(KibanaLogic);
5555
const { hasPlatinumLicense } = useValues(LicensingLogic);
5656

57-
const generteEncodedEnginePath = (engineName: string) =>
57+
const generateEncodedEnginePath = (engineName: string) =>
5858
generateEncodedPath(ENGINE_PATH, { engineName });
5959
const sendEngineTableLinkClickTelemetry = () =>
6060
sendAppSearchTelemetry({
@@ -71,7 +71,7 @@ export const EnginesTable: React.FC<EnginesTableProps> = ({
7171
render: (name: string) => (
7272
<EuiLinkTo
7373
data-test-subj="EngineNameLink"
74-
to={generteEncodedEnginePath(name)}
74+
to={generateEncodedEnginePath(name)}
7575
onClick={sendEngineTableLinkClickTelemetry}
7676
>
7777
{name}
@@ -159,7 +159,7 @@ export const EnginesTable: React.FC<EnginesTableProps> = ({
159159
icon: 'eye',
160160
onClick: (engineDetails) => {
161161
sendEngineTableLinkClickTelemetry();
162-
navigateToUrl(generteEncodedEnginePath(engineDetails.name));
162+
navigateToUrl(generateEncodedEnginePath(engineDetails.name));
163163
},
164164
},
165165
{

x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/boost_item_content.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { EuiButton, EuiFormRow, EuiPanel, EuiRange, EuiSpacer } from '@elastic/e
1313
import { i18n } from '@kbn/i18n';
1414

1515
import { RelevanceTuningLogic } from '../..';
16-
import { Boost, BoostType } from '../../types';
16+
import { Boost, BoostType, FunctionalBoost, ProximityBoost, ValueBoost } from '../../types';
1717

1818
import { FunctionalBoostForm } from './functional_boost_form';
1919
import { ProximityBoostForm } from './proximity_boost_form';
@@ -32,11 +32,11 @@ export const BoostItemContent: React.FC<Props> = ({ boost, index, name }) => {
3232
const getBoostForm = () => {
3333
switch (type) {
3434
case BoostType.Value:
35-
return <ValueBoostForm boost={boost} index={index} name={name} />;
35+
return <ValueBoostForm boost={boost as ValueBoost} index={index} name={name} />;
3636
case BoostType.Functional:
37-
return <FunctionalBoostForm boost={boost} index={index} name={name} />;
37+
return <FunctionalBoostForm boost={boost as FunctionalBoost} index={index} name={name} />;
3838
case BoostType.Proximity:
39-
return <ProximityBoostForm boost={boost} index={index} name={name} />;
39+
return <ProximityBoostForm boost={boost as ProximityBoost} index={index} name={name} />;
4040
}
4141
};
4242

x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/functional_boost_form.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ import { shallow, ShallowWrapper } from 'enzyme';
1313

1414
import { EuiSelect } from '@elastic/eui';
1515

16-
import { Boost, BoostOperation, BoostType, FunctionalBoostFunction } from '../../types';
16+
import { FunctionalBoost, BoostOperation, BoostType, FunctionalBoostFunction } from '../../types';
1717

1818
import { FunctionalBoostForm } from './functional_boost_form';
1919

2020
describe('FunctionalBoostForm', () => {
21-
const boost: Boost = {
21+
const boost: FunctionalBoost = {
22+
value: undefined,
2223
factor: 2,
2324
type: 'functional' as BoostType,
2425
function: 'logarithmic' as FunctionalBoostFunction,

x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/functional_boost_form.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ import {
1919
FUNCTIONAL_BOOST_FUNCTION_DISPLAY_MAP,
2020
} from '../../constants';
2121
import {
22-
Boost,
22+
FunctionalBoost,
2323
BoostFunction,
2424
BoostOperation,
2525
BoostType,
2626
FunctionalBoostFunction,
2727
} from '../../types';
2828

2929
interface Props {
30-
boost: Boost;
30+
boost: FunctionalBoost;
3131
index: number;
3232
name: string;
3333
}
@@ -39,7 +39,7 @@ const functionOptions = Object.values(FunctionalBoostFunction).map((boostFunctio
3939

4040
const operationOptions = Object.values(BoostOperation).map((boostOperation) => ({
4141
value: boostOperation,
42-
text: BOOST_OPERATION_DISPLAY_MAP[boostOperation as BoostOperation],
42+
text: BOOST_OPERATION_DISPLAY_MAP[boostOperation],
4343
}));
4444

4545
export const FunctionalBoostForm: React.FC<Props> = ({ boost, index, name }) => {

x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/proximity_boost_form.test.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ import { shallow, ShallowWrapper } from 'enzyme';
1313

1414
import { EuiFieldText, EuiSelect } from '@elastic/eui';
1515

16-
import { Boost, BoostType, ProximityBoostFunction } from '../../types';
16+
import { ProximityBoost, BoostType, ProximityBoostFunction } from '../../types';
1717

1818
import { ProximityBoostForm } from './proximity_boost_form';
1919

2020
describe('ProximityBoostForm', () => {
21-
const boost: Boost = {
21+
const boost: ProximityBoost = {
22+
value: undefined,
23+
operation: undefined,
2224
factor: 2,
2325
type: 'proximity' as BoostType,
2426
function: 'linear' as ProximityBoostFunction,
@@ -46,8 +48,8 @@ describe('ProximityBoostForm', () => {
4648

4749
describe('various boost values', () => {
4850
const renderWithBoostValues = (boostValues: {
49-
center?: Boost['center'];
50-
function?: Boost['function'];
51+
center?: ProximityBoost['center'];
52+
function?: ProximityBoost['function'];
5153
}) => {
5254
return shallow(
5355
<ProximityBoostForm

x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/proximity_boost_form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import { i18n } from '@kbn/i18n';
1414

1515
import { RelevanceTuningLogic } from '../..';
1616
import { PROXIMITY_BOOST_FUNCTION_DISPLAY_MAP } from '../../constants';
17-
import { Boost, BoostType, ProximityBoostFunction } from '../../types';
17+
import { BoostType, ProximityBoost, ProximityBoostFunction } from '../../types';
1818

1919
interface Props {
20-
boost: Boost;
20+
boost: ProximityBoost;
2121
index: number;
2222
name: string;
2323
}

x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/value_boost_form.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ import { shallow, ShallowWrapper } from 'enzyme';
1313

1414
import { EuiButton, EuiButtonIcon, EuiFieldText } from '@elastic/eui';
1515

16-
import { Boost, BoostType } from '../../types';
16+
import { ValueBoost, BoostType } from '../../types';
1717

1818
import { ValueBoostForm } from './value_boost_form';
1919

2020
describe('ValueBoostForm', () => {
21-
const boost: Boost = {
21+
const boost: ValueBoost = {
22+
operation: undefined,
23+
function: undefined,
2224
factor: 2,
2325
type: 'value' as BoostType,
2426
value: ['bar', '', 'baz'],

x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boost_item_content/value_boost_form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import {
2020
import { i18n } from '@kbn/i18n';
2121

2222
import { RelevanceTuningLogic } from '../..';
23-
import { Boost } from '../../types';
23+
import { ValueBoost } from '../../types';
2424

2525
interface Props {
26-
boost: Boost;
26+
boost: ValueBoost;
2727
index: number;
2828
name: string;
2929
}

x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boosts.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,24 @@ describe('Boosts', () => {
7878
expect(select.prop('options').map((o: any) => o.value)).toEqual(['add-boost', 'proximity']);
7979
});
8080

81+
it('will not render functional option if "type" prop is "date"', () => {
82+
const wrapper = shallow(
83+
<Boosts
84+
{...{
85+
...props,
86+
type: 'date' as SchemaTypes,
87+
}}
88+
/>
89+
);
90+
91+
const select = wrapper.find(EuiSuperSelect);
92+
expect(select.prop('options').map((o: any) => o.value)).toEqual([
93+
'add-boost',
94+
'proximity',
95+
'value',
96+
]);
97+
});
98+
8199
it('will add a boost of the selected type when a selection is made', () => {
82100
const wrapper = shallow(<Boosts {...props} />);
83101

x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/boosts/boosts.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiTitle, EuiSuperSelect } from '@
1313

1414
import { i18n } from '@kbn/i18n';
1515

16-
import { GEOLOCATION, TEXT } from '../../../../shared/constants/field_types';
16+
import { GEOLOCATION, TEXT, DATE } from '../../../../shared/constants/field_types';
1717
import { SchemaTypes } from '../../../../shared/types';
1818

1919
import { BoostIcon } from '../boost_icon';
@@ -70,6 +70,8 @@ const filterInvalidOptions = (value: BoostType, type: SchemaTypes) => {
7070
if (type === TEXT && [BoostType.Proximity, BoostType.Functional].includes(value)) return false;
7171
// Value and Functional boost types are not valid for geolocation fields
7272
if (type === GEOLOCATION && [BoostType.Functional, BoostType.Value].includes(value)) return false;
73+
// Functional boosts are not valid for date fields
74+
if (type === DATE && value === BoostType.Functional) return false;
7375
return true;
7476
};
7577

0 commit comments

Comments
 (0)