mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
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
5 changed files with 18 additions and 18 deletions
|
@ -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 { registry } from './services/kibana';
|
||||
|
||||
public async start(
|
||||
public start(
|
||||
coreStart: CoreStart,
|
||||
startPlugins: StartDeps
|
||||
): Promise<PresentationUtilPluginStart> {
|
||||
|
|
|
@ -27,9 +27,7 @@ import { getUser } from './get_user';
|
|||
import { initSavedObjects } from './saved_objects';
|
||||
import { ExceptionListClient } from './services/exception_lists/exception_list_client';
|
||||
|
||||
export class ListPlugin
|
||||
implements Plugin<Promise<ListPluginSetup>, ListsPluginStart, {}, PluginsStart>
|
||||
{
|
||||
export class ListPlugin implements Plugin<ListPluginSetup, ListsPluginStart, {}, PluginsStart> {
|
||||
private readonly logger: Logger;
|
||||
private readonly config: ConfigType;
|
||||
private spaces: SpacesServiceStart | undefined | null;
|
||||
|
@ -40,7 +38,7 @@ export class ListPlugin
|
|||
this.config = this.initializerContext.config.get<ConfigType>();
|
||||
}
|
||||
|
||||
public async setup(core: CoreSetup): Promise<ListPluginSetup> {
|
||||
public setup(core: CoreSetup): ListPluginSetup {
|
||||
const { config } = this;
|
||||
|
||||
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.security = plugins.security;
|
||||
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!;
|
||||
this.cluster = instantiateClient(
|
||||
config.ui.elasticsearch,
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import Hapi from '@hapi/hapi';
|
||||
import { kbnTestConfig } from '@kbn/test';
|
||||
import { take } from 'rxjs/operators';
|
||||
import Url from 'url';
|
||||
import abab from 'abab';
|
||||
|
||||
|
@ -47,20 +46,18 @@ fetch('${url}', {
|
|||
|
||||
export class CorsTestPlugin implements Plugin {
|
||||
private server?: Hapi.Server;
|
||||
|
||||
constructor(private readonly initializerContext: PluginInitializerContext) {}
|
||||
|
||||
async setup(core: CoreSetup) {
|
||||
setup(core: CoreSetup) {
|
||||
const router = core.http.createRouter();
|
||||
router.post({ path: '/cors-test', validate: false }, (context, req, res) =>
|
||||
res.ok({ body: 'content from kibana' })
|
||||
);
|
||||
}
|
||||
|
||||
async start(core: CoreStart) {
|
||||
const config = await this.initializerContext.config
|
||||
.create<ConfigSchema>()
|
||||
.pipe(take(1))
|
||||
.toPromise();
|
||||
start(core: CoreStart) {
|
||||
const config = this.initializerContext.config.get<ConfigSchema>();
|
||||
|
||||
const server = new Hapi.Server({
|
||||
port: config.port,
|
||||
|
@ -78,8 +75,9 @@ export class CorsTestPlugin implements Plugin {
|
|||
return h.response(renderBody(kibanaUrl));
|
||||
},
|
||||
});
|
||||
await server.start();
|
||||
server.start();
|
||||
}
|
||||
|
||||
public stop() {
|
||||
if (this.server) {
|
||||
this.server.stop();
|
||||
|
|
|
@ -12,8 +12,12 @@ import './types';
|
|||
export class ApplicationUsageTest implements Plugin {
|
||||
public setup(core: CoreSetup) {}
|
||||
|
||||
public async start(core: CoreStart) {
|
||||
const applications = await core.application.applications$.pipe(first()).toPromise();
|
||||
window.__applicationIds__ = [...applications.keys()];
|
||||
public start(core: CoreStart) {
|
||||
core.application.applications$
|
||||
.pipe(first())
|
||||
.toPromise()
|
||||
.then((applications) => {
|
||||
window.__applicationIds__ = [...applications.keys()];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue