Skip to content

Commit

Permalink
Merge branch '7.x' into backport/7.x/pr-70413
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Jul 6, 2020
2 parents 4a5eda0 + 1dd665e commit 800e441
Show file tree
Hide file tree
Showing 38 changed files with 1,770 additions and 120 deletions.
7 changes: 3 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ Summarize your PR. If it involves visual changes include a screenshot or gif.

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.
Delete any items that are not applicable to this PR.

- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)
- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)
- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials
- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)
- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)
- [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/register": "^7.10.1",
"@elastic/apm-rum": "^5.2.0",
"@elastic/charts": "19.6.3",
"@elastic/charts": "19.7.0",
"@elastic/datemath": "5.0.3",
"@elastic/ems-client": "7.9.3",
"@elastic/eui": "24.1.0",
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
"@elastic/charts": "19.6.3",
"@elastic/charts": "19.7.0",
"@elastic/eui": "24.1.0",
"@elastic/numeral": "^2.5.0",
"@kbn/i18n": "1.0.0",
Expand Down
8 changes: 5 additions & 3 deletions x-pack/plugins/global_search/server/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
RouteHandlerGlobalSearchContext,
} from './types';
import { searchServiceMock } from './services/search_service.mock';
import { contextMock } from './services/context.mock';

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

const createRouteHandlerContextMock = (): jest.Mocked<RouteHandlerGlobalSearchContext> => {
const contextMock = {
const handlerContextMock = {
find: jest.fn(),
};

contextMock.find.mockReturnValue(of([]));
handlerContextMock.find.mockReturnValue(of([]));

return contextMock;
return handlerContextMock;
};

export const globalSearchPluginMock = {
createSetupContract: createSetupMock,
createStartContract: createStartMock,
createRouteHandlerContext: createRouteHandlerContextMock,
createProviderContext: contextMock.create,
};
38 changes: 38 additions & 0 deletions x-pack/plugins/global_search/server/services/context.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import {
savedObjectsTypeRegistryMock,
savedObjectsClientMock,
elasticsearchServiceMock,
uiSettingsServiceMock,
} from '../../../../../src/core/server/mocks';

const createContextMock = () => {
return {
core: {
savedObjects: {
client: savedObjectsClientMock.create(),
typeRegistry: savedObjectsTypeRegistryMock.create(),
},
elasticsearch: {
legacy: {
client: elasticsearchServiceMock.createScopedClusterClient(),
},
},
uiSettings: {
client: uiSettingsServiceMock.createClient(),
},
},
};
};

const createFactoryMock = () => () => () => createContextMock();

export const contextMock = {
create: createContextMock,
createFactory: createFactoryMock,
};
2 changes: 1 addition & 1 deletion x-pack/plugins/global_search_providers/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "globalSearchProviders",
"version": "8.0.0",
"kibanaVersion": "kibana",
"server": false,
"server": true,
"ui": true,
"requiredPlugins": ["globalSearch"],
"optionalPlugins": [],
Expand Down
11 changes: 11 additions & 0 deletions x-pack/plugins/global_search_providers/server/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { PluginInitializer } from 'src/core/server';
import { GlobalSearchProvidersPlugin, GlobalSearchProvidersPluginSetupDeps } from './plugin';

export const plugin: PluginInitializer<{}, {}, GlobalSearchProvidersPluginSetupDeps, {}> = () =>
new GlobalSearchProvidersPlugin();
33 changes: 33 additions & 0 deletions x-pack/plugins/global_search_providers/server/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { coreMock } from '../../../../src/core/server/mocks';
import { globalSearchPluginMock } from '../../global_search/server/mocks';
import { GlobalSearchProvidersPlugin } from './plugin';

describe('GlobalSearchProvidersPlugin', () => {
let plugin: GlobalSearchProvidersPlugin;
let globalSearchSetup: ReturnType<typeof globalSearchPluginMock.createSetupContract>;

beforeEach(() => {
plugin = new GlobalSearchProvidersPlugin();
globalSearchSetup = globalSearchPluginMock.createSetupContract();
});

describe('#setup', () => {
it('registers the `savedObjects` result provider', () => {
const coreSetup = coreMock.createSetup();
plugin.setup(coreSetup, { globalSearch: globalSearchSetup });

expect(globalSearchSetup.registerResultProvider).toHaveBeenCalledTimes(1);
expect(globalSearchSetup.registerResultProvider).toHaveBeenCalledWith(
expect.objectContaining({
id: 'savedObjects',
})
);
});
});
});
28 changes: 28 additions & 0 deletions x-pack/plugins/global_search_providers/server/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { CoreSetup, Plugin } from 'src/core/server';
import { GlobalSearchPluginSetup } from '../../global_search/server';
import { createSavedObjectsResultProvider } from './providers';

export interface GlobalSearchProvidersPluginSetupDeps {
globalSearch: GlobalSearchPluginSetup;
}

export class GlobalSearchProvidersPlugin
implements Plugin<{}, {}, GlobalSearchProvidersPluginSetupDeps, {}> {
setup(
{ getStartServices }: CoreSetup<{}, {}>,
{ globalSearch }: GlobalSearchProvidersPluginSetupDeps
) {
globalSearch.registerResultProvider(createSavedObjectsResultProvider());
return {};
}

start() {
return {};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { createSavedObjectsResultProvider } from './saved_objects';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { createSavedObjectsResultProvider } from './provider';
Loading

0 comments on commit 800e441

Please sign in to comment.