Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into kbn-52071-so-migr…
Browse files Browse the repository at this point in the history
…ation-after-setup
  • Loading branch information
pgayvallet committed Jan 21, 2020
2 parents ceec182 + 01fe8af commit e20a6de
Show file tree
Hide file tree
Showing 640 changed files with 11,167 additions and 7,791 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ bower_components
/built_assets
/html_docs
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
/src/legacy/core_plugins/vis_type_timelion/public/_generated_/**
src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data
/src/legacy/ui/public/angular-bootstrap
/src/legacy/ui/public/flot-charts
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/src/legacy/core_plugins/kibana/public/home/ @elastic/kibana-app
/src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app
/src/legacy/core_plugins/metrics/ @elastic/kibana-app
/src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
/src/plugins/home/ @elastic/kibana-app
/src/plugins/kibana_legacy/ @elastic/kibana-app
/src/plugins/timelion/ @elastic/kibana-app
Expand Down
4 changes: 2 additions & 2 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"interpreter": "src/legacy/core_plugins/interpreter",
"kbn": "src/legacy/core_plugins/kibana",
"kbnDocViews": "src/legacy/core_plugins/kbn_doc_views",
"kbnVislibVisTypes": "src/legacy/core_plugins/vis_type_vislib",
"management": ["src/legacy/core_plugins/management", "src/plugins/management"],
"kibana_react": "src/legacy/core_plugins/kibana_react",
"kibana-react": "src/plugins/kibana_react",
Expand All @@ -41,6 +40,7 @@
"visTypeTagCloud": "src/legacy/core_plugins/vis_type_tagcloud",
"visTypeTimeseries": "src/legacy/core_plugins/vis_type_timeseries",
"visTypeVega": "src/legacy/core_plugins/vis_type_vega",
"visTypeVislib": "src/legacy/core_plugins/vis_type_vislib",
"visualizations": [
"src/plugins/visualizations",
"src/legacy/core_plugins/visualizations"
Expand All @@ -50,4 +50,4 @@
"src/legacy/ui/ui_render/ui_render_mixin.js"
],
"translations": []
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeNavLinks](./kibana-plugin-public.chromenavlinks.md) &gt; [update](./kibana-plugin-public.chromenavlinks.update.md)

## ChromeNavLinks.update() method

> Warning: This API is now obsolete.
>
> Uses the [AppBase.updater$](./kibana-plugin-public.appbase.updater_.md) property when registering your application with [ApplicationSetup.register()](./kibana-plugin-public.applicationsetup.register.md) instead.
>
Update the navlink for the given id with the updated attributes. Returns the updated navlink or `undefined` if it does not exist.

<b>Signature:</b>

```typescript
update(id: string, values: ChromeNavLinkUpdateableFields): ChromeNavLink | undefined;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| id | <code>string</code> | |
| values | <code>ChromeNavLinkUpdateableFields</code> | |

<b>Returns:</b>

`ChromeNavLink | undefined`

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeNavLinks](./kibana-plugin-public.chromenavlinks.md) &gt; [update](./kibana-plugin-public.chromenavlinks.update.md)

## ChromeNavLinks.update() method

> Warning: This API is now obsolete.
>
> Uses the [AppBase.updater$](./kibana-plugin-public.appbase.updater_.md) property when registering your application with [ApplicationSetup.register()](./kibana-plugin-public.applicationsetup.register.md) instead.
>
Update the navlink for the given id with the updated attributes. Returns the updated navlink or `undefined` if it does not exist.

<b>Signature:</b>

```typescript
update(id: string, values: ChromeNavLinkUpdateableFields): ChromeNavLink | undefined;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| id | <code>string</code> | |
| values | <code>ChromeNavLinkUpdateableFields</code> | |

<b>Returns:</b>

`ChromeNavLink | undefined`

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreStart](./kibana-plugin-public.corestart.md) &gt; [fatalErrors](./kibana-plugin-public.corestart.fatalerrors.md)

## CoreStart.fatalErrors property

[FatalErrorsStart](./kibana-plugin-public.fatalerrorsstart.md)

<b>Signature:</b>

```typescript
fatalErrors: FatalErrorsStart;
```
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface CoreStart
| [application](./kibana-plugin-public.corestart.application.md) | <code>ApplicationStart</code> | [ApplicationStart](./kibana-plugin-public.applicationstart.md) |
| [chrome](./kibana-plugin-public.corestart.chrome.md) | <code>ChromeStart</code> | [ChromeStart](./kibana-plugin-public.chromestart.md) |
| [docLinks](./kibana-plugin-public.corestart.doclinks.md) | <code>DocLinksStart</code> | [DocLinksStart](./kibana-plugin-public.doclinksstart.md) |
| [fatalErrors](./kibana-plugin-public.corestart.fatalerrors.md) | <code>FatalErrorsStart</code> | [FatalErrorsStart](./kibana-plugin-public.fatalerrorsstart.md) |
| [http](./kibana-plugin-public.corestart.http.md) | <code>HttpStart</code> | [HttpStart](./kibana-plugin-public.httpstart.md) |
| [i18n](./kibana-plugin-public.corestart.i18n.md) | <code>I18nStart</code> | [I18nStart](./kibana-plugin-public.i18nstart.md) |
| [injectedMetadata](./kibana-plugin-public.corestart.injectedmetadata.md) | <code>{</code><br/><code> getInjectedVar: (name: string, defaultValue?: any) =&gt; unknown;</code><br/><code> }</code> | exposed temporarily until https://github.com/elastic/kibana/issues/41990 done use \*only\* to retrieve config values. There is no way to set injected values in the new platform. Use the legacy platform API instead. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [FatalErrorsStart](./kibana-plugin-public.fatalerrorsstart.md)

## FatalErrorsStart type

FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error.

<b>Signature:</b>

```typescript
export declare type FatalErrorsStart = FatalErrorsSetup;
```
1 change: 1 addition & 0 deletions docs/development/core/public/kibana-plugin-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [ChromeHelpExtensionMenuGitHubLink](./kibana-plugin-public.chromehelpextensionmenugithublink.md) | |
| [ChromeHelpExtensionMenuLink](./kibana-plugin-public.chromehelpextensionmenulink.md) | |
| [ChromeNavLinkUpdateableFields](./kibana-plugin-public.chromenavlinkupdateablefields.md) | |
| [FatalErrorsStart](./kibana-plugin-public.fatalerrorsstart.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. |
| [HandlerContextType](./kibana-plugin-public.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-public.handlerfunction.md) to represent the type of the context. |
| [HandlerFunction](./kibana-plugin-public.handlerfunction.md) | A function that accepts a context object and an optional number of additional arguments. Used for the generic types in [IContextContainer](./kibana-plugin-public.icontextcontainer.md) |
| [HandlerParameters](./kibana-plugin-public.handlerparameters.md) | Extracts the types of the additional arguments of a [HandlerFunction](./kibana-plugin-public.handlerfunction.md)<!-- -->, excluding the [HandlerContextType](./kibana-plugin-public.handlercontexttype.md)<!-- -->. |
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@
"@types/moment-timezone": "^0.5.12",
"@types/mustache": "^0.8.31",
"@types/node": "^10.12.27",
"@types/numeral": "^0.0.26",
"@types/opn": "^5.1.0",
"@types/pegjs": "^0.10.1",
"@types/pngjs": "^3.3.2",
Expand Down
8 changes: 8 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,14 @@
'@types/nodemailer',
],
},
{
groupSlug: 'numeral',
groupName: 'numeral related packages',
packageNames: [
'numeral',
'@types/numeral',
],
},
{
groupSlug: 'object-hash',
groupName: 'object-hash related packages',
Expand Down
7 changes: 3 additions & 4 deletions src/core/public/core_system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,15 +429,14 @@ describe('Notifications targetDomElement', () => {
rootDomElement,
});

let targetDomElementParentInStart: HTMLElement | null;
let targetDomElementInStart: HTMLElement | null;
MockNotificationsService.start.mockImplementation(({ targetDomElement }): any => {
expect(targetDomElement.parentElement).not.toBeNull();
targetDomElementParentInStart = targetDomElement.parentElement;
targetDomElementInStart = targetDomElement;
});

// Starting the core system should pass the targetDomElement as a child of the rootDomElement
await core.setup();
await core.start();
expect(targetDomElementParentInStart!).toBe(rootDomElement);
expect(targetDomElementInStart!.parentElement).toBe(rootDomElement);
});
});
17 changes: 10 additions & 7 deletions src/core/public/core_system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,20 +214,14 @@ export class CoreSystem {
const http = await this.http.start({ injectedMetadata, fatalErrors: this.fatalErrorsSetup! });
const savedObjects = await this.savedObjects.start({ http });
const i18n = await this.i18n.start();
const fatalErrors = await this.fatalErrors.start();
await this.integrations.start({ uiSettings });

const coreUiTargetDomElement = document.createElement('div');
coreUiTargetDomElement.id = 'kibana-body';
const notificationsTargetDomElement = document.createElement('div');
const overlayTargetDomElement = document.createElement('div');

// ensure the rootDomElement is empty
this.rootDomElement.textContent = '';
this.rootDomElement.classList.add('coreSystemRootDomElement');
this.rootDomElement.appendChild(coreUiTargetDomElement);
this.rootDomElement.appendChild(notificationsTargetDomElement);
this.rootDomElement.appendChild(overlayTargetDomElement);

const overlays = this.overlay.start({
i18n,
targetDomElement: overlayTargetDomElement,
Expand Down Expand Up @@ -271,9 +265,18 @@ export class CoreSystem {
notifications,
overlays,
uiSettings,
fatalErrors,
};

const plugins = await this.plugins.start(core);

// ensure the rootDomElement is empty
this.rootDomElement.textContent = '';
this.rootDomElement.classList.add('coreSystemRootDomElement');
this.rootDomElement.appendChild(coreUiTargetDomElement);
this.rootDomElement.appendChild(notificationsTargetDomElement);
this.rootDomElement.appendChild(overlayTargetDomElement);

const rendering = this.rendering.start({
application,
chrome,
Expand Down
4 changes: 4 additions & 0 deletions src/core/public/fatal_errors/fatal_errors_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ const createSetupContractMock = () => {

return setupContract;
};
const createStartContractMock = createSetupContractMock;

type FatalErrorsServiceContract = PublicMethodsOf<FatalErrorsService>;
const createMock = () => {
const mocked: jest.Mocked<FatalErrorsServiceContract> = {
setup: jest.fn(),
start: jest.fn(),
};

mocked.setup.mockReturnValue(createSetupContractMock());
mocked.start.mockReturnValue(createStartContractMock());
return mocked;
};

export const fatalErrorsServiceMock = {
create: createMock,
createSetupContract: createSetupContractMock,
createStartContract: createStartContractMock,
};
23 changes: 20 additions & 3 deletions src/core/public/fatal_errors/fatal_errors_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,18 @@ export interface FatalErrorsSetup {
get$: () => Rx.Observable<FatalErrorInfo>;
}

/**
* FatalErrors stop the Kibana Public Core and displays a fatal error screen
* with details about the Kibana build and the error.
*
* @public
*/
export type FatalErrorsStart = FatalErrorsSetup;

/** @interal */
export class FatalErrorsService {
private readonly errorInfo$ = new Rx.ReplaySubject<FatalErrorInfo>();
private fatalErrors?: FatalErrorsSetup;

/**
*
Expand All @@ -82,7 +91,7 @@ export class FatalErrorsService {
},
});

const fatalErrorsSetup: FatalErrorsSetup = {
this.fatalErrors = {
add: (error, source?) => {
const errorInfo = getErrorInfo(error, source);

Expand All @@ -101,9 +110,17 @@ export class FatalErrorsService {
},
};

this.setupGlobalErrorHandlers(fatalErrorsSetup);
this.setupGlobalErrorHandlers(this.fatalErrors!);

return fatalErrorsSetup;
return this.fatalErrors!;
}

public start() {
const { fatalErrors } = this;
if (!fatalErrors) {
throw new Error('FatalErrorsService#setup() must be invoked before start.');
}
return fatalErrors;
}

private renderError(injectedMetadata: InjectedMetadataSetup, i18n: I18nStart) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/fatal_errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
* under the License.
*/

export { FatalErrorsSetup, FatalErrorsService } from './fatal_errors_service';
export { FatalErrorsSetup, FatalErrorsStart, FatalErrorsService } from './fatal_errors_service';
export { FatalErrorInfo } from './get_error_info';
6 changes: 5 additions & 1 deletion src/core/public/http/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ export class Fetch {
try {
response = await window.fetch(request);
} catch (err) {
throw new HttpFetchError(err.message, request);
if (err.name === 'AbortError') {
throw err;
} else {
throw new HttpFetchError(err.message, request);
}
}

const contentType = response.headers.get('Content-Type') || '';
Expand Down
5 changes: 4 additions & 1 deletion src/core/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import {
ChromeRecentlyAccessed,
ChromeRecentlyAccessedHistoryItem,
} from './chrome';
import { FatalErrorsSetup, FatalErrorInfo } from './fatal_errors';
import { FatalErrorsSetup, FatalErrorsStart, FatalErrorInfo } from './fatal_errors';
import { HttpSetup, HttpStart } from './http';
import { I18nStart } from './i18n';
import { InjectedMetadataSetup, InjectedMetadataStart, LegacyNavLink } from './injected_metadata';
Expand Down Expand Up @@ -232,6 +232,8 @@ export interface CoreStart {
overlays: OverlayStart;
/** {@link IUiSettingsClient} */
uiSettings: IUiSettingsClient;
/** {@link FatalErrorsStart} */
fatalErrors: FatalErrorsStart;
/**
* exposed temporarily until https://github.com/elastic/kibana/issues/41990 done
* use *only* to retrieve config values. There is no way to set injected values
Expand Down Expand Up @@ -302,6 +304,7 @@ export {
DocLinksStart,
FatalErrorInfo,
FatalErrorsSetup,
FatalErrorsStart,
HttpSetup,
HttpStart,
I18nStart,
Expand Down
2 changes: 2 additions & 0 deletions src/core/public/legacy/legacy_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const notificationsStart = notificationServiceMock.createStartContract();
const overlayStart = overlayServiceMock.createStartContract();
const uiSettingsStart = uiSettingsServiceMock.createStartContract();
const savedObjectsStart = savedObjectsMock.createStartContract();
const fatalErrorsStart = fatalErrorsServiceMock.createStartContract();
const mockStorage = { getItem: jest.fn() } as any;

const defaultStartDeps = {
Expand All @@ -112,6 +113,7 @@ const defaultStartDeps = {
overlays: overlayStart,
uiSettings: uiSettingsStart,
savedObjects: savedObjectsStart,
fatalErrors: fatalErrorsStart,
},
lastSubUrlStorage: mockStorage,
targetDomElement: document.createElement('div'),
Expand Down
1 change: 1 addition & 0 deletions src/core/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function createCoreStartMock({ basePath = '' } = {}) {
injectedMetadata: {
getInjectedVar: injectedMetadataServiceMock.createStartContract().getInjectedVar,
},
fatalErrors: fatalErrorsServiceMock.createStartContract(),
};

return mock;
Expand Down
1 change: 1 addition & 0 deletions src/core/public/plugins/plugin_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,6 @@ export function createPluginStartContext<
injectedMetadata: {
getInjectedVar: deps.injectedMetadata.getInjectedVar,
},
fatalErrors: deps.fatalErrors,
};
}
1 change: 1 addition & 0 deletions src/core/public/plugins/plugins_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ describe('PluginsService', () => {
overlays: overlayServiceMock.createStartContract(),
uiSettings: uiSettingsServiceMock.createStartContract(),
savedObjects: savedObjectsMock.createStartContract(),
fatalErrors: fatalErrorsServiceMock.createStartContract(),
};
mockStartContext = {
...mockStartDeps,
Expand Down
Loading

0 comments on commit e20a6de

Please sign in to comment.