Skip to content

Commit

Permalink
remove last usages of plugin async lifecycles
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Sep 14, 2021
1 parent 182533f commit 90666e7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/plugins/presentation_util/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/lists/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ListPlugin
this.config = this.initializerContext.config.get<ConfigType>();
}

public async setup(core: CoreSetup): Promise<ListPluginSetup> {
public setup(core: CoreSetup): Promise<ListPluginSetup> {
const { config } = this;

initSavedObjects(core.savedObjects);
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/monitoring/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,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,
Expand All @@ -78,8 +76,9 @@ export class CorsTestPlugin implements Plugin {
return h.response(renderBody(kibanaUrl));
},
});
await server.start();
server.start();
}

public stop() {
if (this.server) {
this.server.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()];
});
}
}

0 comments on commit 90666e7

Please sign in to comment.