Skip to content

Commit c6e73d4

Browse files
Merge branch 'main' into eui-v76.0.0
2 parents fb004ab + 0343c63 commit c6e73d4

30 files changed

Lines changed: 383 additions & 194 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@
12541254
"@types/redux-logger": "^3.0.8",
12551255
"@types/resolve": "^1.20.1",
12561256
"@types/seedrandom": ">=2.0.0 <4.0.0",
1257-
"@types/selenium-webdriver": "^4.1.12",
1257+
"@types/selenium-webdriver": "^4.1.13",
12581258
"@types/semver": "^7",
12591259
"@types/set-value": "^2.0.0",
12601260
"@types/sharp": "^0.30.4",

test/plugin_functional/test_suites/core_plugins/rendering.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
103103
'data.search.sessions.management.refreshTimeout (duration)',
104104
'data.search.sessions.maxUpdateRetries (number)',
105105
'data.search.sessions.notTouchedTimeout (duration)',
106+
'enterpriseSearch.canDeployEntSearch (boolean)',
106107
'enterpriseSearch.host (string)',
107108
'home.disableWelcomeScreen (boolean)',
108109
'map.emsFileApiUrl (string)',

x-pack/plugins/enterprise_search/common/__mocks__/initial_app_data.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ export const DEFAULT_INITIAL_APP_DATA = {
3232
hasSearchEnginesAccess: false,
3333
hasWorkplaceSearchAccess: true,
3434
},
35+
features: {
36+
hasConnectors: true,
37+
hasDefaultIngestPipeline: true,
38+
hasNativeConnectors: true,
39+
hasSearchApplications: false,
40+
hasWebCrawler: true,
41+
},
3542
appSearch: {
3643
accountId: 'some-id-string',
3744
onboardingComplete: true,

x-pack/plugins/enterprise_search/common/constants.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import { i18n } from '@kbn/i18n';
99

10+
import { ProductFeatures } from './types';
1011
import { IngestPipelineParams } from './types/connectors';
1112

1213
export const ENTERPRISE_SEARCH_OVERVIEW_PLUGIN = {
@@ -161,3 +162,11 @@ export enum INGESTION_METHOD_IDS {
161162
crawler = 'crawler',
162163
native_connector = 'native_connector',
163164
}
165+
166+
export const DEFAULT_PRODUCT_FEATURES: ProductFeatures = {
167+
hasConnectors: true,
168+
hasDefaultIngestPipeline: true,
169+
hasNativeConnectors: true,
170+
hasSearchApplications: false,
171+
hasWebCrawler: true,
172+
};

x-pack/plugins/enterprise_search/common/types/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface InitialAppData {
1919
appSearch?: AppSearchAccount;
2020
configuredLimits?: ConfiguredLimits;
2121
enterpriseSearchVersion?: string;
22+
features?: ProductFeatures;
2223
kibanaVersion?: string;
2324
readOnlyMode?: boolean;
2425
searchOAuth?: SearchOAuth;
@@ -36,6 +37,14 @@ export interface ProductAccess {
3637
hasWorkplaceSearchAccess: boolean;
3738
}
3839

40+
export interface ProductFeatures {
41+
hasConnectors: boolean;
42+
hasDefaultIngestPipeline: boolean;
43+
hasNativeConnectors: boolean;
44+
hasSearchApplications: boolean;
45+
hasWebCrawler: boolean;
46+
}
47+
3948
export interface SearchOAuth {
4049
clientId: string;
4150
redirectUrl: string;
@@ -52,5 +61,10 @@ export interface Meta {
5261
page: MetaPage;
5362
}
5463

64+
export interface ClientConfigType {
65+
canDeployEntSearch: boolean;
66+
host?: string;
67+
}
68+
5569
export type { ElasticsearchIndexWithPrivileges } from './indices';
5670
export type { KibanaDeps } from './kibana_deps';

x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ export const mockKibanaValues = {
3737
hasSearchEnginesAccess: false,
3838
hasWorkplaceSearchAccess: true,
3939
},
40+
productFeatures: {
41+
hasNativeConnectors: true,
42+
hasSearchApplications: false,
43+
hasWebCrawler: true,
44+
},
4045
uiSettings: uiSettingsServiceMock.createStartContract(),
4146
security: securityMock.createStart(),
4247
setBreadcrumbs: jest.fn(),

x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_index.tsx

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import React, { useState } from 'react';
99

1010
import { useLocation } from 'react-router-dom';
1111

12+
import { useValues } from 'kea';
13+
1214
import {
1315
EuiBadge,
1416
EuiFlexGroup,
@@ -22,7 +24,9 @@ import { i18n } from '@kbn/i18n';
2224

2325
import { INGESTION_METHOD_IDS } from '../../../../../common/constants';
2426

27+
import { ProductFeatures } from '../../../../../common/types';
2528
import { BETA_LABEL } from '../../../shared/constants/labels';
29+
import { KibanaLogic } from '../../../shared/kibana/kibana_logic';
2630
import { parseQueryParams } from '../../../shared/query_params';
2731
import { EuiLinkTo } from '../../../shared/react_router_helpers';
2832

@@ -41,8 +45,8 @@ const betaBadge = (
4145
</EuiBadge>
4246
);
4347

44-
const METHOD_BUTTON_GROUP_OPTIONS: ButtonGroupOption[] = [
45-
{
48+
const METHOD_BUTTON_GROUP_OPTIONS: Record<INGESTION_METHOD_IDS, ButtonGroupOption> = {
49+
[INGESTION_METHOD_IDS.crawler]: {
4650
description: i18n.translate(
4751
'xpack.enterpriseSearch.content.newIndex.buttonGroup.crawler.description',
4852
{
@@ -58,7 +62,7 @@ const METHOD_BUTTON_GROUP_OPTIONS: ButtonGroupOption[] = [
5862
defaultMessage: 'Use the web crawler',
5963
}),
6064
},
61-
{
65+
[INGESTION_METHOD_IDS.native_connector]: {
6266
badge: betaBadge,
6367
description: i18n.translate(
6468
'xpack.enterpriseSearch.content.newIndex.buttonGroup.nativeConnector.description',
@@ -82,7 +86,7 @@ const METHOD_BUTTON_GROUP_OPTIONS: ButtonGroupOption[] = [
8286
}
8387
),
8488
},
85-
{
89+
[INGESTION_METHOD_IDS.api]: {
8690
description: i18n.translate(
8791
'xpack.enterpriseSearch.content.newIndex.buttonGroup.api.description',
8892
{
@@ -98,7 +102,7 @@ const METHOD_BUTTON_GROUP_OPTIONS: ButtonGroupOption[] = [
98102
defaultMessage: 'Use the API',
99103
}),
100104
},
101-
{
105+
[INGESTION_METHOD_IDS.connector]: {
102106
badge: betaBadge,
103107
description: i18n.translate(
104108
'xpack.enterpriseSearch.content.newIndex.buttonGroup.connector.description',
@@ -116,15 +120,32 @@ const METHOD_BUTTON_GROUP_OPTIONS: ButtonGroupOption[] = [
116120
defaultMessage: 'Build a connector',
117121
}),
118122
},
119-
];
123+
};
124+
125+
const getAvailableMethodOptions = (productFeatures: ProductFeatures): ButtonGroupOption[] => {
126+
return [
127+
...(productFeatures.hasWebCrawler
128+
? [METHOD_BUTTON_GROUP_OPTIONS[INGESTION_METHOD_IDS.crawler]]
129+
: []),
130+
...(productFeatures.hasNativeConnectors
131+
? [METHOD_BUTTON_GROUP_OPTIONS[INGESTION_METHOD_IDS.native_connector]]
132+
: []),
133+
METHOD_BUTTON_GROUP_OPTIONS[INGESTION_METHOD_IDS.api],
134+
...(productFeatures.hasConnectors
135+
? [METHOD_BUTTON_GROUP_OPTIONS[INGESTION_METHOD_IDS.connector]]
136+
: []),
137+
];
138+
};
120139

121140
export const NewIndex: React.FC = () => {
122141
const { search } = useLocation();
142+
const { capabilities, productFeatures } = useValues(KibanaLogic);
123143
const { method: methodParam } = parseQueryParams(search);
144+
const availableIngestionMethodOptions = getAvailableMethodOptions(productFeatures);
124145

125146
const initialSelectedMethod =
126-
METHOD_BUTTON_GROUP_OPTIONS.find((option) => option.id === methodParam) ??
127-
METHOD_BUTTON_GROUP_OPTIONS[0];
147+
availableIngestionMethodOptions.find((option) => option.id === methodParam) ??
148+
availableIngestionMethodOptions[0];
128149

129150
const [selectedMethod, setSelectedMethod] = useState<ButtonGroupOption>(initialSelectedMethod);
130151

@@ -168,16 +189,20 @@ export const NewIndex: React.FC = () => {
168189
</EuiText>
169190
<EuiSpacer size="m" />
170191
<ButtonGroup
171-
options={METHOD_BUTTON_GROUP_OPTIONS}
192+
options={availableIngestionMethodOptions}
172193
selected={selectedMethod}
173194
onChange={setSelectedMethod}
174195
/>
175-
<EuiSpacer size="xxl" />
176-
<EuiLinkTo to="/app/integrations" shouldNotCreateHref>
177-
{i18n.translate('xpack.enterpriseSearch.content.newIndex.viewIntegrationsLink', {
178-
defaultMessage: 'View additional integrations',
179-
})}
180-
</EuiLinkTo>
196+
{capabilities.navLinks.integrations && (
197+
<>
198+
<EuiSpacer size="xxl" />
199+
<EuiLinkTo to="/app/integrations" shouldNotCreateHref>
200+
{i18n.translate('xpack.enterpriseSearch.content.newIndex.viewIntegrationsLink', {
201+
defaultMessage: 'View additional integrations',
202+
})}
203+
</EuiLinkTo>
204+
</>
205+
)}
181206
</EuiPanel>
182207
</EuiFlexItem>
183208
<EuiFlexItem>

x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_search_index_logic.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import { flashIndexCreatedToast } from './new_index_created_toast';
1616
import { NewSearchIndexLogic, NewSearchIndexValues } from './new_search_index_logic';
1717

1818
jest.mock('./new_index_created_toast', () => ({ flashIndexCreatedToast: jest.fn() }));
19+
jest.mock('../../../shared/kibana/kibana_logic', () => ({
20+
KibanaLogic: { values: { productAccess: { hasAppSearchAccess: true } } },
21+
}));
1922

2023
const DEFAULT_VALUES: NewSearchIndexValues = {
2124
data: undefined as any,
@@ -35,14 +38,12 @@ describe('NewSearchIndexLogic', () => {
3538
});
3639

3740
it('has expected default values', () => {
38-
mount();
3941
expect(NewSearchIndexLogic.values).toEqual(DEFAULT_VALUES);
4042
});
4143

4244
describe('actions', () => {
4345
describe('setLanguageSelectValue', () => {
4446
it('sets language to the provided value', () => {
45-
mount();
4647
NewSearchIndexLogic.actions.setLanguageSelectValue('en');
4748
expect(NewSearchIndexLogic.values).toEqual({
4849
...DEFAULT_VALUES,

x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_search_index_logic.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { kea, MakeLogicType } from 'kea';
99

1010
import { Actions } from '../../../shared/api_logic/create_api_logic';
11+
import { KibanaLogic } from '../../../shared/kibana/kibana_logic';
1112
import {
1213
AddConnectorApiLogic,
1314
AddConnectorApiLogicArgs,
@@ -84,12 +85,15 @@ export const NewSearchIndexLogic = kea<MakeLogicType<NewSearchIndexValues, NewSe
8485
},
8586
listeners: ({ actions, values }) => ({
8687
apiIndexCreated: () => {
88+
if (!KibanaLogic.values.productAccess.hasAppSearchAccess) return;
8789
flashIndexCreatedToast();
8890
},
8991
connectorIndexCreated: () => {
92+
if (!KibanaLogic.values.productAccess.hasAppSearchAccess) return;
9093
flashIndexCreatedToast();
9194
},
9295
crawlerIndexCreated: () => {
96+
if (!KibanaLogic.values.productAccess.hasAppSearchAccess) return;
9397
flashIndexCreatedToast();
9498
},
9599
setRawName: async (_, breakpoint) => {

x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/header_actions/header_actions.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,27 @@ import { SyncsContextMenu } from './syncs_context_menu';
1717

1818
describe('Header Actions', () => {
1919
it('renders api index', () => {
20-
expect(getHeaderActions(apiIndex)).toEqual([
20+
expect(getHeaderActions(apiIndex, true)).toEqual([
2121
<SearchEnginesPopover indexName="api" ingestionMethod="api" isHiddenIndex={false} />,
2222
]);
23+
expect(getHeaderActions(apiIndex, false)).toEqual([]);
2324
});
2425
it('renders connector index', () => {
25-
expect(getHeaderActions(connectorIndex)).toEqual([
26+
expect(getHeaderActions(connectorIndex, true)).toEqual([
2627
<SyncsContextMenu />,
2728
<SearchEnginesPopover
2829
indexName="connector"
2930
ingestionMethod="connector"
3031
isHiddenIndex={false}
3132
/>,
3233
]);
34+
expect(getHeaderActions(connectorIndex, false)).toEqual([<SyncsContextMenu />]);
3335
});
3436
it('renders crawler index', () => {
35-
expect(getHeaderActions(crawlerIndex)).toEqual([
37+
expect(getHeaderActions(crawlerIndex, true)).toEqual([
3638
<CrawlerStatusIndicator />,
3739
<SearchEnginesPopover indexName="crawler" ingestionMethod="crawler" isHiddenIndex={false} />,
3840
]);
41+
expect(getHeaderActions(crawlerIndex, false)).toEqual([<CrawlerStatusIndicator />]);
3942
});
4043
});

0 commit comments

Comments
 (0)