mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
parent
03a2b641f9
commit
7268054451
52 changed files with 210 additions and 405 deletions
|
@ -1,12 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [ChromeSetup](./kibana-plugin-public.chromesetup.md)
|
||||
|
||||
## ChromeSetup type
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type ChromeSetup = ReturnType<ChromeService['setup']>;
|
||||
```
|
|
@ -1,13 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [CoreSetup](./kibana-plugin-public.coresetup.md) > [chrome](./kibana-plugin-public.coresetup.chrome.md)
|
||||
|
||||
## CoreSetup.chrome property
|
||||
|
||||
[ChromeSetup](./kibana-plugin-public.chromesetup.md)
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
chrome: ChromeSetup;
|
||||
```
|
|
@ -1,13 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [CoreSetup](./kibana-plugin-public.coresetup.md) > [i18n](./kibana-plugin-public.coresetup.i18n.md)
|
||||
|
||||
## CoreSetup.i18n property
|
||||
|
||||
[I18nSetup](./kibana-plugin-public.i18nsetup.md)
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
i18n: I18nSetup;
|
||||
```
|
|
@ -16,10 +16,8 @@ export interface CoreSetup
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [chrome](./kibana-plugin-public.coresetup.chrome.md) | <code>ChromeSetup</code> | [ChromeSetup](./kibana-plugin-public.chromesetup.md) |
|
||||
| [fatalErrors](./kibana-plugin-public.coresetup.fatalerrors.md) | <code>FatalErrorsSetup</code> | [FatalErrorsSetup](./kibana-plugin-public.fatalerrorssetup.md) |
|
||||
| [http](./kibana-plugin-public.coresetup.http.md) | <code>HttpSetup</code> | [HttpSetup](./kibana-plugin-public.httpsetup.md) |
|
||||
| [i18n](./kibana-plugin-public.coresetup.i18n.md) | <code>I18nSetup</code> | [I18nSetup](./kibana-plugin-public.i18nsetup.md) |
|
||||
| [notifications](./kibana-plugin-public.coresetup.notifications.md) | <code>NotificationsSetup</code> | [NotificationsSetup](./kibana-plugin-public.notificationssetup.md) |
|
||||
| [uiSettings](./kibana-plugin-public.coresetup.uisettings.md) | <code>UiSettingsSetup</code> | [UiSettingsSetup](./kibana-plugin-public.uisettingssetup.md) |
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [I18nSetup](./kibana-plugin-public.i18nsetup.md)
|
||||
|
||||
## I18nSetup interface
|
||||
|
||||
I18nSetup.Context is required by any localizable React component from @<!-- -->kbn/i18n and @<!-- -->elastic/eui packages and is supposed to be used as the topmost component for any i18n-compatible React tree.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface I18nSetup
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [Context](./kibana-plugin-public.i18nsetup.context.md) | <code>({ children }: {</code><br/><code> children: React.ReactNode;</code><br/><code> }) => JSX.Element</code> | React Context provider required as the topmost component for any i18n-compatible React tree. |
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [I18nSetup](./kibana-plugin-public.i18nsetup.md) > [Context](./kibana-plugin-public.i18nsetup.context.md)
|
||||
[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [I18nStart](./kibana-plugin-public.i18nstart.md) > [Context](./kibana-plugin-public.i18nstart.context.md)
|
||||
|
||||
## I18nSetup.Context property
|
||||
## I18nStart.Context property
|
||||
|
||||
React Context provider required as the topmost component for any i18n-compatible React tree.
|
||||
|
|
@ -2,11 +2,19 @@
|
|||
|
||||
[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [I18nStart](./kibana-plugin-public.i18nstart.md)
|
||||
|
||||
## I18nStart type
|
||||
## I18nStart interface
|
||||
|
||||
I18nStart.Context is required by any localizable React component from @<!-- -->kbn/i18n and @<!-- -->elastic/eui packages and is supposed to be used as the topmost component for any i18n-compatible React tree.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type I18nStart = I18nSetup;
|
||||
export interface I18nStart
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [Context](./kibana-plugin-public.i18nstart.context.md) | <code>({ children }: {</code><br/><code> children: React.ReactNode;</code><br/><code> }) => JSX.Element</code> | React Context provider required as the topmost component for any i18n-compatible React tree. |
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [FatalErrorsSetup](./kibana-plugin-public.fatalerrorssetup.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. |
|
||||
| [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md) | |
|
||||
| [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) | |
|
||||
| [I18nSetup](./kibana-plugin-public.i18nsetup.md) | I18nSetup.Context is required by any localizable React component from @<!-- -->kbn/i18n and @<!-- -->elastic/eui packages and is supposed to be used as the topmost component for any i18n-compatible React tree. |
|
||||
| [I18nStart](./kibana-plugin-public.i18nstart.md) | I18nStart.Context is required by any localizable React component from @<!-- -->kbn/i18n and @<!-- -->elastic/eui packages and is supposed to be used as the topmost component for any i18n-compatible React tree. |
|
||||
| [LegacyNavLink](./kibana-plugin-public.legacynavlink.md) | |
|
||||
| [NotificationsSetup](./kibana-plugin-public.notificationssetup.md) | |
|
||||
| [NotificationsStart](./kibana-plugin-public.notificationsstart.md) | |
|
||||
|
@ -50,11 +50,9 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| Type Alias | Description |
|
||||
| --- | --- |
|
||||
| [ChromeHelpExtension](./kibana-plugin-public.chromehelpextension.md) | |
|
||||
| [ChromeSetup](./kibana-plugin-public.chromesetup.md) | |
|
||||
| [ChromeStart](./kibana-plugin-public.chromestart.md) | |
|
||||
| [HttpSetup](./kibana-plugin-public.httpsetup.md) | |
|
||||
| [HttpStart](./kibana-plugin-public.httpstart.md) | |
|
||||
| [I18nStart](./kibana-plugin-public.i18nstart.md) | |
|
||||
| [PluginInitializer](./kibana-plugin-public.plugininitializer.md) | The <code>plugin</code> export at the root of a plugin's <code>public</code> directory should conform to this interface. |
|
||||
| [RecursiveReadonly](./kibana-plugin-public.recursivereadonly.md) | |
|
||||
| [ToastInput](./kibana-plugin-public.toastinput.md) | |
|
||||
|
|
|
@ -11,7 +11,6 @@ Constructs a new instance of the `ToastsApi` class
|
|||
```typescript
|
||||
constructor(deps: {
|
||||
uiSettings: UiSettingsSetup;
|
||||
i18n: I18nSetup;
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -19,5 +18,5 @@ constructor(deps: {
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| deps | <code>{</code><br/><code> uiSettings: UiSettingsSetup;</code><br/><code> i18n: I18nSetup;</code><br/><code> }</code> | |
|
||||
| deps | <code>{</code><br/><code> uiSettings: UiSettingsSetup;</code><br/><code> }</code> | |
|
||||
|
||||
|
|
|
@ -22,12 +22,21 @@ import {
|
|||
ChromeBrand,
|
||||
ChromeBreadcrumb,
|
||||
ChromeService,
|
||||
ChromeSetup,
|
||||
ChromeStart,
|
||||
} from './chrome_service';
|
||||
|
||||
const createSetupContractMock = () => {
|
||||
const setupContract: jest.Mocked<ChromeSetup> = {
|
||||
const createStartContractMock = () => {
|
||||
const setupContract: jest.Mocked<ChromeStart> = {
|
||||
navLinks: {
|
||||
getNavLinks$: jest.fn(),
|
||||
has: jest.fn(),
|
||||
get: jest.fn(),
|
||||
getAll: jest.fn(),
|
||||
showOnly: jest.fn(),
|
||||
update: jest.fn(),
|
||||
enableForcedAppSwitcherNavigation: jest.fn(),
|
||||
getForceAppSwitcherNavigation$: jest.fn(),
|
||||
},
|
||||
setBrand: jest.fn(),
|
||||
getBrand$: jest.fn(),
|
||||
setIsVisible: jest.fn(),
|
||||
|
@ -54,34 +63,17 @@ const createSetupContractMock = () => {
|
|||
return setupContract;
|
||||
};
|
||||
|
||||
const createStartContractMock = (): jest.Mocked<ChromeStart> => ({
|
||||
navLinks: {
|
||||
getNavLinks$: jest.fn(),
|
||||
clear: jest.fn(),
|
||||
has: jest.fn(),
|
||||
get: jest.fn(),
|
||||
getAll: jest.fn(),
|
||||
showOnly: jest.fn(),
|
||||
update: jest.fn(),
|
||||
enableForcedAppSwitcherNavigation: jest.fn(),
|
||||
getForceAppSwitcherNavigation$: jest.fn(),
|
||||
},
|
||||
});
|
||||
|
||||
type ChromeServiceContract = PublicMethodsOf<ChromeService>;
|
||||
const createMock = () => {
|
||||
const mocked: jest.Mocked<ChromeServiceContract> = {
|
||||
setup: jest.fn(),
|
||||
start: jest.fn(),
|
||||
stop: jest.fn(),
|
||||
};
|
||||
mocked.setup.mockReturnValue(createSetupContractMock());
|
||||
mocked.start.mockReturnValue(createStartContractMock());
|
||||
return mocked;
|
||||
};
|
||||
|
||||
export const chromeServiceMock = {
|
||||
create: createMock,
|
||||
createSetupContract: createSetupContractMock,
|
||||
createStartContract: createStartContractMock,
|
||||
};
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
import * as Rx from 'rxjs';
|
||||
import { toArray } from 'rxjs/operators';
|
||||
|
||||
import { applicationServiceMock } from '../application/application_service.mock';
|
||||
import { httpServiceMock } from '../http/http_service.mock';
|
||||
import { injectedMetadataServiceMock } from '../injected_metadata/injected_metadata_service.mock';
|
||||
import { notificationServiceMock } from '../notifications/notifications_service.mock';
|
||||
|
||||
|
@ -32,10 +34,12 @@ const store = new Map();
|
|||
|
||||
import { ChromeService } from './chrome_service';
|
||||
|
||||
function defaultSetupDeps(): any {
|
||||
function defaultStartDeps(): any {
|
||||
return {
|
||||
notifications: notificationServiceMock.createSetupContract(),
|
||||
injectedMetadata: injectedMetadataServiceMock.createSetupContract(),
|
||||
application: applicationServiceMock.createStartContract(),
|
||||
http: httpServiceMock.createStartContract(),
|
||||
notifications: notificationServiceMock.createStartContract(),
|
||||
injectedMetadata: injectedMetadataServiceMock.createStartContract(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -43,13 +47,13 @@ beforeEach(() => {
|
|||
store.clear();
|
||||
});
|
||||
|
||||
describe('setup', () => {
|
||||
describe('start', () => {
|
||||
it('adds legacy browser warning if browserSupportsCsp is disabled and warnLegacyBrowsers is enabled', () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: false });
|
||||
const setupDeps = defaultSetupDeps();
|
||||
setupDeps.injectedMetadata.getCspConfig.mockReturnValue({ warnLegacyBrowsers: true });
|
||||
service.setup(setupDeps);
|
||||
expect(setupDeps.notifications.toasts.addWarning.mock.calls).toMatchInlineSnapshot(`
|
||||
const startDeps = defaultStartDeps();
|
||||
startDeps.injectedMetadata.getCspConfig.mockReturnValue({ warnLegacyBrowsers: true });
|
||||
service.start(startDeps);
|
||||
expect(startDeps.notifications.toasts.addWarning.mock.calls).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Array [
|
||||
"Your browser does not meet the security requirements for Kibana.",
|
||||
|
@ -60,34 +64,34 @@ Array [
|
|||
|
||||
it('does not add legacy browser warning if browser supports CSP', () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setupDeps = defaultSetupDeps();
|
||||
setupDeps.injectedMetadata.getCspConfig.mockReturnValue({ warnLegacyBrowsers: true });
|
||||
service.setup(setupDeps);
|
||||
expect(setupDeps.notifications.toasts.addWarning).not.toBeCalled();
|
||||
const startDeps = defaultStartDeps();
|
||||
startDeps.injectedMetadata.getCspConfig.mockReturnValue({ warnLegacyBrowsers: true });
|
||||
service.start(startDeps);
|
||||
expect(startDeps.notifications.toasts.addWarning).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('does not add legacy browser warning if warnLegacyBrowsers is disabled', () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: false });
|
||||
const setupDeps = defaultSetupDeps();
|
||||
setupDeps.injectedMetadata.getCspConfig.mockReturnValue({ warnLegacyBrowsers: false });
|
||||
service.setup(setupDeps);
|
||||
expect(setupDeps.notifications.toasts.addWarning).not.toBeCalled();
|
||||
const startDeps = defaultStartDeps();
|
||||
startDeps.injectedMetadata.getCspConfig.mockReturnValue({ warnLegacyBrowsers: false });
|
||||
service.start(startDeps);
|
||||
expect(startDeps.notifications.toasts.addWarning).not.toBeCalled();
|
||||
});
|
||||
|
||||
describe('brand', () => {
|
||||
it('updates/emits the brand as it changes', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const promise = setup
|
||||
const start = service.start(defaultStartDeps());
|
||||
const promise = start
|
||||
.getBrand$()
|
||||
.pipe(toArray())
|
||||
.toPromise();
|
||||
|
||||
setup.setBrand({
|
||||
start.setBrand({
|
||||
logo: 'big logo',
|
||||
smallLogo: 'not so big logo',
|
||||
});
|
||||
setup.setBrand({
|
||||
start.setBrand({
|
||||
logo: 'big logo without small logo',
|
||||
});
|
||||
service.stop();
|
||||
|
@ -111,15 +115,15 @@ Array [
|
|||
describe('visibility', () => {
|
||||
it('updates/emits the visibility', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const promise = setup
|
||||
const start = service.start(defaultStartDeps());
|
||||
const promise = start
|
||||
.getIsVisible$()
|
||||
.pipe(toArray())
|
||||
.toPromise();
|
||||
|
||||
setup.setIsVisible(true);
|
||||
setup.setIsVisible(false);
|
||||
setup.setIsVisible(true);
|
||||
start.setIsVisible(true);
|
||||
start.setIsVisible(false);
|
||||
start.setIsVisible(true);
|
||||
service.stop();
|
||||
|
||||
await expect(promise).resolves.toMatchInlineSnapshot(`
|
||||
|
@ -136,15 +140,15 @@ Array [
|
|||
window.history.pushState(undefined, '', '#/home?a=b&embed=true');
|
||||
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const promise = setup
|
||||
const start = service.start(defaultStartDeps());
|
||||
const promise = start
|
||||
.getIsVisible$()
|
||||
.pipe(toArray())
|
||||
.toPromise();
|
||||
|
||||
setup.setIsVisible(true);
|
||||
setup.setIsVisible(false);
|
||||
setup.setIsVisible(true);
|
||||
start.setIsVisible(true);
|
||||
start.setIsVisible(false);
|
||||
start.setIsVisible(true);
|
||||
service.stop();
|
||||
|
||||
await expect(promise).resolves.toMatchInlineSnapshot(`
|
||||
|
@ -161,15 +165,15 @@ Array [
|
|||
describe('is collapsed', () => {
|
||||
it('updates/emits isCollapsed', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const promise = setup
|
||||
const start = service.start(defaultStartDeps());
|
||||
const promise = start
|
||||
.getIsCollapsed$()
|
||||
.pipe(toArray())
|
||||
.toPromise();
|
||||
|
||||
setup.setIsCollapsed(true);
|
||||
setup.setIsCollapsed(false);
|
||||
setup.setIsCollapsed(true);
|
||||
start.setIsCollapsed(true);
|
||||
start.setIsCollapsed(false);
|
||||
start.setIsCollapsed(true);
|
||||
service.stop();
|
||||
|
||||
await expect(promise).resolves.toMatchInlineSnapshot(`
|
||||
|
@ -184,12 +188,12 @@ Array [
|
|||
|
||||
it('only stores true in localStorage', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const start = service.start(defaultStartDeps());
|
||||
|
||||
setup.setIsCollapsed(true);
|
||||
start.setIsCollapsed(true);
|
||||
expect(store.size).toBe(1);
|
||||
|
||||
setup.setIsCollapsed(false);
|
||||
start.setIsCollapsed(false);
|
||||
expect(store.size).toBe(0);
|
||||
});
|
||||
});
|
||||
|
@ -197,19 +201,19 @@ Array [
|
|||
describe('application classes', () => {
|
||||
it('updates/emits the application classes', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const promise = setup
|
||||
const start = service.start(defaultStartDeps());
|
||||
const promise = start
|
||||
.getApplicationClasses$()
|
||||
.pipe(toArray())
|
||||
.toPromise();
|
||||
|
||||
setup.addApplicationClass('foo');
|
||||
setup.addApplicationClass('foo');
|
||||
setup.addApplicationClass('bar');
|
||||
setup.addApplicationClass('bar');
|
||||
setup.addApplicationClass('baz');
|
||||
setup.removeApplicationClass('bar');
|
||||
setup.removeApplicationClass('foo');
|
||||
start.addApplicationClass('foo');
|
||||
start.addApplicationClass('foo');
|
||||
start.addApplicationClass('bar');
|
||||
start.addApplicationClass('bar');
|
||||
start.addApplicationClass('baz');
|
||||
start.removeApplicationClass('bar');
|
||||
start.removeApplicationClass('foo');
|
||||
service.stop();
|
||||
|
||||
await expect(promise).resolves.toMatchInlineSnapshot(`
|
||||
|
@ -249,15 +253,15 @@ Array [
|
|||
describe('badge', () => {
|
||||
it('updates/emits the current badge', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const promise = setup
|
||||
const start = service.start(defaultStartDeps());
|
||||
const promise = start
|
||||
.getBadge$()
|
||||
.pipe(toArray())
|
||||
.toPromise();
|
||||
|
||||
setup.setBadge({ text: 'foo', tooltip: `foo's tooltip` });
|
||||
setup.setBadge({ text: 'bar', tooltip: `bar's tooltip` });
|
||||
setup.setBadge(undefined);
|
||||
start.setBadge({ text: 'foo', tooltip: `foo's tooltip` });
|
||||
start.setBadge({ text: 'bar', tooltip: `bar's tooltip` });
|
||||
start.setBadge(undefined);
|
||||
service.stop();
|
||||
|
||||
await expect(promise).resolves.toMatchInlineSnapshot(`
|
||||
|
@ -280,16 +284,16 @@ Array [
|
|||
describe('breadcrumbs', () => {
|
||||
it('updates/emits the current set of breadcrumbs', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const promise = setup
|
||||
const start = service.start(defaultStartDeps());
|
||||
const promise = start
|
||||
.getBreadcrumbs$()
|
||||
.pipe(toArray())
|
||||
.toPromise();
|
||||
|
||||
setup.setBreadcrumbs([{ text: 'foo' }, { text: 'bar' }]);
|
||||
setup.setBreadcrumbs([{ text: 'foo' }]);
|
||||
setup.setBreadcrumbs([{ text: 'bar' }]);
|
||||
setup.setBreadcrumbs([]);
|
||||
start.setBreadcrumbs([{ text: 'foo' }, { text: 'bar' }]);
|
||||
start.setBreadcrumbs([{ text: 'foo' }]);
|
||||
start.setBreadcrumbs([{ text: 'bar' }]);
|
||||
start.setBreadcrumbs([]);
|
||||
service.stop();
|
||||
|
||||
await expect(promise).resolves.toMatchInlineSnapshot(`
|
||||
|
@ -322,14 +326,14 @@ Array [
|
|||
describe('help extension', () => {
|
||||
it('updates/emits the current help extension', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const promise = setup
|
||||
const start = service.start(defaultStartDeps());
|
||||
const promise = start
|
||||
.getHelpExtension$()
|
||||
.pipe(toArray())
|
||||
.toPromise();
|
||||
|
||||
setup.setHelpExtension(() => () => undefined);
|
||||
setup.setHelpExtension(undefined);
|
||||
start.setHelpExtension(() => () => undefined);
|
||||
start.setHelpExtension(undefined);
|
||||
service.stop();
|
||||
|
||||
await expect(promise).resolves.toMatchInlineSnapshot(`
|
||||
|
@ -346,14 +350,14 @@ Array [
|
|||
describe('stop', () => {
|
||||
it('completes applicationClass$, isCollapsed$, breadcrumbs$, isVisible$, and brand$ observables', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const start = service.start(defaultStartDeps());
|
||||
const promise = Rx.combineLatest(
|
||||
setup.getBrand$(),
|
||||
setup.getApplicationClasses$(),
|
||||
setup.getIsCollapsed$(),
|
||||
setup.getBreadcrumbs$(),
|
||||
setup.getIsVisible$(),
|
||||
setup.getHelpExtension$()
|
||||
start.getBrand$(),
|
||||
start.getApplicationClasses$(),
|
||||
start.getIsCollapsed$(),
|
||||
start.getBreadcrumbs$(),
|
||||
start.getIsVisible$(),
|
||||
start.getHelpExtension$()
|
||||
).toPromise();
|
||||
|
||||
service.stop();
|
||||
|
@ -362,17 +366,17 @@ describe('stop', () => {
|
|||
|
||||
it('completes immediately if service already stopped', async () => {
|
||||
const service = new ChromeService({ browserSupportsCsp: true });
|
||||
const setup = service.setup(defaultSetupDeps());
|
||||
const start = service.start(defaultStartDeps());
|
||||
service.stop();
|
||||
|
||||
await expect(
|
||||
Rx.combineLatest(
|
||||
setup.getBrand$(),
|
||||
setup.getApplicationClasses$(),
|
||||
setup.getIsCollapsed$(),
|
||||
setup.getBreadcrumbs$(),
|
||||
setup.getIsVisible$(),
|
||||
setup.getHelpExtension$()
|
||||
start.getBrand$(),
|
||||
start.getApplicationClasses$(),
|
||||
start.getIsCollapsed$(),
|
||||
start.getBreadcrumbs$(),
|
||||
start.getIsVisible$(),
|
||||
start.getHelpExtension$()
|
||||
).toPromise()
|
||||
).resolves.toBe(undefined);
|
||||
});
|
||||
|
|
|
@ -23,8 +23,8 @@ import { i18n } from '@kbn/i18n';
|
|||
import * as Rx from 'rxjs';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { IconType } from '@elastic/eui';
|
||||
import { InjectedMetadataSetup } from '../injected_metadata';
|
||||
import { NotificationsSetup } from '../notifications';
|
||||
import { InjectedMetadataStart } from '../injected_metadata';
|
||||
import { NotificationsStart } from '../notifications';
|
||||
import { NavLinksService } from './nav_links/nav_links_service';
|
||||
import { ApplicationStart } from '../application';
|
||||
import { HttpStart } from '../http';
|
||||
|
@ -63,14 +63,11 @@ interface ConstructorParams {
|
|||
browserSupportsCsp: boolean;
|
||||
}
|
||||
|
||||
interface SetupDeps {
|
||||
injectedMetadata: InjectedMetadataSetup;
|
||||
notifications: NotificationsSetup;
|
||||
}
|
||||
|
||||
interface StartDeps {
|
||||
application: ApplicationStart;
|
||||
http: HttpStart;
|
||||
injectedMetadata: InjectedMetadataStart;
|
||||
notifications: NotificationsStart;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
@ -83,7 +80,7 @@ export class ChromeService {
|
|||
this.browserSupportsCsp = browserSupportsCsp;
|
||||
}
|
||||
|
||||
public setup({ injectedMetadata, notifications }: SetupDeps) {
|
||||
public start({ application, http, injectedMetadata, notifications }: StartDeps) {
|
||||
const FORCE_HIDDEN = isEmbedParamInHash();
|
||||
|
||||
const brand$ = new Rx.BehaviorSubject<ChromeBrand>({});
|
||||
|
@ -103,6 +100,8 @@ export class ChromeService {
|
|||
}
|
||||
|
||||
return {
|
||||
navLinks: this.navLinks.start({ application, http }),
|
||||
|
||||
/**
|
||||
* Set the brand configuration. Normally the `logo` property will be rendered as the
|
||||
* CSS background for the home link in the chrome navigation, but when the page is
|
||||
|
@ -230,20 +229,11 @@ export class ChromeService {
|
|||
};
|
||||
}
|
||||
|
||||
public start({ application, http }: StartDeps) {
|
||||
return {
|
||||
navLinks: this.navLinks.start({ application, http }),
|
||||
};
|
||||
}
|
||||
|
||||
public stop() {
|
||||
this.navLinks.stop();
|
||||
this.stop$.next();
|
||||
}
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export type ChromeSetup = ReturnType<ChromeService['setup']>;
|
||||
|
||||
/** @public */
|
||||
export type ChromeStart = ReturnType<ChromeService['start']>;
|
||||
|
|
|
@ -21,7 +21,6 @@ export {
|
|||
ChromeBadge,
|
||||
ChromeBreadcrumb,
|
||||
ChromeService,
|
||||
ChromeSetup,
|
||||
ChromeStart,
|
||||
ChromeBrand,
|
||||
ChromeHelpExtension,
|
||||
|
|
|
@ -171,11 +171,6 @@ describe('#setup()', () => {
|
|||
expect(MockUiSettingsService.setup).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('calls i18n#setup()', async () => {
|
||||
await setupCore();
|
||||
expect(MockI18nService.setup).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('calls fatalErrors#setup()', async () => {
|
||||
await setupCore();
|
||||
expect(MockFatalErrorsService.setup).toHaveBeenCalledTimes(1);
|
||||
|
@ -186,11 +181,6 @@ describe('#setup()', () => {
|
|||
expect(MockNotificationsService.setup).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('calls chrome#setup()', async () => {
|
||||
await setupCore();
|
||||
expect(MockChromeService.setup).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('calls plugin#setup()', async () => {
|
||||
await setupCore();
|
||||
expect(MockPluginsService.setup).toHaveBeenCalledTimes(1);
|
||||
|
|
|
@ -111,21 +111,20 @@ export class CoreSystem {
|
|||
try {
|
||||
// Setup FatalErrorsService and it's dependencies first so that we're
|
||||
// able to render any errors.
|
||||
const i18n = this.i18n.setup();
|
||||
const injectedMetadata = this.injectedMetadata.setup();
|
||||
this.fatalErrorsSetup = this.fatalErrors.setup({ injectedMetadata, i18n });
|
||||
this.fatalErrorsSetup = this.fatalErrors.setup({
|
||||
injectedMetadata,
|
||||
i18n: this.i18n.getContext(),
|
||||
});
|
||||
const http = this.http.setup({ injectedMetadata, fatalErrors: this.fatalErrorsSetup });
|
||||
const uiSettings = this.uiSettings.setup({ http, injectedMetadata });
|
||||
const notifications = this.notifications.setup({ uiSettings, i18n });
|
||||
const notifications = this.notifications.setup({ uiSettings });
|
||||
const application = this.application.setup();
|
||||
const chrome = this.chrome.setup({ injectedMetadata, notifications });
|
||||
|
||||
const core: InternalCoreSetup = {
|
||||
application,
|
||||
chrome,
|
||||
fatalErrors: this.fatalErrorsSetup,
|
||||
http,
|
||||
i18n,
|
||||
injectedMetadata,
|
||||
notifications,
|
||||
uiSettings,
|
||||
|
@ -153,7 +152,6 @@ export class CoreSystem {
|
|||
const http = await this.http.start({ injectedMetadata, fatalErrors: this.fatalErrorsSetup });
|
||||
const i18n = await this.i18n.start();
|
||||
const application = await this.application.start({ injectedMetadata });
|
||||
const chrome = await this.chrome.start({ application, http });
|
||||
|
||||
const notificationsTargetDomElement = document.createElement('div');
|
||||
const overlayTargetDomElement = document.createElement('div');
|
||||
|
@ -172,6 +170,12 @@ export class CoreSystem {
|
|||
overlays,
|
||||
targetDomElement: notificationsTargetDomElement,
|
||||
});
|
||||
const chrome = await this.chrome.start({
|
||||
application,
|
||||
http,
|
||||
injectedMetadata,
|
||||
notifications,
|
||||
});
|
||||
|
||||
const core: InternalCoreStart = {
|
||||
application,
|
||||
|
|
|
@ -22,13 +22,13 @@ import { render } from 'react-dom';
|
|||
import * as Rx from 'rxjs';
|
||||
import { first, tap } from 'rxjs/operators';
|
||||
|
||||
import { I18nSetup } from '../i18n';
|
||||
import { I18nStart } from '../i18n';
|
||||
import { InjectedMetadataSetup } from '../injected_metadata';
|
||||
import { FatalErrorsScreen } from './fatal_errors_screen';
|
||||
import { FatalErrorInfo, getErrorInfo } from './get_error_info';
|
||||
|
||||
interface Deps {
|
||||
i18n: I18nSetup;
|
||||
i18n: I18nStart;
|
||||
injectedMetadata: InjectedMetadataSetup;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ export class FatalErrorsService {
|
|||
return fatalErrorsSetup;
|
||||
}
|
||||
|
||||
private renderError(injectedMetadata: InjectedMetadataSetup, i18n: I18nSetup) {
|
||||
private renderError(injectedMetadata: InjectedMetadataSetup, i18n: I18nStart) {
|
||||
// delete all content in the rootDomElement
|
||||
this.rootDomElement.textContent = '';
|
||||
|
||||
|
|
|
@ -1,67 +1,5 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`#setup() returns \`Context\` component 1`] = `
|
||||
<MockI18nProvider>
|
||||
<MockEuiContext
|
||||
i18n={
|
||||
Object {
|
||||
"mapping": Object {
|
||||
"euiBasicTable.selectAllRows": "Select all rows",
|
||||
"euiBasicTable.selectThisRow": "Select this row",
|
||||
"euiBasicTable.tableDescription": [Function],
|
||||
"euiBottomBar.screenReaderAnnouncement": "There is a new menu opening with page level controls at the end of the document.",
|
||||
"euiCodeBlock.copyButton": "Copy",
|
||||
"euiCodeEditor.startEditing": "Press Enter to start editing.",
|
||||
"euiCodeEditor.startInteracting": "Press Enter to start interacting with the code.",
|
||||
"euiCodeEditor.stopEditing": "When you're done, press Escape to stop editing.",
|
||||
"euiCodeEditor.stopInteracting": "When you're done, press Escape to stop interacting with the code.",
|
||||
"euiCollapsedItemActions.allActions": "All actions",
|
||||
"euiColorPicker.colorSelectionLabel": [Function],
|
||||
"euiColorPicker.transparentColor": "transparent",
|
||||
"euiComboBoxOptionsList.allOptionsSelected": "You've selected all available options",
|
||||
"euiComboBoxOptionsList.alreadyAdded": [Function],
|
||||
"euiComboBoxOptionsList.createCustomOption": [Function],
|
||||
"euiComboBoxOptionsList.loadingOptions": "Loading options",
|
||||
"euiComboBoxOptionsList.noAvailableOptions": "There aren't any options available",
|
||||
"euiComboBoxOptionsList.noMatchingOptions": [Function],
|
||||
"euiComboBoxPill.removeSelection": [Function],
|
||||
"euiForm.addressFormErrors": "Please address the errors in your form.",
|
||||
"euiFormControlLayoutClearButton.label": "Clear input",
|
||||
"euiHeaderAlert.dismiss": "Dismiss",
|
||||
"euiHeaderLinks.appNavigation": "App navigation",
|
||||
"euiHeaderLinks.openNavigationMenu": "Open navigation menu",
|
||||
"euiModal.closeModal": "Closes this modal window",
|
||||
"euiPagination.jumpToLastPage": [Function],
|
||||
"euiPagination.nextPage": "Next page",
|
||||
"euiPagination.pageOfTotal": [Function],
|
||||
"euiPagination.previousPage": "Previous page",
|
||||
"euiPopover.screenReaderAnnouncement": "You are in a popup. To exit this popup, hit Escape.",
|
||||
"euiSelectable.loadingOptions": "Loading options",
|
||||
"euiSelectable.noAvailableOptions": "There aren't any options available",
|
||||
"euiSelectable.noMatchingOptions": [Function],
|
||||
"euiStep.completeStep": "Step",
|
||||
"euiStep.incompleteStep": "Incomplete Step",
|
||||
"euiStepHorizontal.buttonTitle": [Function],
|
||||
"euiStepHorizontal.step": "Step",
|
||||
"euiStepNumber.hasErrors": "has errors",
|
||||
"euiStepNumber.hasWarnings": "has warnings",
|
||||
"euiStepNumber.isComplete": "complete",
|
||||
"euiSuperSelect.screenReaderAnnouncement": [Function],
|
||||
"euiSuperSelectControl.selectAnOption": [Function],
|
||||
"euiTablePagination.rowsPerPage": "Rows per page",
|
||||
"euiTableSortMobile.sorting": "Sorting",
|
||||
"euiToast.dismissToast": "Dismiss toast",
|
||||
"euiToast.newNotification": "A new notification appears",
|
||||
"euiToast.notification": "Notification",
|
||||
},
|
||||
}
|
||||
}
|
||||
>
|
||||
content
|
||||
</MockEuiContext>
|
||||
</MockI18nProvider>
|
||||
`;
|
||||
|
||||
exports[`#start() returns \`Context\` component 1`] = `
|
||||
<MockI18nProvider>
|
||||
<MockEuiContext
|
||||
|
|
|
@ -18,35 +18,31 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { I18nService, I18nSetup } from './i18n_service';
|
||||
import { I18nService, I18nStart } from './i18n_service';
|
||||
|
||||
const PassThroughComponent = ({ children }: { children: React.ReactNode }) => children;
|
||||
|
||||
const createSetupContractMock = () => {
|
||||
const setupContract: jest.Mocked<I18nSetup> = {
|
||||
const createStartContractMock = () => {
|
||||
const setupContract: jest.Mocked<I18nStart> = {
|
||||
// By default mock the Context component so it simply renders all children
|
||||
Context: jest.fn().mockImplementation(PassThroughComponent),
|
||||
};
|
||||
return setupContract;
|
||||
};
|
||||
|
||||
// Start contract is identical to setup
|
||||
const createStartContractMock = createSetupContractMock;
|
||||
|
||||
type I18nServiceContract = PublicMethodsOf<I18nService>;
|
||||
const createMock = () => {
|
||||
const mocked: jest.Mocked<I18nServiceContract> = {
|
||||
setup: jest.fn(),
|
||||
getContext: jest.fn(),
|
||||
start: jest.fn(),
|
||||
stop: jest.fn(),
|
||||
};
|
||||
mocked.setup.mockReturnValue(createSetupContractMock());
|
||||
mocked.getContext.mockReturnValue(createStartContractMock());
|
||||
mocked.start.mockReturnValue(createStartContractMock());
|
||||
return mocked;
|
||||
};
|
||||
|
||||
export const i18nServiceMock = {
|
||||
create: createMock,
|
||||
createSetupContract: createSetupContractMock,
|
||||
createStartContract: createStartContractMock,
|
||||
};
|
||||
|
|
|
@ -44,16 +44,6 @@ afterEach(() => {
|
|||
jest.resetModules();
|
||||
});
|
||||
|
||||
describe('#setup()', () => {
|
||||
it('returns `Context` component', () => {
|
||||
const i18nService = new I18nService();
|
||||
|
||||
const i18n = i18nService.setup();
|
||||
|
||||
expect(shallow(<i18n.Context>content</i18n.Context>)).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('#start()', () => {
|
||||
it('returns `Context` component', () => {
|
||||
const i18nService = new I18nService();
|
||||
|
|
|
@ -32,7 +32,15 @@ interface EuiValues {
|
|||
* @internal
|
||||
*/
|
||||
export class I18nService {
|
||||
public setup() {
|
||||
/**
|
||||
* Used exclusively to give a Context component to FatalErrorsService which
|
||||
* may render before Core successfully sets up or starts.
|
||||
*
|
||||
* Separated from `start` to disambiguate that this can be called from within
|
||||
* Core outside the lifecycle flow.
|
||||
* @internal
|
||||
*/
|
||||
public getContext(): I18nStart {
|
||||
const mapping = {
|
||||
'euiBasicTable.selectAllRows': i18n.translate('core.euiBasicTable.selectAllRows', {
|
||||
defaultMessage: 'Select all rows',
|
||||
|
@ -268,7 +276,7 @@ export class I18nService {
|
|||
}),
|
||||
};
|
||||
|
||||
const setup: I18nSetup = {
|
||||
return {
|
||||
Context: function I18nContext({ children }) {
|
||||
return (
|
||||
<I18nProvider>
|
||||
|
@ -277,12 +285,10 @@ export class I18nService {
|
|||
);
|
||||
},
|
||||
};
|
||||
|
||||
return setup;
|
||||
}
|
||||
|
||||
public start() {
|
||||
return this.setup();
|
||||
public start(): I18nStart {
|
||||
return this.getContext();
|
||||
}
|
||||
|
||||
public stop() {
|
||||
|
@ -291,20 +297,15 @@ export class I18nService {
|
|||
}
|
||||
|
||||
/**
|
||||
* I18nSetup.Context is required by any localizable React component from \@kbn/i18n and \@elastic/eui packages
|
||||
* I18nStart.Context is required by any localizable React component from \@kbn/i18n and \@elastic/eui packages
|
||||
* and is supposed to be used as the topmost component for any i18n-compatible React tree.
|
||||
*
|
||||
* @public
|
||||
*
|
||||
*/
|
||||
export interface I18nSetup {
|
||||
export interface I18nStart {
|
||||
/**
|
||||
* React Context provider required as the topmost component for any i18n-compatible React tree.
|
||||
*/
|
||||
Context: ({ children }: { children: React.ReactNode }) => JSX.Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type I18nStart = I18nSetup;
|
||||
|
|
|
@ -17,4 +17,4 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
export { I18nService, I18nSetup, I18nStart } from './i18n_service';
|
||||
export { I18nService, I18nStart } from './i18n_service';
|
||||
|
|
|
@ -41,12 +41,11 @@ import {
|
|||
ChromeBreadcrumb,
|
||||
ChromeHelpExtension,
|
||||
ChromeNavLink,
|
||||
ChromeSetup,
|
||||
ChromeStart,
|
||||
} from './chrome';
|
||||
import { FatalErrorsSetup, FatalErrorInfo } from './fatal_errors';
|
||||
import { HttpServiceBase, HttpSetup, HttpStart, HttpInterceptor } from './http';
|
||||
import { I18nSetup, I18nStart } from './i18n';
|
||||
import { I18nStart } from './i18n';
|
||||
import { InjectedMetadataSetup, InjectedMetadataStart, LegacyNavLink } from './injected_metadata';
|
||||
import {
|
||||
ErrorToastOptions,
|
||||
|
@ -75,14 +74,10 @@ export { RecursiveReadonly } from '../utils';
|
|||
* https://github.com/Microsoft/web-build-tools/issues/1237
|
||||
*/
|
||||
export interface CoreSetup {
|
||||
/** {@link ChromeSetup} */
|
||||
chrome: ChromeSetup;
|
||||
/** {@link FatalErrorsSetup} */
|
||||
fatalErrors: FatalErrorsSetup;
|
||||
/** {@link HttpSetup} */
|
||||
http: HttpSetup;
|
||||
/** {@link I18nSetup} */
|
||||
i18n: I18nSetup;
|
||||
/** {@link NotificationsSetup} */
|
||||
notifications: NotificationsSetup;
|
||||
/** {@link UiSettingsSetup} */
|
||||
|
@ -136,14 +131,12 @@ export {
|
|||
FatalErrorsSetup,
|
||||
FatalErrorInfo,
|
||||
Capabilities,
|
||||
ChromeSetup,
|
||||
ChromeStart,
|
||||
ChromeBadge,
|
||||
ChromeBreadcrumb,
|
||||
ChromeBrand,
|
||||
ChromeHelpExtension,
|
||||
ChromeNavLink,
|
||||
I18nSetup,
|
||||
I18nStart,
|
||||
LegacyNavLink,
|
||||
Plugin,
|
||||
|
|
|
@ -59,10 +59,8 @@ import { LegacyPlatformService } from './legacy_service';
|
|||
import { applicationServiceMock } from '../application/application_service.mock';
|
||||
|
||||
const applicationSetup = applicationServiceMock.createSetupContract();
|
||||
const chromeSetup = chromeServiceMock.createSetupContract();
|
||||
const fatalErrorsSetup = fatalErrorsServiceMock.createSetupContract();
|
||||
const httpSetup = httpServiceMock.createSetupContract();
|
||||
const i18nSetup = i18nServiceMock.createSetupContract();
|
||||
const injectedMetadataSetup = injectedMetadataServiceMock.createSetupContract();
|
||||
const notificationsSetup = notificationServiceMock.createSetupContract();
|
||||
const uiSettingsSetup = uiSettingsServiceMock.createSetupContract();
|
||||
|
@ -76,13 +74,11 @@ const defaultParams = {
|
|||
const defaultSetupDeps = {
|
||||
core: {
|
||||
application: applicationSetup,
|
||||
i18n: i18nSetup,
|
||||
fatalErrors: fatalErrorsSetup,
|
||||
injectedMetadata: injectedMetadataSetup,
|
||||
notifications: notificationsSetup,
|
||||
http: httpSetup,
|
||||
uiSettings: uiSettingsSetup,
|
||||
chrome: chromeSetup,
|
||||
},
|
||||
plugins: {},
|
||||
};
|
||||
|
|
|
@ -20,13 +20,12 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { Subscription } from 'rxjs';
|
||||
import { I18nStart, I18nSetup } from '../i18n';
|
||||
import { I18nStart } from '../i18n';
|
||||
import { ToastsService, ToastsSetup, ToastsStart } from './toasts';
|
||||
import { UiSettingsSetup } from '../ui_settings';
|
||||
import { OverlayStart } from '../overlays';
|
||||
|
||||
interface SetupDeps {
|
||||
i18n: I18nSetup;
|
||||
uiSettings: UiSettingsSetup;
|
||||
}
|
||||
|
||||
|
@ -46,8 +45,8 @@ export class NotificationsService {
|
|||
this.toasts = new ToastsService();
|
||||
}
|
||||
|
||||
public setup({ i18n: i18nSetup, uiSettings }: SetupDeps): NotificationsSetup {
|
||||
const notificationSetup = { toasts: this.toasts.setup({ i18n: i18nSetup, uiSettings }) };
|
||||
public setup({ uiSettings }: SetupDeps): NotificationsSetup {
|
||||
const notificationSetup = { toasts: this.toasts.setup({ uiSettings }) };
|
||||
|
||||
this.uiSettingsErrorSubscription = uiSettings.getUpdateErrors$().subscribe(error => {
|
||||
notificationSetup.toasts.addDanger({
|
||||
|
|
|
@ -23,8 +23,6 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers';
|
|||
|
||||
import { ErrorToast } from './error_toast';
|
||||
|
||||
import { i18nServiceMock } from '../../i18n/i18n_service.mock';
|
||||
|
||||
interface ErrorToastProps {
|
||||
error?: Error;
|
||||
title?: string;
|
||||
|
@ -42,7 +40,6 @@ function render(props: ErrorToastProps = {}) {
|
|||
error={props.error || new Error('error message')}
|
||||
title={props.title || 'An error occured'}
|
||||
toastMessage={props.toastMessage || 'This is the toast message'}
|
||||
i18nContext={i18nServiceMock.createSetupContract().Context}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -31,14 +31,12 @@ import {
|
|||
import { EuiSpacer } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
import { I18nSetup } from '../../i18n';
|
||||
import { OverlayStart } from '../../overlays';
|
||||
|
||||
interface ErrorToastProps {
|
||||
title: string;
|
||||
error: Error;
|
||||
toastMessage: string;
|
||||
i18nContext: I18nSetup['Context'];
|
||||
openModal: OverlayStart['openModal'];
|
||||
}
|
||||
|
||||
|
@ -51,9 +49,8 @@ interface ErrorToastProps {
|
|||
function showErrorDialog({
|
||||
title,
|
||||
error,
|
||||
i18nContext: I18nContext,
|
||||
openModal,
|
||||
}: Pick<ErrorToastProps, 'error' | 'title' | 'i18nContext' | 'openModal'>) {
|
||||
}: Pick<ErrorToastProps, 'error' | 'title' | 'openModal'>) {
|
||||
const modal = openModal(
|
||||
<React.Fragment>
|
||||
<EuiModalHeader>
|
||||
|
@ -79,13 +76,7 @@ function showErrorDialog({
|
|||
);
|
||||
}
|
||||
|
||||
export function ErrorToast({
|
||||
title,
|
||||
error,
|
||||
toastMessage,
|
||||
i18nContext,
|
||||
openModal,
|
||||
}: ErrorToastProps) {
|
||||
export function ErrorToast({ title, error, toastMessage, openModal }: ErrorToastProps) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<p data-test-subj="errorToastMessage">{toastMessage}</p>
|
||||
|
@ -93,7 +84,7 @@ export function ErrorToast({
|
|||
<EuiButton
|
||||
size="s"
|
||||
color="danger"
|
||||
onClick={() => showErrorDialog({ title, error, openModal, i18nContext })}
|
||||
onClick={() => showErrorDialog({ title, error, openModal })}
|
||||
>
|
||||
<FormattedMessage
|
||||
id="core.toasts.errorToast.seeFullError"
|
||||
|
|
|
@ -51,7 +51,7 @@ function uiSettingsMock() {
|
|||
function toastDeps() {
|
||||
return {
|
||||
uiSettings: uiSettingsMock(),
|
||||
i18n: i18nServiceMock.createSetupContract(),
|
||||
i18n: i18nServiceMock.createStartContract(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import * as Rx from 'rxjs';
|
|||
|
||||
import { ErrorToast } from './error_toast';
|
||||
import { UiSettingsSetup } from '../../ui_settings';
|
||||
import { I18nSetup } from '../../i18n';
|
||||
import { OverlayStart } from '../../overlays';
|
||||
|
||||
type ToastInputFields = Pick<Toast, Exclude<keyof Toast, 'id'>>;
|
||||
|
@ -60,13 +59,11 @@ export class ToastsApi {
|
|||
private toasts$ = new Rx.BehaviorSubject<Toast[]>([]);
|
||||
private idCounter = 0;
|
||||
private uiSettings: UiSettingsSetup;
|
||||
private i18n: I18nSetup;
|
||||
|
||||
private overlays?: OverlayStart;
|
||||
|
||||
constructor(deps: { uiSettings: UiSettingsSetup; i18n: I18nSetup }) {
|
||||
constructor(deps: { uiSettings: UiSettingsSetup }) {
|
||||
this.uiSettings = deps.uiSettings;
|
||||
this.i18n = deps.i18n;
|
||||
}
|
||||
|
||||
public registerOverlays(overlays: OverlayStart) {
|
||||
|
@ -136,7 +133,6 @@ export class ToastsApi {
|
|||
error={error}
|
||||
title={options.title}
|
||||
toastMessage={message}
|
||||
i18nContext={this.i18n.Context}
|
||||
/>
|
||||
),
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@ describe('#setup()', () => {
|
|||
const toasts = new ToastsService();
|
||||
|
||||
expect(
|
||||
toasts.setup({ i18n: mockI18n, uiSettings: uiSettingsServiceMock.createSetupContract() })
|
||||
toasts.setup({ uiSettings: uiSettingsServiceMock.createSetupContract() })
|
||||
).toBeInstanceOf(ToastsApi);
|
||||
});
|
||||
});
|
||||
|
@ -49,7 +49,7 @@ describe('#start()', () => {
|
|||
const toasts = new ToastsService();
|
||||
|
||||
expect(mockReactDomRender).not.toHaveBeenCalled();
|
||||
toasts.setup({ i18n: mockI18n, uiSettings: uiSettingsServiceMock.createSetupContract() });
|
||||
toasts.setup({ uiSettings: uiSettingsServiceMock.createSetupContract() });
|
||||
toasts.start({ i18n: mockI18n, targetDomElement, overlays: mockOverlays });
|
||||
expect(mockReactDomRender.mock.calls).toMatchSnapshot();
|
||||
});
|
||||
|
@ -59,7 +59,7 @@ describe('#start()', () => {
|
|||
const toasts = new ToastsService();
|
||||
|
||||
expect(
|
||||
toasts.setup({ i18n: mockI18n, uiSettings: uiSettingsServiceMock.createSetupContract() })
|
||||
toasts.setup({ uiSettings: uiSettingsServiceMock.createSetupContract() })
|
||||
).toBeInstanceOf(ToastsApi);
|
||||
expect(
|
||||
toasts.start({ i18n: mockI18n, targetDomElement, overlays: mockOverlays })
|
||||
|
@ -73,7 +73,7 @@ describe('#stop()', () => {
|
|||
targetDomElement.setAttribute('test', 'target-dom-element');
|
||||
const toasts = new ToastsService();
|
||||
|
||||
toasts.setup({ i18n: mockI18n, uiSettings: uiSettingsServiceMock.createSetupContract() });
|
||||
toasts.setup({ uiSettings: uiSettingsServiceMock.createSetupContract() });
|
||||
toasts.start({ i18n: mockI18n, targetDomElement, overlays: mockOverlays });
|
||||
|
||||
expect(mockReactDomUnmount).not.toHaveBeenCalled();
|
||||
|
@ -92,7 +92,7 @@ describe('#stop()', () => {
|
|||
const targetDomElement = document.createElement('div');
|
||||
const toasts = new ToastsService();
|
||||
|
||||
toasts.setup({ i18n: mockI18n, uiSettings: uiSettingsServiceMock.createSetupContract() });
|
||||
toasts.setup({ uiSettings: uiSettingsServiceMock.createSetupContract() });
|
||||
toasts.start({ i18n: mockI18n, targetDomElement, overlays: mockOverlays });
|
||||
toasts.stop();
|
||||
expect(targetDomElement.childNodes).toHaveLength(0);
|
||||
|
|
|
@ -21,14 +21,13 @@ import React from 'react';
|
|||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
|
||||
import { Toast } from '@elastic/eui';
|
||||
import { I18nSetup, I18nStart } from '../../i18n';
|
||||
import { I18nStart } from '../../i18n';
|
||||
import { UiSettingsSetup } from '../../ui_settings';
|
||||
import { GlobalToastList } from './global_toast_list';
|
||||
import { ToastsApi } from './toasts_api';
|
||||
import { OverlayStart } from '../../overlays';
|
||||
|
||||
interface SetupDeps {
|
||||
i18n: I18nSetup;
|
||||
uiSettings: UiSettingsSetup;
|
||||
}
|
||||
|
||||
|
@ -48,8 +47,8 @@ export class ToastsService {
|
|||
private api?: ToastsApi;
|
||||
private targetDomElement?: HTMLElement;
|
||||
|
||||
public setup({ i18n, uiSettings }: SetupDeps) {
|
||||
this.api = new ToastsApi({ i18n, uiSettings });
|
||||
public setup({ uiSettings }: SetupDeps) {
|
||||
this.api = new ToastsApi({ uiSettings });
|
||||
return this.api!;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import React from 'react';
|
|||
import { i18nServiceMock } from '../i18n/i18n_service.mock';
|
||||
import { FlyoutRef, FlyoutService } from './flyout';
|
||||
|
||||
const i18nMock = i18nServiceMock.createSetupContract();
|
||||
const i18nMock = i18nServiceMock.createStartContract();
|
||||
|
||||
beforeEach(() => {
|
||||
mockReactDomRender.mockClear();
|
||||
|
|
|
@ -23,7 +23,7 @@ import { EuiFlyout } from '@elastic/eui';
|
|||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Subject } from 'rxjs';
|
||||
import { I18nSetup } from '../i18n';
|
||||
import { I18nStart } from '../i18n';
|
||||
import { OverlayRef } from './overlay_service';
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ export class FlyoutService {
|
|||
* @return {FlyoutRef} A reference to the opened flyout panel.
|
||||
*/
|
||||
public openFlyout = (
|
||||
i18n: I18nSetup,
|
||||
i18n: I18nStart,
|
||||
flyoutChildren: React.ReactNode,
|
||||
flyoutProps: {
|
||||
closeButtonAriaLabel?: string;
|
||||
|
|
|
@ -22,7 +22,7 @@ import React from 'react';
|
|||
import { i18nServiceMock } from '../i18n/i18n_service.mock';
|
||||
import { ModalService, ModalRef } from './modal';
|
||||
|
||||
const i18nMock = i18nServiceMock.createSetupContract();
|
||||
const i18nMock = i18nServiceMock.createStartContract();
|
||||
|
||||
beforeEach(() => {
|
||||
mockReactDomRender.mockClear();
|
||||
|
|
|
@ -23,7 +23,7 @@ import { EuiModal, EuiOverlayMask } from '@elastic/eui';
|
|||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { Subject } from 'rxjs';
|
||||
import { I18nSetup } from '../i18n';
|
||||
import { I18nStart } from '../i18n';
|
||||
import { OverlayRef } from './overlay_service';
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ export class ModalService {
|
|||
* @return {FlyoutRef} A reference to the opened flyout panel.
|
||||
*/
|
||||
public openModal = (
|
||||
i18n: I18nSetup,
|
||||
i18n: I18nStart,
|
||||
modalChildren: React.ReactNode,
|
||||
modalProps: {
|
||||
closeButtonAriaLabel?: string;
|
||||
|
|
|
@ -63,9 +63,7 @@ export function createPluginSetupContext<TSetup, TStart, TPluginsSetup, TPlugins
|
|||
): CoreSetup {
|
||||
return {
|
||||
http: deps.http,
|
||||
chrome: deps.chrome,
|
||||
fatalErrors: deps.fatalErrors,
|
||||
i18n: deps.i18n,
|
||||
notifications: deps.notifications,
|
||||
uiSettings: deps.uiSettings,
|
||||
};
|
||||
|
|
|
@ -73,10 +73,8 @@ beforeEach(() => {
|
|||
]);
|
||||
return metadata;
|
||||
})(),
|
||||
chrome: chromeServiceMock.createSetupContract(),
|
||||
fatalErrors: fatalErrorsServiceMock.createSetupContract(),
|
||||
http: httpServiceMock.createSetupContract(),
|
||||
i18n: i18nServiceMock.createSetupContract(),
|
||||
notifications: notificationServiceMock.createSetupContract(),
|
||||
uiSettings: uiSettingsServiceMock.createSetupContract() as jest.Mocked<UiSettingsClient>,
|
||||
};
|
||||
|
|
|
@ -94,9 +94,6 @@ export interface ChromeNavLink {
|
|||
|
||||
// Warning: (ae-forgotten-export) The symbol "ChromeService" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type ChromeSetup = ReturnType<ChromeService['setup']>;
|
||||
|
||||
// @public (undocumented)
|
||||
export type ChromeStart = ReturnType<ChromeService['start']>;
|
||||
|
||||
|
@ -106,15 +103,11 @@ export interface CoreContext {
|
|||
|
||||
// @public
|
||||
export interface CoreSetup {
|
||||
// (undocumented)
|
||||
chrome: ChromeSetup;
|
||||
// (undocumented)
|
||||
fatalErrors: FatalErrorsSetup;
|
||||
// (undocumented)
|
||||
http: HttpSetup;
|
||||
// (undocumented)
|
||||
i18n: I18nSetup;
|
||||
// (undocumented)
|
||||
notifications: NotificationsSetup;
|
||||
// (undocumented)
|
||||
uiSettings: UiSettingsSetup;
|
||||
|
@ -237,15 +230,12 @@ export type HttpSetup = HttpServiceBase;
|
|||
export type HttpStart = HttpServiceBase;
|
||||
|
||||
// @public
|
||||
export interface I18nSetup {
|
||||
export interface I18nStart {
|
||||
Context: ({ children }: {
|
||||
children: React.ReactNode;
|
||||
}) => JSX.Element;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type I18nStart = I18nSetup;
|
||||
|
||||
// @internal (undocumented)
|
||||
export interface InternalCoreSetup extends CoreSetup {
|
||||
// (undocumented)
|
||||
|
@ -355,7 +345,6 @@ export type ToastInput = string | ToastInputFields | Promise<ToastInputFields>;
|
|||
export class ToastsApi {
|
||||
constructor(deps: {
|
||||
uiSettings: UiSettingsSetup;
|
||||
i18n: I18nSetup;
|
||||
});
|
||||
// (undocumented)
|
||||
add(toastOrTitle: ToastInput): Toast;
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
import { chromeServiceMock } from '../../../../../core/public/mocks';
|
||||
|
||||
export const newPlatformChrome = chromeServiceMock.createSetupContract();
|
||||
export const newPlatformChrome = chromeServiceMock.createStartContract();
|
||||
jest.doMock('ui/new_platform', () => ({
|
||||
npSetup: {
|
||||
npStart: {
|
||||
core: { chrome: newPlatformChrome },
|
||||
},
|
||||
}));
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
*/
|
||||
|
||||
import { Chrome } from 'ui/chrome';
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { ChromeBadge } from '../../../../../core/public';
|
||||
export type Badge = ChromeBadge;
|
||||
|
||||
export type BadgeApi = ReturnType<typeof createBadgeApi>['badge'];
|
||||
|
||||
const newPlatformChrome = npSetup.core.chrome;
|
||||
const newPlatformChrome = npStart.core.chrome;
|
||||
|
||||
function createBadgeApi() {
|
||||
return {
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { ChromeBreadcrumb } from '../../../../../core/public';
|
||||
export type Breadcrumb = ChromeBreadcrumb;
|
||||
|
||||
export type BreadcrumbsApi = ReturnType<typeof createBreadcrumbsApi>['breadcrumbs'];
|
||||
|
||||
const newPlatformChrome = npSetup.core.chrome;
|
||||
const newPlatformChrome = npStart.core.chrome;
|
||||
|
||||
function createBreadcrumbsApi(chrome: { [key: string]: any }) {
|
||||
let currentBreadcrumbs: Breadcrumb[] = [];
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
import { chromeServiceMock } from '../../../../../core/public/mocks';
|
||||
|
||||
export const newPlatformChrome = chromeServiceMock.createSetupContract();
|
||||
export const newPlatformChrome = chromeServiceMock.createStartContract();
|
||||
jest.doMock('ui/new_platform', () => ({
|
||||
npSetup: {
|
||||
npStart: {
|
||||
core: { chrome: newPlatformChrome },
|
||||
},
|
||||
}));
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
|
||||
import * as Rx from 'rxjs';
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
|
||||
const newPlatformChrome = npSetup.core.chrome;
|
||||
const newPlatformChrome = npStart.core.chrome;
|
||||
|
||||
export function initChromeControlsApi(chrome: { [key: string]: any }) {
|
||||
// cache of chrome visibility state
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { ChromeHelpExtension } from '../../../../../core/public';
|
||||
|
||||
const newPlatformChrome = npSetup.core.chrome;
|
||||
const newPlatformChrome = npStart.core.chrome;
|
||||
|
||||
export type HelpExtensionApi = ReturnType<typeof createHelpExtensionApi>['helpExtension'];
|
||||
export type HelpExtension = ChromeHelpExtension;
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
import { chromeServiceMock } from '../../../../../core/public/mocks';
|
||||
|
||||
export const newPlatformChrome = chromeServiceMock.createSetupContract();
|
||||
export const newPlatformChrome = chromeServiceMock.createStartContract();
|
||||
jest.doMock('ui/new_platform', () => ({
|
||||
npSetup: {
|
||||
npStart: {
|
||||
core: { chrome: newPlatformChrome },
|
||||
},
|
||||
}));
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
import * as Rx from 'rxjs';
|
||||
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { ChromeBrand } from '../../../../../core/public';
|
||||
|
||||
const newPlatformChrome = npSetup.core.chrome;
|
||||
const newPlatformChrome = npStart.core.chrome;
|
||||
|
||||
export function initChromeThemeApi(chrome: { [key: string]: any }) {
|
||||
const brandCache$ = new Rx.BehaviorSubject<ChromeBrand>({});
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
*/
|
||||
|
||||
import { distinctUntilChanged } from 'rxjs/operators';
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { uiModules } from '../../modules';
|
||||
|
||||
const newPlatformChrome = npSetup.core.chrome;
|
||||
const newPlatformChrome = npStart.core.chrome;
|
||||
|
||||
uiModules.get('kibana')
|
||||
.service('globalNavState', ($rootScope) => {
|
||||
|
|
|
@ -22,7 +22,7 @@ import PropTypes from 'prop-types';
|
|||
import React from 'react';
|
||||
|
||||
jest.mock('ui/new_platform', () => ({
|
||||
npSetup: {
|
||||
npStart: {
|
||||
core: {
|
||||
i18n: { Context: ({ children }: any) => <div>Context: {children}</div> },
|
||||
},
|
||||
|
|
|
@ -22,9 +22,9 @@ import React from 'react';
|
|||
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';
|
||||
// @ts-ignore
|
||||
import { uiModules } from 'ui/modules';
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
|
||||
export const I18nContext = npSetup.core.i18n.Context;
|
||||
export const I18nContext = npStart.core.i18n.Context;
|
||||
|
||||
export function wrapInI18nContext<P>(ComponentToWrap: React.ComponentType<P>) {
|
||||
const ContextWrapper: React.SFC<P> = props => {
|
||||
|
|
|
@ -33,7 +33,7 @@ import * as Rx from 'rxjs';
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { InternalCoreSetup } from 'kibana/public';
|
||||
import { InternalCoreStart } from 'kibana/public';
|
||||
|
||||
import { fatalError } from 'ui/notify';
|
||||
import { capabilities } from 'ui/capabilities';
|
||||
|
@ -41,7 +41,7 @@ import { capabilities } from 'ui/capabilities';
|
|||
import { modifyUrl } from 'ui/url';
|
||||
// @ts-ignore
|
||||
import { UrlOverflowService } from '../error_url_overflow';
|
||||
import { npSetup } from '../new_platform';
|
||||
import { npStart } from '../new_platform';
|
||||
import { toastNotifications } from '../notify';
|
||||
// @ts-ignore
|
||||
import { isSystemApiRequest } from '../system_api';
|
||||
|
@ -49,7 +49,7 @@ import { isSystemApiRequest } from '../system_api';
|
|||
const URL_LIMIT_WARN_WITHIN = 1000;
|
||||
|
||||
export const configureAppAngularModule = (angularModule: IModule) => {
|
||||
const newPlatform = npSetup.core;
|
||||
const newPlatform = npStart.core;
|
||||
const legacyMetadata = newPlatform.injectedMetadata.getLegacyMetadata();
|
||||
|
||||
forOwn(newPlatform.injectedMetadata.getInjectedVars(), (val, name) => {
|
||||
|
@ -77,7 +77,7 @@ export const configureAppAngularModule = (angularModule: IModule) => {
|
|||
.run($setupUrlOverflowHandling(newPlatform));
|
||||
};
|
||||
|
||||
const getEsUrl = (newPlatform: InternalCoreSetup) => {
|
||||
const getEsUrl = (newPlatform: InternalCoreStart) => {
|
||||
const a = document.createElement('a');
|
||||
a.href = newPlatform.http.prependBasePath('/elasticsearch');
|
||||
const protocolPort = /https/.test(a.protocol) ? 443 : 80;
|
||||
|
@ -90,7 +90,7 @@ const getEsUrl = (newPlatform: InternalCoreSetup) => {
|
|||
};
|
||||
};
|
||||
|
||||
const setupCompileProvider = (newPlatform: InternalCoreSetup) => (
|
||||
const setupCompileProvider = (newPlatform: InternalCoreStart) => (
|
||||
$compileProvider: ICompileProvider
|
||||
) => {
|
||||
if (!newPlatform.injectedMetadata.getLegacyMetadata().devMode) {
|
||||
|
@ -98,7 +98,7 @@ const setupCompileProvider = (newPlatform: InternalCoreSetup) => (
|
|||
}
|
||||
};
|
||||
|
||||
const setupLocationProvider = (newPlatform: InternalCoreSetup) => (
|
||||
const setupLocationProvider = (newPlatform: InternalCoreStart) => (
|
||||
$locationProvider: ILocationProvider
|
||||
) => {
|
||||
$locationProvider.html5Mode({
|
||||
|
@ -110,7 +110,7 @@ const setupLocationProvider = (newPlatform: InternalCoreSetup) => (
|
|||
$locationProvider.hashPrefix('');
|
||||
};
|
||||
|
||||
export const $setupXsrfRequestInterceptor = (newPlatform: InternalCoreSetup) => {
|
||||
export const $setupXsrfRequestInterceptor = (newPlatform: InternalCoreStart) => {
|
||||
const version = newPlatform.injectedMetadata.getLegacyMetadata().version;
|
||||
|
||||
// Configure jQuery prefilter
|
||||
|
@ -145,7 +145,7 @@ export const $setupXsrfRequestInterceptor = (newPlatform: InternalCoreSetup) =>
|
|||
* @param {HttpService} $http
|
||||
* @return {undefined}
|
||||
*/
|
||||
const capture$httpLoadingCount = (newPlatform: InternalCoreSetup) => (
|
||||
const capture$httpLoadingCount = (newPlatform: InternalCoreStart) => (
|
||||
$rootScope: IRootScopeService,
|
||||
$http: IHttpService
|
||||
) => {
|
||||
|
@ -166,7 +166,7 @@ const capture$httpLoadingCount = (newPlatform: InternalCoreSetup) => (
|
|||
* lets us integrate with the angular router so that we can automatically clear
|
||||
* the breadcrumbs if we switch to a Kibana app that does not use breadcrumbs correctly
|
||||
*/
|
||||
const $setupBreadcrumbsAutoClear = (newPlatform: InternalCoreSetup) => (
|
||||
const $setupBreadcrumbsAutoClear = (newPlatform: InternalCoreStart) => (
|
||||
$rootScope: IRootScopeService,
|
||||
$injector: any
|
||||
) => {
|
||||
|
@ -213,7 +213,7 @@ const $setupBreadcrumbsAutoClear = (newPlatform: InternalCoreSetup) => (
|
|||
* lets us integrate with the angular router so that we can automatically clear
|
||||
* the badge if we switch to a Kibana app that does not use the badge correctly
|
||||
*/
|
||||
const $setupBadgeAutoClear = (newPlatform: InternalCoreSetup) => (
|
||||
const $setupBadgeAutoClear = (newPlatform: InternalCoreStart) => (
|
||||
$rootScope: IRootScopeService,
|
||||
$injector: any
|
||||
) => {
|
||||
|
@ -253,7 +253,7 @@ const $setupBadgeAutoClear = (newPlatform: InternalCoreSetup) => (
|
|||
* the helpExtension if we switch to a Kibana app that does not set its own
|
||||
* helpExtension
|
||||
*/
|
||||
const $setupHelpExtensionAutoClear = (newPlatform: InternalCoreSetup) => (
|
||||
const $setupHelpExtensionAutoClear = (newPlatform: InternalCoreStart) => (
|
||||
$rootScope: IRootScopeService,
|
||||
$injector: any
|
||||
) => {
|
||||
|
@ -285,7 +285,7 @@ const $setupHelpExtensionAutoClear = (newPlatform: InternalCoreSetup) => (
|
|||
});
|
||||
};
|
||||
|
||||
const $setupUrlOverflowHandling = (newPlatform: InternalCoreSetup) => (
|
||||
const $setupUrlOverflowHandling = (newPlatform: InternalCoreStart) => (
|
||||
$location: ILocationService,
|
||||
$rootScope: IRootScopeService,
|
||||
Private: any,
|
||||
|
|
|
@ -40,7 +40,7 @@ function toastDeps() {
|
|||
);
|
||||
return {
|
||||
uiSettings: uiSettingsMock,
|
||||
i18n: i18nServiceMock.createSetupContract(),
|
||||
i18n: i18nServiceMock.createStartContract(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import 'react-vis/dist/style.css';
|
||||
import { CoreSetup } from 'src/core/public';
|
||||
import { CoreStart } from 'src/core/public';
|
||||
import 'ui/autoload/all';
|
||||
import 'ui/autoload/styles';
|
||||
import chrome from 'ui/chrome';
|
||||
|
@ -48,6 +48,6 @@ checkForRoot().then(() => {
|
|||
i18n: {
|
||||
Context: I18nContext
|
||||
}
|
||||
} as CoreSetup;
|
||||
plugin().setup(core);
|
||||
} as CoreStart;
|
||||
plugin().start(core);
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ import React from 'react';
|
|||
import ReactDOM from 'react-dom';
|
||||
import { Router, Route, Switch } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
import { CoreSetup } from 'src/core/public';
|
||||
import { CoreStart } from 'src/core/public';
|
||||
import { history } from '../utils/history';
|
||||
import { LocationProvider } from '../context/LocationContext';
|
||||
import { UrlParamsProvider } from '../context/UrlParamsContext';
|
||||
|
@ -51,7 +51,7 @@ function App() {
|
|||
}
|
||||
|
||||
export class Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
public start(core: CoreStart) {
|
||||
const { i18n } = core;
|
||||
ReactDOM.render(
|
||||
<i18n.Context>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue