Skip to content

Commit bc4fb7b

Browse files
Merge branch 'master' into search/server-side-search-strategy
2 parents eff55c5 + 04aaba8 commit bc4fb7b

File tree

21 files changed

+1387
-75
lines changed

21 files changed

+1387
-75
lines changed

.ci/end2end.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pipeline {
1414
HOME = "${env.WORKSPACE}"
1515
E2E_DIR = 'x-pack/plugins/apm/e2e'
1616
PIPELINE_LOG_LEVEL = 'DEBUG'
17+
KBN_OPTIMIZER_THEMES = 'v7light'
1718
}
1819
options {
1920
timeout(time: 1, unit: 'HOURS')

packages/kbn-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap

Lines changed: 0 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ afterAll(async () => {
6363
await del(TMP_DIR);
6464
});
6565

66-
it('builds expected bundles, saves bundle counts to metadata', async () => {
66+
// FLAKY: https://github.com/elastic/kibana/issues/70762
67+
it.skip('builds expected bundles, saves bundle counts to metadata', async () => {
6768
const config = OptimizerConfig.create({
6869
repoRoot: MOCK_REPO_DIR,
6970
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
@@ -167,7 +168,8 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
167168
`);
168169
});
169170

170-
it('uses cache on second run and exist cleanly', async () => {
171+
// FLAKY: https://github.com/elastic/kibana/issues/70764
172+
it.skip('uses cache on second run and exist cleanly', async () => {
171173
const config = OptimizerConfig.create({
172174
repoRoot: MOCK_REPO_DIR,
173175
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],

x-pack/plugins/global_search/server/mocks.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
RouteHandlerGlobalSearchContext,
1212
} from './types';
1313
import { searchServiceMock } from './services/search_service.mock';
14+
import { contextMock } from './services/context.mock';
1415

1516
const createSetupMock = (): jest.Mocked<GlobalSearchPluginSetup> => {
1617
const searchMock = searchServiceMock.createSetupContract();
@@ -29,17 +30,18 @@ const createStartMock = (): jest.Mocked<GlobalSearchPluginStart> => {
2930
};
3031

3132
const createRouteHandlerContextMock = (): jest.Mocked<RouteHandlerGlobalSearchContext> => {
32-
const contextMock = {
33+
const handlerContextMock = {
3334
find: jest.fn(),
3435
};
3536

36-
contextMock.find.mockReturnValue(of([]));
37+
handlerContextMock.find.mockReturnValue(of([]));
3738

38-
return contextMock;
39+
return handlerContextMock;
3940
};
4041

4142
export const globalSearchPluginMock = {
4243
createSetupContract: createSetupMock,
4344
createStartContract: createStartMock,
4445
createRouteHandlerContext: createRouteHandlerContextMock,
46+
createProviderContext: contextMock.create,
4547
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import {
8+
savedObjectsTypeRegistryMock,
9+
savedObjectsClientMock,
10+
elasticsearchServiceMock,
11+
uiSettingsServiceMock,
12+
} from '../../../../../src/core/server/mocks';
13+
14+
const createContextMock = () => {
15+
return {
16+
core: {
17+
savedObjects: {
18+
client: savedObjectsClientMock.create(),
19+
typeRegistry: savedObjectsTypeRegistryMock.create(),
20+
},
21+
elasticsearch: {
22+
legacy: {
23+
client: elasticsearchServiceMock.createScopedClusterClient(),
24+
},
25+
},
26+
uiSettings: {
27+
client: uiSettingsServiceMock.createClient(),
28+
},
29+
},
30+
};
31+
};
32+
33+
const createFactoryMock = () => () => () => createContextMock();
34+
35+
export const contextMock = {
36+
create: createContextMock,
37+
createFactory: createFactoryMock,
38+
};

x-pack/plugins/global_search_providers/kibana.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "globalSearchProviders",
33
"version": "8.0.0",
44
"kibanaVersion": "kibana",
5-
"server": false,
5+
"server": true,
66
"ui": true,
77
"requiredPlugins": ["globalSearch"],
88
"optionalPlugins": [],
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { PluginInitializer } from 'src/core/server';
8+
import { GlobalSearchProvidersPlugin, GlobalSearchProvidersPluginSetupDeps } from './plugin';
9+
10+
export const plugin: PluginInitializer<{}, {}, GlobalSearchProvidersPluginSetupDeps, {}> = () =>
11+
new GlobalSearchProvidersPlugin();
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { coreMock } from '../../../../src/core/server/mocks';
8+
import { globalSearchPluginMock } from '../../global_search/server/mocks';
9+
import { GlobalSearchProvidersPlugin } from './plugin';
10+
11+
describe('GlobalSearchProvidersPlugin', () => {
12+
let plugin: GlobalSearchProvidersPlugin;
13+
let globalSearchSetup: ReturnType<typeof globalSearchPluginMock.createSetupContract>;
14+
15+
beforeEach(() => {
16+
plugin = new GlobalSearchProvidersPlugin();
17+
globalSearchSetup = globalSearchPluginMock.createSetupContract();
18+
});
19+
20+
describe('#setup', () => {
21+
it('registers the `savedObjects` result provider', () => {
22+
const coreSetup = coreMock.createSetup();
23+
plugin.setup(coreSetup, { globalSearch: globalSearchSetup });
24+
25+
expect(globalSearchSetup.registerResultProvider).toHaveBeenCalledTimes(1);
26+
expect(globalSearchSetup.registerResultProvider).toHaveBeenCalledWith(
27+
expect.objectContaining({
28+
id: 'savedObjects',
29+
})
30+
);
31+
});
32+
});
33+
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { CoreSetup, Plugin } from 'src/core/server';
8+
import { GlobalSearchPluginSetup } from '../../global_search/server';
9+
import { createSavedObjectsResultProvider } from './providers';
10+
11+
export interface GlobalSearchProvidersPluginSetupDeps {
12+
globalSearch: GlobalSearchPluginSetup;
13+
}
14+
15+
export class GlobalSearchProvidersPlugin
16+
implements Plugin<{}, {}, GlobalSearchProvidersPluginSetupDeps, {}> {
17+
setup(
18+
{ getStartServices }: CoreSetup<{}, {}>,
19+
{ globalSearch }: GlobalSearchProvidersPluginSetupDeps
20+
) {
21+
globalSearch.registerResultProvider(createSavedObjectsResultProvider());
22+
return {};
23+
}
24+
25+
start() {
26+
return {};
27+
}
28+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
export { createSavedObjectsResultProvider } from './saved_objects';

0 commit comments

Comments
 (0)