remove last usages of plugin async lifecycles (#112111)
* remove last usages of plugin async lifecycles * fix contract type * fix types. again. * remove unused import
This commit is contained in:
parent
221ee74c6b
commit
bb4f1360a8
|
@ -162,7 +162,7 @@ Once your services and providers are defined, and you have at least one set of f
|
||||||
import { pluginServices } from './services';
|
import { pluginServices } from './services';
|
||||||
import { registry } from './services/kibana';
|
import { registry } from './services/kibana';
|
||||||
|
|
||||||
public async start(
|
public start(
|
||||||
coreStart: CoreStart,
|
coreStart: CoreStart,
|
||||||
startPlugins: StartDeps
|
startPlugins: StartDeps
|
||||||
): Promise<PresentationUtilPluginStart> {
|
): Promise<PresentationUtilPluginStart> {
|
||||||
|
|
|
@ -27,9 +27,7 @@ import { getUser } from './get_user';
|
||||||
import { initSavedObjects } from './saved_objects';
|
import { initSavedObjects } from './saved_objects';
|
||||||
import { ExceptionListClient } from './services/exception_lists/exception_list_client';
|
import { ExceptionListClient } from './services/exception_lists/exception_list_client';
|
||||||
|
|
||||||
export class ListPlugin
|
export class ListPlugin implements Plugin<ListPluginSetup, ListsPluginStart, {}, PluginsStart> {
|
||||||
implements Plugin<Promise<ListPluginSetup>, ListsPluginStart, {}, PluginsStart>
|
|
||||||
{
|
|
||||||
private readonly logger: Logger;
|
private readonly logger: Logger;
|
||||||
private readonly config: ConfigType;
|
private readonly config: ConfigType;
|
||||||
private spaces: SpacesServiceStart | undefined | null;
|
private spaces: SpacesServiceStart | undefined | null;
|
||||||
|
@ -40,7 +38,7 @@ export class ListPlugin
|
||||||
this.config = this.initializerContext.config.get<ConfigType>();
|
this.config = this.initializerContext.config.get<ConfigType>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async setup(core: CoreSetup): Promise<ListPluginSetup> {
|
public setup(core: CoreSetup): ListPluginSetup {
|
||||||
const { config } = this;
|
const { config } = this;
|
||||||
|
|
||||||
initSavedObjects(core.savedObjects);
|
initSavedObjects(core.savedObjects);
|
||||||
|
@ -70,7 +68,7 @@ export class ListPlugin
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public start(core: CoreStart, plugins: PluginsStart): void {
|
public start(core: CoreStart, plugins: PluginsStart): ListsPluginStart {
|
||||||
this.logger.debug('Starting plugin');
|
this.logger.debug('Starting plugin');
|
||||||
this.security = plugins.security;
|
this.security = plugins.security;
|
||||||
this.spaces = plugins.spaces?.spacesService;
|
this.spaces = plugins.spaces?.spacesService;
|
||||||
|
|
|
@ -207,7 +207,7 @@ export class MonitoringPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async start(coreStart: CoreStart, { licensing }: PluginsStart) {
|
start(coreStart: CoreStart, { licensing }: PluginsStart) {
|
||||||
const config = this.config!;
|
const config = this.config!;
|
||||||
this.cluster = instantiateClient(
|
this.cluster = instantiateClient(
|
||||||
config.ui.elasticsearch,
|
config.ui.elasticsearch,
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
import Hapi from '@hapi/hapi';
|
import Hapi from '@hapi/hapi';
|
||||||
import { kbnTestConfig } from '@kbn/test';
|
import { kbnTestConfig } from '@kbn/test';
|
||||||
import { take } from 'rxjs/operators';
|
|
||||||
import Url from 'url';
|
import Url from 'url';
|
||||||
import abab from 'abab';
|
import abab from 'abab';
|
||||||
|
|
||||||
|
@ -47,20 +46,18 @@ fetch('${url}', {
|
||||||
|
|
||||||
export class CorsTestPlugin implements Plugin {
|
export class CorsTestPlugin implements Plugin {
|
||||||
private server?: Hapi.Server;
|
private server?: Hapi.Server;
|
||||||
|
|
||||||
constructor(private readonly initializerContext: PluginInitializerContext) {}
|
constructor(private readonly initializerContext: PluginInitializerContext) {}
|
||||||
|
|
||||||
async setup(core: CoreSetup) {
|
setup(core: CoreSetup) {
|
||||||
const router = core.http.createRouter();
|
const router = core.http.createRouter();
|
||||||
router.post({ path: '/cors-test', validate: false }, (context, req, res) =>
|
router.post({ path: '/cors-test', validate: false }, (context, req, res) =>
|
||||||
res.ok({ body: 'content from kibana' })
|
res.ok({ body: 'content from kibana' })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async start(core: CoreStart) {
|
start(core: CoreStart) {
|
||||||
const config = await this.initializerContext.config
|
const config = this.initializerContext.config.get<ConfigSchema>();
|
||||||
.create<ConfigSchema>()
|
|
||||||
.pipe(take(1))
|
|
||||||
.toPromise();
|
|
||||||
|
|
||||||
const server = new Hapi.Server({
|
const server = new Hapi.Server({
|
||||||
port: config.port,
|
port: config.port,
|
||||||
|
@ -78,8 +75,9 @@ export class CorsTestPlugin implements Plugin {
|
||||||
return h.response(renderBody(kibanaUrl));
|
return h.response(renderBody(kibanaUrl));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await server.start();
|
server.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public stop() {
|
public stop() {
|
||||||
if (this.server) {
|
if (this.server) {
|
||||||
this.server.stop();
|
this.server.stop();
|
||||||
|
|
|
@ -12,8 +12,12 @@ import './types';
|
||||||
export class ApplicationUsageTest implements Plugin {
|
export class ApplicationUsageTest implements Plugin {
|
||||||
public setup(core: CoreSetup) {}
|
public setup(core: CoreSetup) {}
|
||||||
|
|
||||||
public async start(core: CoreStart) {
|
public start(core: CoreStart) {
|
||||||
const applications = await core.application.applications$.pipe(first()).toPromise();
|
core.application.applications$
|
||||||
window.__applicationIds__ = [...applications.keys()];
|
.pipe(first())
|
||||||
|
.toPromise()
|
||||||
|
.then((applications) => {
|
||||||
|
window.__applicationIds__ = [...applications.keys()];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue