Skip to content

Commit

Permalink
Merge branch 'master' into jest-build
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsongl committed Feb 19, 2020
2 parents ba18212 + 0340fac commit 856e232
Show file tree
Hide file tree
Showing 289 changed files with 7,946 additions and 1,940 deletions.
9 changes: 8 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
# Observability UIs
/x-pack/legacy/plugins/infra/ @elastic/logs-metrics-ui
/x-pack/plugins/infra/ @elastic/logs-metrics-ui
/x-pack/legacy/plugins/integrations_manager/ @elastic/epm
/x-pack/plugins/ingest_manager/ @elastic/ingest
/x-pack/legacy/plugins/ingest_manager/ @elastic/ingest
/x-pack/plugins/observability/ @elastic/logs-metrics-ui @elastic/apm-ui @elastic/uptime @elastic/ingest

# Machine Learning
Expand Down Expand Up @@ -177,3 +178,9 @@
/x-pack/plugins/searchprofiler/ @elastic/es-ui
/x-pack/legacy/plugins/snapshot_restore/ @elastic/es-ui
/x-pack/plugins/watcher/ @elastic/es-ui

# Endpoint
/x-pack/plugins/endpoint/ @elastic/endpoint-app-team
/x-pack/test/api_integration/apis/endpoint/ @elastic/endpoint-app-team
/x-pack/test/functional/apps/endpoint/ @elastic/endpoint-app-team
/x-pack/test/functional/es_archives/endpoint/ @elastic/endpoint-app-team
22 changes: 9 additions & 13 deletions examples/demo_search/public/demo_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
*/

import { Observable } from 'rxjs';
import {
ISearchContext,
SYNC_SEARCH_STRATEGY,
ISearchGeneric,
} from '../../../src/plugins/data/public';
import { ISearchContext, SYNC_SEARCH_STRATEGY } from '../../../src/plugins/data/public';
import { TSearchStrategyProvider, ISearchStrategy } from '../../../src/plugins/data/public';

import { DEMO_SEARCH_STRATEGY, IDemoResponse } from '../common';
Expand Down Expand Up @@ -54,15 +50,15 @@ import { DEMO_SEARCH_STRATEGY, IDemoResponse } from '../common';
* @param search - a search function to access other strategies that have already been registered.
*/
export const demoClientSearchStrategyProvider: TSearchStrategyProvider<typeof DEMO_SEARCH_STRATEGY> = (
context: ISearchContext,
search: ISearchGeneric
context: ISearchContext
): ISearchStrategy<typeof DEMO_SEARCH_STRATEGY> => {
const syncStrategyProvider = context.getSearchStrategy(SYNC_SEARCH_STRATEGY);
const { search } = syncStrategyProvider(context);
return {
search: (request, options) =>
search(
{ ...request, serverStrategy: DEMO_SEARCH_STRATEGY },
options,
SYNC_SEARCH_STRATEGY
) as Observable<IDemoResponse>,
search: (request, options) => {
return search({ ...request, serverStrategy: DEMO_SEARCH_STRATEGY }, options) as Observable<
IDemoResponse
>;
},
};
};
6 changes: 2 additions & 4 deletions examples/demo_search/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
* under the License.
*/

import { PluginInitializer, PluginInitializerContext } from 'kibana/public';
import { PluginInitializer } from 'kibana/public';

import { DemoDataPlugin } from './plugin';

export { DEMO_SEARCH_STRATEGY } from '../common';

export const plugin: PluginInitializer<void, void> = (
initializerContext: PluginInitializerContext
) => new DemoDataPlugin(initializerContext);
export const plugin: PluginInitializer<void, void> = () => new DemoDataPlugin();
4 changes: 1 addition & 3 deletions examples/demo_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { DataPublicPluginSetup } from '../../../src/plugins/data/public';
import { Plugin, CoreSetup, PluginInitializerContext } from '../../../src/core/public';
import { Plugin, CoreSetup } from '../../../src/core/public';
import { DEMO_SEARCH_STRATEGY } from '../common';
import { demoClientSearchStrategyProvider } from './demo_search_strategy';
import { IDemoRequest, IDemoResponse } from '../common';
Expand Down Expand Up @@ -47,10 +47,8 @@ declare module '../../../src/plugins/data/public' {
}

export class DemoDataPlugin implements Plugin {
constructor(private initializerContext: PluginInitializerContext) {}
public setup(core: CoreSetup, deps: DemoDataSearchSetupDependencies) {
deps.data.search.registerSearchStrategyProvider(
this.initializerContext.opaqueId,
DEMO_SEARCH_STRATEGY,
demoClientSearchStrategyProvider
);
Expand Down
21 changes: 13 additions & 8 deletions examples/search_explorer/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ import {
EuiSideNav,
} from '@elastic/eui';

import { AppMountContext, AppMountParameters } from '../../../src/core/public';
import { AppMountParameters, CoreStart } from '../../../src/core/public';
import { EsSearchTest } from './es_strategy';
import { Page } from './page';
import { DemoStrategy } from './demo_strategy';
import { DocumentationPage } from './documentation';
import { SearchApiPage } from './search_api';
import { AppPluginStartDependencies, SearchBarComponentParams } from './types';

const Home = () => <DocumentationPage />;

Expand All @@ -44,7 +45,7 @@ interface PageDef {
}

type NavProps = RouteComponentProps & {
navigateToApp: AppMountContext['core']['application']['navigateToApp'];
navigateToApp: CoreStart['application']['navigateToApp'];
pages: PageDef[];
};

Expand All @@ -71,7 +72,7 @@ const Nav = withRouter(({ history, navigateToApp, pages }: NavProps) => {

const buildPage = (page: PageDef) => <Page title={page.title}>{page.component}</Page>;

const SearchApp = ({ basename, context }: { basename: string; context: AppMountContext }) => {
const SearchApp = ({ basename, data, application }: SearchBarComponentParams) => {
const pages: PageDef[] = [
{
id: 'home',
Expand All @@ -86,12 +87,12 @@ const SearchApp = ({ basename, context }: { basename: string; context: AppMountC
{
title: 'ES search strategy',
id: 'esSearch',
component: <EsSearchTest search={context.search!.search} />,
component: <EsSearchTest search={data.search.search} />,
},
{
title: 'Demo search strategy',
id: 'demoSearch',
component: <DemoStrategy search={context.search!.search} />,
component: <DemoStrategy search={data.search.search} />,
},
];

Expand All @@ -103,7 +104,7 @@ const SearchApp = ({ basename, context }: { basename: string; context: AppMountC
<Router basename={basename}>
<EuiPage>
<EuiPageSideBar>
<Nav navigateToApp={context.core.application.navigateToApp} pages={pages} />
<Nav navigateToApp={application.navigateToApp} pages={pages} />
</EuiPageSideBar>
<Route path="/" exact component={Home} />
{routes}
Expand All @@ -113,10 +114,14 @@ const SearchApp = ({ basename, context }: { basename: string; context: AppMountC
};

export const renderApp = (
context: AppMountContext,
coreStart: CoreStart,
deps: AppPluginStartDependencies,
{ appBasePath, element }: AppMountParameters
) => {
ReactDOM.render(<SearchApp basename={appBasePath} context={context} />, element);
ReactDOM.render(
<SearchApp basename={appBasePath} data={deps.data} application={coreStart.application} />,
element
);

return () => ReactDOM.unmountComponentAtNode(element);
};
7 changes: 1 addition & 6 deletions examples/search_explorer/public/es_strategy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import serverPlugin from '!!raw-loader!./../../../src/plugins/data/server/search
// @ts-ignore
import serverStrategy from '!!raw-loader!./../../../src/plugins/data/server/search/es_search/es_search_strategy';

// @ts-ignore
import publicPlugin from '!!raw-loader!./../../../src/plugins/data/public/search/es_search/es_search_service';
// @ts-ignore
import publicStrategy from '!!raw-loader!./../../../src/plugins/data/public/search/es_search/es_search_strategy';

Expand Down Expand Up @@ -125,10 +123,7 @@ export class EsSearchTest extends React.Component<Props, State> {
codeSections={[
{
title: 'Public',
code: [
{ description: 'es_search_service.ts', snippet: publicPlugin },
{ description: 'es_search_strategy.ts', snippet: publicStrategy },
],
code: [{ description: 'es_search_strategy.ts', snippet: publicStrategy }],
},
{
title: 'Server',
Expand Down
16 changes: 6 additions & 10 deletions examples/search_explorer/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@
* under the License.
*/

import { Plugin, CoreSetup } from 'kibana/public';
import { ISearchAppMountContext } from '../../../src/plugins/data/public';
import { Plugin, CoreSetup, AppMountParameters } from 'kibana/public';
import { AppPluginStartDependencies } from './types';

declare module 'kibana/public' {
interface AppMountContext {
search?: ISearchAppMountContext;
}
}
export class SearchExplorerPlugin implements Plugin {
public setup(core: CoreSetup) {
public setup(core: CoreSetup<AppPluginStartDependencies>) {
core.application.register({
id: 'searchExplorer',
title: 'Search Explorer',
async mount(context, params) {
async mount(params: AppMountParameters) {
const [coreStart, depsStart] = await core.getStartServices();
const { renderApp } = await import('./application');
return renderApp(context, params);
return renderApp(coreStart, depsStart, params);
},
});
}
Expand Down
18 changes: 0 additions & 18 deletions examples/search_explorer/public/search_api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
import React from 'react';
import { GuideSection } from './guide_section';

// @ts-ignore
import publicSetupContract from '!!raw-loader!./../../../src/plugins/data/public/search/i_search_setup';
// @ts-ignore
import publicSearchStrategy from '!!raw-loader!./../../../src/plugins/data/public/search/i_search_strategy';
// @ts-ignore
import publicSearch from '!!raw-loader!./../../../src/plugins/data/public/search/i_search';
// @ts-ignore
Expand All @@ -31,8 +27,6 @@ import publicPlugin from '!!raw-loader!./../../../src/plugins/data/public/search
// @ts-ignore
import serverSetupContract from '!!raw-loader!./../../../src/plugins/data/server/search/i_search_setup';
// @ts-ignore
import serverSearchStrategy from '!!raw-loader!./../../../src/plugins/data/server/search/i_search_strategy';
// @ts-ignore
import serverSearch from '!!raw-loader!./../../../src/plugins/data/server/search/i_search';
// @ts-ignore
import serverPlugin from '!!raw-loader!./../../../src/plugins/data/server/search/search_service';
Expand All @@ -47,18 +41,10 @@ export const SearchApiPage = () => (
description: 'search_service.ts',
snippet: publicPlugin,
},
{
description: `i_search_setup.ts`,
snippet: publicSetupContract,
},
{
description: 'i_search',
snippet: publicSearch,
},
{
description: 'i_search_strategy',
snippet: publicSearchStrategy,
},
],
},
{
Expand All @@ -76,10 +62,6 @@ export const SearchApiPage = () => (
description: 'i_search',
snippet: serverSearch,
},
{
description: 'i_search_strategy',
snippet: serverSearchStrategy,
},
],
},
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
import { CoreSetup } from '../../../../core/public';

export interface ISearchContext {
core: CoreSetup;
import { CoreStart } from 'kibana/public';
import { DataPublicPluginStart } from '../../../src/plugins/data/public';

export interface AppPluginStartDependencies {
data: DataPublicPluginStart;
}

export interface SearchBarComponentParams {
application: CoreStart['application'];
basename: string;
data: DataPublicPluginStart;
}
7 changes: 0 additions & 7 deletions examples/ui_actions_explorer/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import { Plugin, CoreSetup, AppMountParameters } from 'kibana/public';
import { UiActionsStart, UiActionsSetup } from 'src/plugins/ui_actions/public';
import { ISearchAppMountContext } from '../../../src/plugins/data/public';
import {
PHONE_TRIGGER,
USER_TRIGGER,
Expand All @@ -38,12 +37,6 @@ import {
SHOWCASE_PLUGGABILITY_ACTION,
} from './actions/actions';

declare module 'kibana/public' {
interface AppMountContext {
search?: ISearchAppMountContext;
}
}

interface StartDeps {
uiActions: UiActionsStart;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/dev/i18n/extract_default_translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export async function matchEntriesWithExctractors(inputPath, options = {}) {
const ignore = [
'**/node_modules/**',
'**/__tests__/**',
'**/dist/**',
'**/target/**',
'**/vendor/**',
'**/*.test.{js,jsx,ts,tsx}',
'**/*.d.ts',
].concat(additionalIgnore);
Expand Down
3 changes: 2 additions & 1 deletion src/dev/i18n/serializers/__snapshots__/json.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/dev/i18n/serializers/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ export const serializeToJson: Serializer = (messages, formats = i18n.formats) =>
}
}

return JSON.stringify(resultJsonObject, undefined, 2);
return JSON.stringify(resultJsonObject, undefined, 2).concat('\n');
};
1 change: 0 additions & 1 deletion src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import glob from 'glob';
import { resolve } from 'path';

import { REPO_ROOT } from '../constants';
import { Project } from './project';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ <h1 class="euiScreenReaderOnly">{{screenTitle}}</h1>
data-shared-item
data-title="{{opts.savedSearch.lastSavedTitle}}"
data-description="{{opts.savedSearch.description}}"
data-test-subj="discoverDocTable"
minimum-visible-rows="minimumVisibleRows"
render-complete
on-add-column="addColumn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ import { TelemetryPluginStart } from '../../../../../plugins/telemetry/public';
import {
Environment,
HomePublicPluginSetup,
TutorialStart,
HomePublicPluginStart,
} from '../../../../../plugins/home/public';
import { KibanaLegacySetup } from '../../../../../plugins/kibana_legacy/public';

export interface HomeKibanaServices {
indexPatternService: any;
kibanaVersion: string;
getInjected: (name: string, defaultValue?: any) => unknown;
chrome: ChromeStart;
uiSettings: IUiSettingsClient;
config: KibanaLegacySetup['config'];
Expand All @@ -54,6 +54,7 @@ export interface HomeKibanaServices {
addBasePath: (url: string) => string;
environment: Environment;
telemetry?: TelemetryPluginStart;
tutorialVariables: TutorialStart['get'];
}

let services: HomeKibanaServices | null = null;
Expand Down
Loading

0 comments on commit 856e232

Please sign in to comment.