[New platform] Export types from root levels (#33973)
* export flatten types from the root * add Chrome prefix for chrome types * export types for server services * remove comment * cleanup CoreSetup types * rename to setup * Apply @eliperelman suggestions from code review Co-Authored-By: restrry <restrry@gmail.com>
This commit is contained in:
parent
8d64071d7f
commit
5534249ea4
24 changed files with 87 additions and 68 deletions
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import { Brand, Breadcrumb, ChromeService, ChromeSetup } from './chrome_service';
|
import { ChromeBrand, ChromeBreadcrumb, ChromeService, ChromeSetup } from './chrome_service';
|
||||||
|
|
||||||
const createSetupContractMock = () => {
|
const createSetupContractMock = () => {
|
||||||
const setupContract: jest.Mocked<ChromeSetup> = {
|
const setupContract: jest.Mocked<ChromeSetup> = {
|
||||||
|
@ -35,11 +35,11 @@ const createSetupContractMock = () => {
|
||||||
getHelpExtension$: jest.fn(),
|
getHelpExtension$: jest.fn(),
|
||||||
setHelpExtension: jest.fn(),
|
setHelpExtension: jest.fn(),
|
||||||
};
|
};
|
||||||
setupContract.getBrand$.mockReturnValue(new BehaviorSubject({} as Brand));
|
setupContract.getBrand$.mockReturnValue(new BehaviorSubject({} as ChromeBrand));
|
||||||
setupContract.getIsVisible$.mockReturnValue(new BehaviorSubject(false));
|
setupContract.getIsVisible$.mockReturnValue(new BehaviorSubject(false));
|
||||||
setupContract.getIsCollapsed$.mockReturnValue(new BehaviorSubject(false));
|
setupContract.getIsCollapsed$.mockReturnValue(new BehaviorSubject(false));
|
||||||
setupContract.getApplicationClasses$.mockReturnValue(new BehaviorSubject(['class-name']));
|
setupContract.getApplicationClasses$.mockReturnValue(new BehaviorSubject(['class-name']));
|
||||||
setupContract.getBreadcrumbs$.mockReturnValue(new BehaviorSubject([{} as Breadcrumb]));
|
setupContract.getBreadcrumbs$.mockReturnValue(new BehaviorSubject([{} as ChromeBreadcrumb]));
|
||||||
setupContract.getHelpExtension$.mockReturnValue(new BehaviorSubject(undefined));
|
setupContract.getHelpExtension$.mockReturnValue(new BehaviorSubject(undefined));
|
||||||
return setupContract;
|
return setupContract;
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,18 +32,18 @@ function isEmbedParamInHash() {
|
||||||
return Boolean(query.embed);
|
return Boolean(query.embed);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Brand {
|
export interface ChromeBrand {
|
||||||
logo?: string;
|
logo?: string;
|
||||||
smallLogo?: string;
|
smallLogo?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Breadcrumb {
|
export interface ChromeBreadcrumb {
|
||||||
text: string;
|
text: string;
|
||||||
href?: string;
|
href?: string;
|
||||||
'data-test-subj'?: string;
|
'data-test-subj'?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type HelpExtension = (element: HTMLDivElement) => (() => void);
|
export type ChromeHelpExtension = (element: HTMLDivElement) => (() => void);
|
||||||
|
|
||||||
interface ConstructorParams {
|
interface ConstructorParams {
|
||||||
browserSupportsCsp: boolean;
|
browserSupportsCsp: boolean;
|
||||||
|
@ -65,12 +65,12 @@ export class ChromeService {
|
||||||
public setup({ injectedMetadata, notifications }: SetupDeps) {
|
public setup({ injectedMetadata, notifications }: SetupDeps) {
|
||||||
const FORCE_HIDDEN = isEmbedParamInHash();
|
const FORCE_HIDDEN = isEmbedParamInHash();
|
||||||
|
|
||||||
const brand$ = new Rx.BehaviorSubject<Brand>({});
|
const brand$ = new Rx.BehaviorSubject<ChromeBrand>({});
|
||||||
const isVisible$ = new Rx.BehaviorSubject(true);
|
const isVisible$ = new Rx.BehaviorSubject(true);
|
||||||
const isCollapsed$ = new Rx.BehaviorSubject(!!localStorage.getItem(IS_COLLAPSED_KEY));
|
const isCollapsed$ = new Rx.BehaviorSubject(!!localStorage.getItem(IS_COLLAPSED_KEY));
|
||||||
const applicationClasses$ = new Rx.BehaviorSubject<Set<string>>(new Set());
|
const applicationClasses$ = new Rx.BehaviorSubject<Set<string>>(new Set());
|
||||||
const helpExtension$ = new Rx.BehaviorSubject<HelpExtension | undefined>(undefined);
|
const helpExtension$ = new Rx.BehaviorSubject<ChromeHelpExtension | undefined>(undefined);
|
||||||
const breadcrumbs$ = new Rx.BehaviorSubject<Breadcrumb[]>([]);
|
const breadcrumbs$ = new Rx.BehaviorSubject<ChromeBreadcrumb[]>([]);
|
||||||
|
|
||||||
if (!this.browserSupportsCsp && injectedMetadata.getCspConfig().warnLegacyBrowsers) {
|
if (!this.browserSupportsCsp && injectedMetadata.getCspConfig().warnLegacyBrowsers) {
|
||||||
notifications.toasts.addWarning(
|
notifications.toasts.addWarning(
|
||||||
|
@ -95,7 +95,7 @@ export class ChromeService {
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
setBrand: (brand: Brand) => {
|
setBrand: (brand: ChromeBrand) => {
|
||||||
brand$.next(
|
brand$.next(
|
||||||
Object.freeze({
|
Object.freeze({
|
||||||
logo: brand.logo,
|
logo: brand.logo,
|
||||||
|
@ -179,7 +179,7 @@ export class ChromeService {
|
||||||
/**
|
/**
|
||||||
* Override the current set of breadcrumbs
|
* Override the current set of breadcrumbs
|
||||||
*/
|
*/
|
||||||
setBreadcrumbs: (newBreadcrumbs: Breadcrumb[]) => {
|
setBreadcrumbs: (newBreadcrumbs: ChromeBreadcrumb[]) => {
|
||||||
breadcrumbs$.next(newBreadcrumbs);
|
breadcrumbs$.next(newBreadcrumbs);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ export class ChromeService {
|
||||||
/**
|
/**
|
||||||
* Override the current set of breadcrumbs
|
* Override the current set of breadcrumbs
|
||||||
*/
|
*/
|
||||||
setHelpExtension: (helpExtension?: HelpExtension) => {
|
setHelpExtension: (helpExtension?: ChromeHelpExtension) => {
|
||||||
helpExtension$.next(helpExtension);
|
helpExtension$.next(helpExtension);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,4 +17,10 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export { Breadcrumb, ChromeService, ChromeSetup, Brand, HelpExtension } from './chrome_service';
|
export {
|
||||||
|
ChromeBreadcrumb,
|
||||||
|
ChromeService,
|
||||||
|
ChromeSetup,
|
||||||
|
ChromeBrand,
|
||||||
|
ChromeHelpExtension,
|
||||||
|
} from './chrome_service';
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { BasePathSetup } from './base_path';
|
import { BasePathSetup } from './base_path';
|
||||||
import { ChromeSetup } from './chrome';
|
import { ChromeBrand, ChromeBreadcrumb, ChromeHelpExtension, ChromeSetup } from './chrome';
|
||||||
import { FatalErrorsSetup } from './fatal_errors';
|
import { FatalErrorsSetup } from './fatal_errors';
|
||||||
import { HttpSetup } from './http';
|
import { HttpSetup } from './http';
|
||||||
import { I18nSetup } from './i18n';
|
import { I18nSetup } from './i18n';
|
||||||
import { InjectedMetadataSetup } from './injected_metadata';
|
import { InjectedMetadataParams, InjectedMetadataSetup } from './injected_metadata';
|
||||||
import { NotificationsSetup } from './notifications';
|
import { NotificationsSetup, Toast, ToastInput, ToastsSetup } from './notifications';
|
||||||
import { UiSettingsSetup } from './ui_settings';
|
import { UiSettingsClient, UiSettingsSetup, UiSettingsState } from './ui_settings';
|
||||||
|
|
||||||
export { CoreSystem } from './core_system';
|
export { CoreSystem } from './core_system';
|
||||||
|
|
||||||
|
@ -38,3 +38,23 @@ export interface CoreSetup {
|
||||||
uiSettings: UiSettingsSetup;
|
uiSettings: UiSettingsSetup;
|
||||||
chrome: ChromeSetup;
|
chrome: ChromeSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
BasePathSetup,
|
||||||
|
HttpSetup,
|
||||||
|
FatalErrorsSetup,
|
||||||
|
I18nSetup,
|
||||||
|
ChromeSetup,
|
||||||
|
ChromeBreadcrumb,
|
||||||
|
ChromeBrand,
|
||||||
|
ChromeHelpExtension,
|
||||||
|
InjectedMetadataSetup,
|
||||||
|
InjectedMetadataParams,
|
||||||
|
NotificationsSetup,
|
||||||
|
Toast,
|
||||||
|
ToastInput,
|
||||||
|
ToastsSetup,
|
||||||
|
UiSettingsClient,
|
||||||
|
UiSettingsState,
|
||||||
|
UiSettingsSetup,
|
||||||
|
};
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
import { ElasticsearchServiceSetup } from './elasticsearch';
|
||||||
|
import { HttpServiceSetup } from './http';
|
||||||
|
import { PluginsServiceSetup } from './plugins';
|
||||||
|
|
||||||
export { bootstrap } from './bootstrap';
|
export { bootstrap } from './bootstrap';
|
||||||
export { CallAPIOptions, ClusterClient } from './elasticsearch';
|
export { CallAPIOptions, ClusterClient } from './elasticsearch';
|
||||||
|
@ -26,3 +29,9 @@ export {
|
||||||
PluginName,
|
PluginName,
|
||||||
PluginSetupContext,
|
PluginSetupContext,
|
||||||
} from './plugins';
|
} from './plugins';
|
||||||
|
|
||||||
|
export interface CoreSetup {
|
||||||
|
http: HttpServiceSetup;
|
||||||
|
elasticsearch: ElasticsearchServiceSetup;
|
||||||
|
plugins: PluginsServiceSetup;
|
||||||
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export { PluginsService } from './plugins_service';
|
export { PluginsService, PluginsServiceSetup } from './plugins_service';
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export { isNewPlatformPlugin } from './discovery';
|
export { isNewPlatformPlugin } from './discovery';
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { BasePathSetup } from '../../../../../core/public/base_path';
|
import { BasePathSetup } from '../../../../../core/public';
|
||||||
let newPlatformBasePath: BasePathSetup;
|
let newPlatformBasePath: BasePathSetup;
|
||||||
|
|
||||||
export function __newPlatformInit__(instance: BasePathSetup) {
|
export function __newPlatformInit__(instance: BasePathSetup) {
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
import { IRootScopeService } from 'angular';
|
import { IRootScopeService } from 'angular';
|
||||||
import { fatalError } from 'ui/notify/fatal_error';
|
import { fatalError } from 'ui/notify/fatal_error';
|
||||||
import { Breadcrumb, ChromeSetup } from '../../../../../core/public/chrome';
|
import { ChromeBreadcrumb, ChromeSetup } from '../../../../../core/public';
|
||||||
export { Breadcrumb };
|
export type Breadcrumb = ChromeBreadcrumb;
|
||||||
|
|
||||||
export type BreadcrumbsApi = ReturnType<typeof createBreadcrumbsApi>['breadcrumbs'];
|
export type BreadcrumbsApi = ReturnType<typeof createBreadcrumbsApi>['breadcrumbs'];
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Rx from 'rxjs';
|
import * as Rx from 'rxjs';
|
||||||
import { ChromeSetup } from '../../../../../core/public/chrome';
|
import { ChromeSetup } from '../../../../../core/public';
|
||||||
|
|
||||||
let newPlatformChrome: ChromeSetup;
|
let newPlatformChrome: ChromeSetup;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import { IRootScopeService } from 'angular';
|
import { IRootScopeService } from 'angular';
|
||||||
|
|
||||||
import { ChromeSetup, HelpExtension } from '../../../../../core/public/chrome';
|
import { ChromeHelpExtension, ChromeSetup } from '../../../../../core/public';
|
||||||
|
|
||||||
let newPlatformChrome: ChromeSetup;
|
let newPlatformChrome: ChromeSetup;
|
||||||
export function __newPlatformInit__(instance: ChromeSetup) {
|
export function __newPlatformInit__(instance: ChromeSetup) {
|
||||||
|
@ -31,7 +31,7 @@ export function __newPlatformInit__(instance: ChromeSetup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type HelpExtensionApi = ReturnType<typeof createHelpExtensionApi>['helpExtension'];
|
export type HelpExtensionApi = ReturnType<typeof createHelpExtensionApi>['helpExtension'];
|
||||||
export { HelpExtension };
|
export type HelpExtension = ChromeHelpExtension;
|
||||||
|
|
||||||
function createHelpExtensionApi() {
|
function createHelpExtensionApi() {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import { InjectedMetadataSetup } from '../../../../../core/public/injected_metadata';
|
import { InjectedMetadataSetup } from '../../../../../core/public';
|
||||||
|
|
||||||
let newPlatformInjectedVars: InjectedMetadataSetup;
|
let newPlatformInjectedVars: InjectedMetadataSetup;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import * as Rx from 'rxjs';
|
import * as Rx from 'rxjs';
|
||||||
|
|
||||||
import { Brand, ChromeSetup } from '../../../../../core/public/chrome';
|
import { ChromeBrand, ChromeSetup } from '../../../../../core/public';
|
||||||
|
|
||||||
let newPlatformChrome: ChromeSetup;
|
let newPlatformChrome: ChromeSetup;
|
||||||
|
|
||||||
|
@ -32,18 +32,18 @@ export function __newPlatformInit__(instance: ChromeSetup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initChromeThemeApi(chrome: { [key: string]: any }) {
|
export function initChromeThemeApi(chrome: { [key: string]: any }) {
|
||||||
const brandCache$ = new Rx.BehaviorSubject<Brand>({});
|
const brandCache$ = new Rx.BehaviorSubject<ChromeBrand>({});
|
||||||
newPlatformChrome.getBrand$().subscribe(brandCache$);
|
newPlatformChrome.getBrand$().subscribe(brandCache$);
|
||||||
|
|
||||||
const applicationClassesCache$ = new Rx.BehaviorSubject<string[]>([]);
|
const applicationClassesCache$ = new Rx.BehaviorSubject<string[]>([]);
|
||||||
newPlatformChrome.getApplicationClasses$().subscribe(applicationClassesCache$);
|
newPlatformChrome.getApplicationClasses$().subscribe(applicationClassesCache$);
|
||||||
|
|
||||||
chrome.setBrand = (brand: Brand) => {
|
chrome.setBrand = (brand: ChromeBrand) => {
|
||||||
newPlatformChrome.setBrand(brand);
|
newPlatformChrome.setBrand(brand);
|
||||||
return chrome;
|
return chrome;
|
||||||
};
|
};
|
||||||
|
|
||||||
chrome.getBrand = (key: keyof Brand) => {
|
chrome.getBrand = (key: keyof ChromeBrand) => {
|
||||||
return brandCache$.getValue()[key];
|
return brandCache$.getValue()[key];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,11 @@ import { RecentlyAccessedHistoryItem } from 'ui/persisted_log';
|
||||||
import { ChromeHeaderNavControlsRegistry } from 'ui/registry/chrome_header_nav_controls';
|
import { ChromeHeaderNavControlsRegistry } from 'ui/registry/chrome_header_nav_controls';
|
||||||
import { relativeToAbsolute } from 'ui/url/relative_to_absolute';
|
import { relativeToAbsolute } from 'ui/url/relative_to_absolute';
|
||||||
import { NavControlSide } from '../';
|
import { NavControlSide } from '../';
|
||||||
import { Breadcrumb } from '../../../../../../../core/public/chrome';
|
import { ChromeBreadcrumb } from '../../../../../../../core/public';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
appTitle?: string;
|
appTitle?: string;
|
||||||
breadcrumbs$: Rx.Observable<Breadcrumb[]>;
|
breadcrumbs$: Rx.Observable<ChromeBreadcrumb[]>;
|
||||||
homeHref: string;
|
homeHref: string;
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
navLinks$: Rx.Observable<NavLink[]>;
|
navLinks$: Rx.Observable<NavLink[]>;
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import * as Rx from 'rxjs';
|
import * as Rx from 'rxjs';
|
||||||
import { Breadcrumb } from '../../../../../../../core/public/chrome';
|
import { ChromeBreadcrumb } from '../../../../../../../core/public';
|
||||||
import { HeaderBreadcrumbs } from './header_breadcrumbs';
|
import { HeaderBreadcrumbs } from './header_breadcrumbs';
|
||||||
|
|
||||||
describe('HeaderBreadcrumbs', () => {
|
describe('HeaderBreadcrumbs', () => {
|
||||||
it('renders updates to the breadcrumbs$ observable', () => {
|
it('renders updates to the breadcrumbs$ observable', () => {
|
||||||
const breadcrumbs$ = new Rx.Subject<Breadcrumb[]>();
|
const breadcrumbs$ = new Rx.Subject<ChromeBreadcrumb[]>();
|
||||||
const wrapper = mount(<HeaderBreadcrumbs breadcrumbs$={breadcrumbs$} />);
|
const wrapper = mount(<HeaderBreadcrumbs breadcrumbs$={breadcrumbs$} />);
|
||||||
|
|
||||||
breadcrumbs$.next([{ text: 'First' }]);
|
breadcrumbs$.next([{ text: 'First' }]);
|
||||||
|
|
|
@ -26,15 +26,15 @@ import {
|
||||||
EuiHeaderBreadcrumbs,
|
EuiHeaderBreadcrumbs,
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
|
|
||||||
import { Breadcrumb } from '../../../../../../../core/public/chrome';
|
import { ChromeBreadcrumb } from '../../../../../../../core/public';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
appTitle?: string;
|
appTitle?: string;
|
||||||
breadcrumbs$: Rx.Observable<Breadcrumb[]>;
|
breadcrumbs$: Rx.Observable<ChromeBreadcrumb[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
breadcrumbs: Breadcrumb[];
|
breadcrumbs: ChromeBreadcrumb[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HeaderBreadcrumbs extends Component<Props, State> {
|
export class HeaderBreadcrumbs extends Component<Props, State> {
|
||||||
|
|
6
src/legacy/ui/public/chrome/index.d.ts
vendored
6
src/legacy/ui/public/chrome/index.d.ts
vendored
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Brand } from '../../../../core/public/chrome';
|
import { ChromeBrand } from '../../../../core/public';
|
||||||
import { SavedObjectsClient } from '../saved_objects';
|
import { SavedObjectsClient } from '../saved_objects';
|
||||||
import { BreadcrumbsApi } from './api/breadcrumbs';
|
import { BreadcrumbsApi } from './api/breadcrumbs';
|
||||||
import { HelpExtensionApi } from './api/help_extension';
|
import { HelpExtensionApi } from './api/help_extension';
|
||||||
|
@ -40,8 +40,8 @@ declare interface Chrome extends ChromeNavLinks {
|
||||||
setVisible(visible: boolean): any;
|
setVisible(visible: boolean): any;
|
||||||
getInjected(key: string, defaultValue?: any): any;
|
getInjected(key: string, defaultValue?: any): any;
|
||||||
setRootController(name: string, Controller: any): any;
|
setRootController(name: string, Controller: any): any;
|
||||||
setBrand(brand: Brand): this;
|
setBrand(brand: ChromeBrand): this;
|
||||||
getBrand(key: keyof Brand): Brand[keyof Brand];
|
getBrand(key: keyof ChromeBrand): ChromeBrand[keyof ChromeBrand];
|
||||||
addApplicationClass(classNames: string | string[]): this;
|
addApplicationClass(classNames: string | string[]): this;
|
||||||
removeApplicationClass(classNames: string | string[]): this;
|
removeApplicationClass(classNames: string | string[]): this;
|
||||||
getApplicationClasses(): string;
|
getApplicationClasses(): string;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import React from 'react';
|
||||||
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';
|
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { uiModules } from 'ui/modules';
|
import { uiModules } from 'ui/modules';
|
||||||
import { I18nSetup } from '../../../../core/public/i18n';
|
import { I18nSetup } from '../../../../core/public';
|
||||||
|
|
||||||
export let I18nContext: I18nSetup['Context'] = null!;
|
export let I18nContext: I18nSetup['Context'] = null!;
|
||||||
export function __newPlatformInit__(context: typeof I18nContext) {
|
export function __newPlatformInit__(context: typeof I18nContext) {
|
||||||
|
|
|
@ -17,29 +17,11 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { BasePathSetup } from '../../../../core/public/base_path';
|
import { CoreSetup } from '../../../../core/public';
|
||||||
import { ChromeSetup } from '../../../../core/public/chrome';
|
|
||||||
import { FatalErrorsSetup } from '../../../../core/public/fatal_errors';
|
|
||||||
import { HttpSetup } from '../../../../core/public/http';
|
|
||||||
import { I18nSetup } from '../../../../core/public/i18n';
|
|
||||||
import { InjectedMetadataSetup } from '../../../../core/public/injected_metadata';
|
|
||||||
import { NotificationsSetup } from '../../../../core/public/notifications';
|
|
||||||
import { UiSettingsSetup } from '../../../../core/public/ui_settings';
|
|
||||||
|
|
||||||
interface CoreSetup {
|
|
||||||
i18n: I18nSetup;
|
|
||||||
injectedMetadata: InjectedMetadataSetup;
|
|
||||||
fatalErrors: FatalErrorsSetup;
|
|
||||||
notifications: NotificationsSetup;
|
|
||||||
http: HttpSetup;
|
|
||||||
basePath: BasePathSetup;
|
|
||||||
uiSettings: UiSettingsSetup;
|
|
||||||
chrome: ChromeSetup;
|
|
||||||
}
|
|
||||||
|
|
||||||
const runtimeContext = {
|
const runtimeContext = {
|
||||||
setup: {
|
setup: {
|
||||||
core: null as CoreSetup | null,
|
core: (null as unknown) as CoreSetup,
|
||||||
plugins: {},
|
plugins: {},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -53,5 +35,8 @@ export function __newPlatformInit__(core: CoreSetup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getNewPlatform() {
|
export function getNewPlatform() {
|
||||||
|
if (runtimeContext.setup.core === null) {
|
||||||
|
throw new Error('runtimeContext is not initialized yet');
|
||||||
|
}
|
||||||
return runtimeContext;
|
return runtimeContext;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { FatalErrorsSetup } from '../../../../core/public/fatal_errors';
|
import { FatalErrorsSetup } from '../../../../core/public';
|
||||||
import {
|
import {
|
||||||
AngularHttpError,
|
AngularHttpError,
|
||||||
formatAngularHttpError,
|
formatAngularHttpError,
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { ToastsSetup } from '../../../../../core/public/notifications';
|
import { ToastsSetup } from '../../../../../core/public';
|
||||||
|
|
||||||
import { ToastNotifications } from './toast_notifications';
|
import { ToastNotifications } from './toast_notifications';
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Toast, ToastInput, ToastsSetup } from '../../../../../core/public/notifications';
|
import { Toast, ToastInput, ToastsSetup } from '../../../../../core/public';
|
||||||
|
|
||||||
export { Toast, ToastInput };
|
export { Toast, ToastInput };
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ToastsSetup } from '../../../../../core/public/notifications';
|
import { ToastsSetup } from '../../../../../core/public';
|
||||||
import { ToastNotifications } from './toast_notifications';
|
import { ToastNotifications } from './toast_notifications';
|
||||||
|
|
||||||
export let toastNotifications: ToastNotifications;
|
export let toastNotifications: ToastNotifications;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* WARNING: these types are incomplete
|
* WARNING: these types are incomplete
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Breadcrumb } from '../../../../core/public/chrome';
|
import { ChromeBreadcrumb } from '../../../../core/public';
|
||||||
|
|
||||||
interface RouteConfiguration {
|
interface RouteConfiguration {
|
||||||
controller?: string | ((...args: any[]) => void);
|
controller?: string | ((...args: any[]) => void);
|
||||||
|
@ -29,7 +29,7 @@ interface RouteConfiguration {
|
||||||
reloadOnSearch?: boolean;
|
reloadOnSearch?: boolean;
|
||||||
resolve?: object;
|
resolve?: object;
|
||||||
template?: string;
|
template?: string;
|
||||||
k7Breadcrumbs?: (...args: any[]) => Breadcrumb[];
|
k7Breadcrumbs?: (...args: any[]) => ChromeBreadcrumb[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RouteManager {
|
interface RouteManager {
|
||||||
|
|
|
@ -24,8 +24,7 @@ import { parse as parseUrl } from 'url';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { Notifier } from '../notify';
|
import { Notifier } from '../notify';
|
||||||
import { metadata } from '../metadata';
|
import { metadata } from '../metadata';
|
||||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
import { UiSettingsClient } from '../../../../core/public';
|
||||||
import { UiSettingsClient } from '../../../../core/public/ui_settings';
|
|
||||||
|
|
||||||
import './test_harness.css';
|
import './test_harness.css';
|
||||||
import 'ng_mock';
|
import 'ng_mock';
|
||||||
|
|
Loading…
Reference in a new issue