Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data plugin: Expose setup apis also on start #44903

Merged
merged 3 commits into from
Sep 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/legacy/core_plugins/data/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export class DataPlugin implements Plugin<DataSetup, DataStart, DataPluginSetupD
private readonly query: QueryService = new QueryService();
private readonly search: SearchService = new SearchService();

private setupApi!: DataSetup;

public setup(core: CoreSetup, { __LEGACY }: DataPluginSetupDependencies): DataSetup {
const { uiSettings } = core;
const savedObjectsClient = __LEGACY.savedObjectsClient;
Expand All @@ -87,7 +89,7 @@ export class DataPlugin implements Plugin<DataSetup, DataStart, DataPluginSetupD
uiSettings,
savedObjectsClient,
});
return {
this.setupApi = {
expressions: this.expressions.setup(),
indexPatterns: indexPatternsService,
filter: this.filter.setup({
Expand All @@ -97,10 +99,13 @@ export class DataPlugin implements Plugin<DataSetup, DataStart, DataPluginSetupD
query: this.query.setup(),
search: this.search.setup(savedObjectsClient),
};

return this.setupApi;
}

public start(core: CoreStart, plugins: DataPluginStartDependencies) {
return {
...this.setupApi!,
expressions: this.expressions.start({ inspector: plugins.inspector }),
};
}
Expand Down