Skip to content

Commit

Permalink
Merge branch 'master' into lens/legend_stretch
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Jul 6, 2020
2 parents 738cd29 + 2c27bad commit cac0950
Show file tree
Hide file tree
Showing 66 changed files with 1,957 additions and 813 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Delete any items that are not applicable to this PR.
- [ ] [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, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)
- [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

Expand Down

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions src/plugins/expressions/common/execution/execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,17 +475,6 @@ describe('Execution', () => {
}
});

test('sets duration to 10 milliseconds when function executes 10 milliseconds', async () => {
const execution = createExecution('sleep 10', {}, true);
execution.start(-1);
await execution.result;

const node = execution.state.get().ast.chain[0];
expect(typeof node.debug?.duration).toBe('number');
expect(node.debug?.duration).toBeLessThan(50);
expect(node.debug?.duration).toBeGreaterThanOrEqual(5);
});

test('adds .debug field in expression AST on each executed function', async () => {
const execution = createExecution('add val=1 | add val=2 | add val=3', {}, true);
execution.start(-1);
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 cac0950

Please sign in to comment.