Skip to content

Commit 39b6857

Browse files
committed
use legacy helper in our own legacy TM obviously
1 parent a2cce60 commit 39b6857

File tree

1 file changed

+20
-27
lines changed
  • x-pack/legacy/plugins/task_manager/server

1 file changed

+20
-27
lines changed

x-pack/legacy/plugins/task_manager/server/index.ts

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import { Root } from 'joi';
88
import { Legacy } from 'kibana';
99
import mappings from './mappings.json';
1010
import { migrations } from './migrations';
11-
import { TaskManagerSetupContract } from '../../../../plugins/task_manager/server';
1211

13-
import { createLegacyApi } from './legacy';
12+
import { createLegacyApi, getTaskManagerSetup } from './legacy';
1413
export { LegacyTaskManagerApi, getTaskManagerSetup, getTaskManagerStart } from './legacy';
1514

1615
// Once all plugins are migrated to NP, this can be removed
@@ -43,35 +42,29 @@ export function taskManager(kibana: any) {
4342
}).default();
4443
},
4544
init(server: Legacy.Server) {
46-
const {
47-
newPlatform: {
48-
setup: {
49-
plugins: { taskManager: taskManagerPluginApi },
50-
},
51-
},
52-
} = server;
53-
54-
const legacyTaskManager = (taskManagerPluginApi as TaskManagerSetupContract)
55-
.registerLegacyAPI({
56-
savedObjectSchemas,
57-
})
58-
.then((taskManagerPlugin: TaskManager) => {
59-
// we can't tell the Kibana Platform Task Manager plugin to
60-
// to wait to `start` as that happens before legacy plugins
61-
// instead we will start the internal Task Manager plugin when
62-
// all legacy plugins have finished initializing
63-
// Once all plugins are migrated to NP, this can be removed
64-
this.kbnServer.afterPluginsInit(() => {
65-
taskManagerPlugin.start();
66-
});
67-
return taskManagerPlugin;
68-
});
69-
7045
/*
7146
* We must expose the New Platform Task Manager Plugin via the legacy Api
7247
* as removing it now would be a breaking change - we'll remove this in v8.0.0
7348
*/
74-
server.expose(createLegacyApi(legacyTaskManager));
49+
server.expose(
50+
createLegacyApi(
51+
getTaskManagerSetup(server)!
52+
.registerLegacyAPI({
53+
savedObjectSchemas,
54+
})
55+
.then((taskManagerPlugin: TaskManager) => {
56+
// we can't tell the Kibana Platform Task Manager plugin to
57+
// to wait to `start` as that happens before legacy plugins
58+
// instead we will start the internal Task Manager plugin when
59+
// all legacy plugins have finished initializing
60+
// Once all plugins are migrated to NP, this can be removed
61+
this.kbnServer.afterPluginsInit(() => {
62+
taskManagerPlugin.start();
63+
});
64+
return taskManagerPlugin;
65+
})
66+
)
67+
);
7568
},
7669
uiExports: {
7770
mappings,

0 commit comments

Comments
 (0)