Skip to content

Commit 77b0c6a

Browse files
remove last usages of plugin async lifecycles (#112111) (#112640)
* remove last usages of plugin async lifecycles * fix contract type * fix types. again. * remove unused import Co-authored-by: Pierre Gayvallet <[email protected]>
1 parent 5e8fc6d commit 77b0c6a

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

src/plugins/presentation_util/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Once your services and providers are defined, and you have at least one set of f
162162
import { pluginServices } from './services';
163163
import { registry } from './services/kibana';
164164

165-
public async start(
165+
public start(
166166
coreStart: CoreStart,
167167
startPlugins: StartDeps
168168
): Promise<PresentationUtilPluginStart> {

x-pack/plugins/lists/server/plugin.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ import { getUser } from './get_user';
2727
import { initSavedObjects } from './saved_objects';
2828
import { ExceptionListClient } from './services/exception_lists/exception_list_client';
2929

30-
export class ListPlugin
31-
implements Plugin<Promise<ListPluginSetup>, ListsPluginStart, {}, PluginsStart>
32-
{
30+
export class ListPlugin implements Plugin<ListPluginSetup, ListsPluginStart, {}, PluginsStart> {
3331
private readonly logger: Logger;
3432
private readonly config: ConfigType;
3533
private spaces: SpacesServiceStart | undefined | null;
@@ -40,7 +38,7 @@ export class ListPlugin
4038
this.config = this.initializerContext.config.get<ConfigType>();
4139
}
4240

43-
public async setup(core: CoreSetup): Promise<ListPluginSetup> {
41+
public setup(core: CoreSetup): ListPluginSetup {
4442
const { config } = this;
4543

4644
initSavedObjects(core.savedObjects);
@@ -70,7 +68,7 @@ export class ListPlugin
7068
};
7169
}
7270

73-
public start(core: CoreStart, plugins: PluginsStart): void {
71+
public start(core: CoreStart, plugins: PluginsStart): ListsPluginStart {
7472
this.logger.debug('Starting plugin');
7573
this.security = plugins.security;
7674
this.spaces = plugins.spaces?.spacesService;

x-pack/plugins/monitoring/server/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export class MonitoringPlugin
210210
}
211211
}
212212

213-
async start(coreStart: CoreStart, { licensing }: PluginsStart) {
213+
start(coreStart: CoreStart, { licensing }: PluginsStart) {
214214
const config = this.config!;
215215
this.cluster = instantiateClient(
216216
config.ui.elasticsearch,

x-pack/test/functional_cors/plugins/kibana_cors_test/server/plugin.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import Hapi from '@hapi/hapi';
99
import { kbnTestConfig } from '@kbn/test';
10-
import { take } from 'rxjs/operators';
1110
import Url from 'url';
1211
import abab from 'abab';
1312

@@ -47,20 +46,18 @@ fetch('${url}', {
4746

4847
export class CorsTestPlugin implements Plugin {
4948
private server?: Hapi.Server;
49+
5050
constructor(private readonly initializerContext: PluginInitializerContext) {}
5151

52-
async setup(core: CoreSetup) {
52+
setup(core: CoreSetup) {
5353
const router = core.http.createRouter();
5454
router.post({ path: '/cors-test', validate: false }, (context, req, res) =>
5555
res.ok({ body: 'content from kibana' })
5656
);
5757
}
5858

59-
async start(core: CoreStart) {
60-
const config = await this.initializerContext.config
61-
.create<ConfigSchema>()
62-
.pipe(take(1))
63-
.toPromise();
59+
start(core: CoreStart) {
60+
const config = this.initializerContext.config.get<ConfigSchema>();
6461

6562
const server = new Hapi.Server({
6663
port: config.port,
@@ -78,8 +75,9 @@ export class CorsTestPlugin implements Plugin {
7875
return h.response(renderBody(kibanaUrl));
7976
},
8077
});
81-
await server.start();
78+
server.start();
8279
}
80+
8381
public stop() {
8482
if (this.server) {
8583
this.server.stop();

x-pack/test/usage_collection/plugins/application_usage_test/public/plugin.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ import './types';
1212
export class ApplicationUsageTest implements Plugin {
1313
public setup(core: CoreSetup) {}
1414

15-
public async start(core: CoreStart) {
16-
const applications = await core.application.applications$.pipe(first()).toPromise();
17-
window.__applicationIds__ = [...applications.keys()];
15+
public start(core: CoreStart) {
16+
core.application.applications$
17+
.pipe(first())
18+
.toPromise()
19+
.then((applications) => {
20+
window.__applicationIds__ = [...applications.keys()];
21+
});
1822
}
1923
}

0 commit comments

Comments
 (0)