Skip to content

Commit

Permalink
Merge branch 'master' into add-create-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHassanabad committed Jun 8, 2020
2 parents fa51402 + 1e45e98 commit 8be7378
Show file tree
Hide file tree
Showing 348 changed files with 4,375 additions and 1,440 deletions.
4 changes: 0 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,6 @@ module.exports = {
'react/jsx-no-target-blank': 'error',
'react/jsx-fragments': 'error',
'react/jsx-sort-default-props': 'error',
// might be introduced after the other warns are fixed
// 'react/jsx-sort-props': 'error',
// might be introduced after the other warns are fixed
'react-hooks/exhaustive-deps': 'off',
'require-atomic-updates': 'error',
'symbol-description': 'error',
'vars-on-top': 'error',
Expand Down
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
/src/legacy/core_plugins/kibana/public/home/np_ready/ @elastic/kibana-core-ui

# App Architecture
/examples/developer_examples/ @elastic/kibana-app-arch
/examples/url_generators_examples/ @elastic/kibana-app-arch
/examples/url_generators_explorer/ @elastic/kibana-app-arch
/packages/kbn-interpreter/ @elastic/kibana-app-arch
/packages/elastic-datemath/ @elastic/kibana-app-arch
/src/legacy/core_plugins/embeddable_api/ @elastic/kibana-app-arch
/src/legacy/core_plugins/interpreter/ @elastic/kibana-app-arch
/src/legacy/core_plugins/kibana_react/ @elastic/kibana-app-arch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Constructs a new instance of the `IndexPattern` class
<b>Signature:</b>

```typescript
constructor(id: string | undefined, getConfig: any, savedObjectsClient: SavedObjectsClientContract, apiClient: IIndexPatternsApiClient, patternCache: any);
constructor(id: string | undefined, getConfig: any, savedObjectsClient: SavedObjectsClientContract, apiClient: IIndexPatternsApiClient, patternCache: PatternCache);
```

## Parameters
Expand All @@ -20,5 +20,5 @@ constructor(id: string | undefined, getConfig: any, savedObjectsClient: SavedObj
| getConfig | <code>any</code> | |
| savedObjectsClient | <code>SavedObjectsClientContract</code> | |
| apiClient | <code>IIndexPatternsApiClient</code> | |
| patternCache | <code>any</code> | |
| patternCache | <code>PatternCache</code> | |

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
| [IndexPatternTypeMeta](./kibana-plugin-plugins-data-public.indexpatterntypemeta.md) | |
| [IRequestTypesMap](./kibana-plugin-plugins-data-public.irequesttypesmap.md) | |
| [IResponseTypesMap](./kibana-plugin-plugins-data-public.iresponsetypesmap.md) | |
| [ISearchContext](./kibana-plugin-plugins-data-public.isearchcontext.md) | |
| [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) | |
| [ISearchStrategy](./kibana-plugin-plugins-data-public.isearchstrategy.md) | Search strategy interface contains a search method that takes in a request and returns a promise that resolves to a response. |
| [ISyncSearchRequest](./kibana-plugin-plugins-data-public.isyncsearchrequest.md) | |
Expand Down Expand Up @@ -157,5 +156,4 @@
| [TabbedAggRow](./kibana-plugin-plugins-data-public.tabbedaggrow.md) | \* |
| [TimefilterContract](./kibana-plugin-plugins-data-public.timefiltercontract.md) | |
| [TimeHistoryContract](./kibana-plugin-plugins-data-public.timehistorycontract.md) | |
| [TSearchStrategyProvider](./kibana-plugin-plugins-data-public.tsearchstrategyprovider.md) | Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. |

This file was deleted.

2 changes: 1 addition & 1 deletion examples/alerting_example/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["triggers_actions_ui", "charts", "data", "alerts", "actions"],
"requiredPlugins": ["triggers_actions_ui", "charts", "data", "alerts", "actions", "developerExamples"],
"optionalPlugins": []
}
22 changes: 20 additions & 2 deletions examples/alerting_example/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,23 @@
* under the License.
*/

import { Plugin, CoreSetup, AppMountParameters } from 'kibana/public';
import { Plugin, CoreSetup, AppMountParameters, AppNavLinkStatus } from '../../../src/core/public';
import { PluginSetupContract as AlertingSetup } from '../../../x-pack/plugins/alerts/public';
import { ChartsPluginStart } from '../../../src/plugins/charts/public';
import { TriggersAndActionsUIPublicPluginSetup } from '../../../x-pack/plugins/triggers_actions_ui/public';
import { DataPublicPluginStart } from '../../../src/plugins/data/public';
import { getAlertType as getAlwaysFiringAlertType } from './alert_types/always_firing';
import { getAlertType as getPeopleInSpaceAlertType } from './alert_types/astros';
import { registerNavigation } from './alert_types';
import { DeveloperExamplesSetup } from '../../developer_examples/public';

export type Setup = void;
export type Start = void;

export interface AlertingExamplePublicSetupDeps {
alerts: AlertingSetup;
triggers_actions_ui: TriggersAndActionsUIPublicPluginSetup;
developerExamples: DeveloperExamplesSetup;
}

export interface AlertingExamplePublicStartDeps {
Expand All @@ -44,11 +46,12 @@ export interface AlertingExamplePublicStartDeps {
export class AlertingExamplePlugin implements Plugin<Setup, Start, AlertingExamplePublicSetupDeps> {
public setup(
core: CoreSetup<AlertingExamplePublicStartDeps, Start>,
{ alerts, triggers_actions_ui }: AlertingExamplePublicSetupDeps
{ alerts, triggers_actions_ui, developerExamples }: AlertingExamplePublicSetupDeps
) {
core.application.register({
id: 'AlertingExample',
title: 'Alerting Example',
navLinkStatus: AppNavLinkStatus.hidden,
async mount(params: AppMountParameters) {
const [coreStart, depsStart] = await core.getStartServices();
const { renderApp } = await import('./application');
Expand All @@ -60,6 +63,21 @@ export class AlertingExamplePlugin implements Plugin<Setup, Start, AlertingExamp
triggers_actions_ui.alertTypeRegistry.register(getPeopleInSpaceAlertType());

registerNavigation(alerts);

developerExamples.register({
appId: 'AlertingExample',
title: 'Alerting',
description: `This alerting example walks you through how to set up a new alert.`,
links: [
{
label: 'README',
href: 'https://github.com/elastic/kibana/tree/master/x-pack/plugins/alerting',
iconType: 'logoGithub',
size: 's',
target: '_blank',
},
],
});
}

public start() {}
Expand Down
2 changes: 1 addition & 1 deletion examples/bfetch_explorer/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["bfetch"],
"requiredPlugins": ["bfetch", "developerExamples"],
"optionalPlugins": []
}
25 changes: 22 additions & 3 deletions examples/bfetch_explorer/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@
* under the License.
*/

import { Plugin, CoreSetup } from 'kibana/public';
import { Plugin, CoreSetup, AppNavLinkStatus } from '../../../src/core/public';
import { BfetchPublicSetup, BfetchPublicStart } from '../../../src/plugins/bfetch/public';
import { mount } from './mount';
import { DeveloperExamplesSetup } from '../../developer_examples/public';

export interface ExplorerService {
double: (number: { num: number }) => Promise<{ num: number }>;
}

export interface BfetchExplorerSetupPlugins {
bfetch: BfetchPublicSetup;
developerExamples: DeveloperExamplesSetup;
}

export interface BfetchExplorerStartPlugins {
Expand All @@ -36,9 +38,9 @@ export interface BfetchExplorerStartPlugins {
export class BfetchExplorerPlugin implements Plugin {
public setup(
core: CoreSetup<BfetchExplorerStartPlugins, void>,
plugins: BfetchExplorerSetupPlugins
{ bfetch, developerExamples }: BfetchExplorerSetupPlugins
) {
const double = plugins.bfetch.batchedFunction<{ num: number }, { num: number }>({
const double = bfetch.batchedFunction<{ num: number }, { num: number }>({
url: '/bfetch_explorer/double',
});

Expand All @@ -49,8 +51,25 @@ export class BfetchExplorerPlugin implements Plugin {
core.application.register({
id: 'bfetch-explorer',
title: 'bfetch explorer',
navLinkStatus: AppNavLinkStatus.hidden,
mount: mount(core, explorer),
});

developerExamples.register({
appId: 'bfetch-explorer',
title: 'bfetch',
description:
'bfetch is a service that allows to batch HTTP requests and streams responses back.',
links: [
{
label: 'README',
href: 'https://github.com/elastic/kibana/blob/master/src/plugins/bfetch/README.md',
iconType: 'logoGithub',
size: 's',
target: '_blank',
},
],
});
}

public start() {}
Expand Down
68 changes: 21 additions & 47 deletions examples/demo_search/public/async_demo_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,27 @@
* under the License.
*/

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

import { ASYNC_DEMO_SEARCH_STRATEGY, IAsyncDemoResponse } from '../common';
import { Observable, from } from 'rxjs';
import { CoreSetup } from 'kibana/public';
import { flatMap } from 'rxjs/operators';
import { ISearch } from '../../../src/plugins/data/public';
import { ASYNC_SEARCH_STRATEGY } from '../../../x-pack/plugins/data_enhanced/public';
import { ASYNC_DEMO_SEARCH_STRATEGY, IAsyncDemoResponse } from '../common';
import { DemoDataSearchStartDependencies } from './types';

/**
* This demo search strategy provider simply provides a shortcut for calling the DEMO_ASYNC_SEARCH_STRATEGY
* on the server side, without users having to pass it in explicitly, and it takes advantage of the
* already registered ASYNC_SEARCH_STRATEGY that exists on the client.
*
* so instead of callers having to do:
*
* ```
* search(
* { ...request, serverStrategy: DEMO_ASYNC_SEARCH_STRATEGY },
* options,
* ASYNC_SEARCH_STRATEGY
* ) as Observable<IDemoResponse>,
*```
* They can instead just do
*
* ```
* search(request, options, DEMO_ASYNC_SEARCH_STRATEGY);
* ```
*
* and are ensured type safety in regard to the request and response objects.
*
* @param context - context supplied by other plugins.
* @param search - a search function to access other strategies that have already been registered.
*/
export const asyncDemoClientSearchStrategyProvider: TSearchStrategyProvider<typeof ASYNC_DEMO_SEARCH_STRATEGY> = (
context: ISearchContext
): ISearchStrategy<typeof ASYNC_DEMO_SEARCH_STRATEGY> => {
const asyncStrategyProvider = context.getSearchStrategy(ASYNC_SEARCH_STRATEGY);
const { search } = asyncStrategyProvider(context);
return {
search: (request, options) => {
return search(
{ ...request, serverStrategy: ASYNC_DEMO_SEARCH_STRATEGY },
options
) as Observable<IAsyncDemoResponse>;
},
export function asyncDemoClientSearchStrategyProvider(core: CoreSetup) {
const search: ISearch<typeof ASYNC_DEMO_SEARCH_STRATEGY> = (request, options) => {
return from(core.getStartServices()).pipe(
flatMap((startServices) => {
const asyncStrategy = (startServices[1] as DemoDataSearchStartDependencies).data.search.getSearchStrategy(
ASYNC_SEARCH_STRATEGY
);
return asyncStrategy.search(
{ ...request, serverStrategy: ASYNC_DEMO_SEARCH_STRATEGY },
options
) as Observable<IAsyncDemoResponse>;
})
);
};
};
return { search };
}
43 changes: 22 additions & 21 deletions examples/demo_search/public/demo_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
* under the License.
*/

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

import { Observable, from } from 'rxjs';
import { flatMap } from 'rxjs/operators';
import { CoreSetup } from 'kibana/public';
import { ISearch, SYNC_SEARCH_STRATEGY } from '../../../src/plugins/data/public';
import { DEMO_SEARCH_STRATEGY, IDemoResponse } from '../common';
import { DemoDataSearchStartDependencies } from './types';

/**
* This demo search strategy provider simply provides a shortcut for calling the DEMO_SEARCH_STRATEGY
Expand All @@ -31,7 +32,7 @@ import { DEMO_SEARCH_STRATEGY, IDemoResponse } from '../common';
* so instead of callers having to do:
*
* ```
* context.search(
* data.search.search(
* { ...request, serverStrategy: DEMO_SEARCH_STRATEGY },
* options,
* SYNC_SEARCH_STRATEGY
Expand All @@ -41,24 +42,24 @@ import { DEMO_SEARCH_STRATEGY, IDemoResponse } from '../common';
* They can instead just do
*
* ```
* context.search(request, options, DEMO_SEARCH_STRATEGY);
* data.search.search(request, options, DEMO_SEARCH_STRATEGY);
* ```
*
* and are ensured type safety in regard to the request and response objects.
*
* @param context - context supplied by other plugins.
* @param search - a search function to access other strategies that have already been registered.
*/
export const demoClientSearchStrategyProvider: TSearchStrategyProvider<typeof DEMO_SEARCH_STRATEGY> = (
context: ISearchContext
): ISearchStrategy<typeof DEMO_SEARCH_STRATEGY> => {
const syncStrategyProvider = context.getSearchStrategy(SYNC_SEARCH_STRATEGY);
const { search } = syncStrategyProvider(context);
return {
search: (request, options) => {
return search({ ...request, serverStrategy: DEMO_SEARCH_STRATEGY }, options) as Observable<
IDemoResponse
>;
},
export function demoClientSearchStrategyProvider(core: CoreSetup) {
const search: ISearch<typeof DEMO_SEARCH_STRATEGY> = (request, options) => {
return from(core.getStartServices()).pipe(
flatMap((startServices) => {
const syncStrategy = (startServices[1] as DemoDataSearchStartDependencies).data.search.getSearchStrategy(
SYNC_SEARCH_STRATEGY
);
return syncStrategy.search(
{ ...request, serverStrategy: DEMO_SEARCH_STRATEGY },
options
) as Observable<IDemoResponse>;
})
);
};
};
return { search };
}
Loading

0 comments on commit 8be7378

Please sign in to comment.