Skip to content

Commit

Permalink
Pass empty ProfilesManager to DiscoverContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
davismcphee committed Jun 7, 2024
1 parent f2e6788 commit 643e98d
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/plugins/discover/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ export class DiscoverPlugin
plugins.uiActions.registerTrigger(SEARCH_EMBEDDABLE_CELL_ACTIONS_TRIGGER);
injectTruncateStyles(core.uiSettings.get(TRUNCATE_MAX_HEIGHT));

const getDiscoverServicesInternal = () => this.getDiscoverServices(core, plugins);
const isEsqlEnabled = core.uiSettings.get(ENABLE_ESQL);

if (plugins.share && this.locator && isEsqlEnabled) {
Expand All @@ -441,6 +440,10 @@ export class DiscoverPlugin
);
}

const getDiscoverServicesInternal = () => {
return this.getDiscoverServices(core, plugins, this.createEmptyProfilesManager());
};

return {
locator: this.locator,
DiscoverContainer: (props: DiscoverContainerProps) => (
Expand Down Expand Up @@ -470,7 +473,19 @@ export class DiscoverPlugin
);
}

private getDiscoverServices = (core: CoreStart, plugins: DiscoverStartPlugins) => {
private createEmptyProfilesManager() {
return new ProfilesManager(
new RootProfileService(),
new DataSourceProfileService(),
new DocumentProfileService()
);
}

private getDiscoverServices = (
core: CoreStart,
plugins: DiscoverStartPlugins,
profilesManager = this.createProfilesManager()
) => {
return buildServices({
core,
plugins,
Expand All @@ -480,7 +495,7 @@ export class DiscoverPlugin
singleDocLocator: this.singleDocLocator!,
history: this.historyService.getHistory(),
urlTracker: this.urlTracker!,
profilesManager: this.createProfilesManager(),
profilesManager,
});
};

Expand Down

0 comments on commit 643e98d

Please sign in to comment.