From eeef2570ffa8f82c1baf926ec01b412c1b4de9da Mon Sep 17 00:00:00 2001 From: Rodney Norris Date: Thu, 2 Mar 2023 19:32:46 +0000 Subject: [PATCH] Enterprise Search: pass isSidebarEnabled by value instead of a get function --- .../enterprise_search/public/applications/index.tsx | 6 +++--- .../public/applications/shared/kibana/kibana_logic.ts | 9 ++------- x-pack/plugins/enterprise_search/public/plugin.ts | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/index.tsx b/x-pack/plugins/enterprise_search/public/applications/index.tsx index f88ae1d0ab287..5b3b050d72238 100644 --- a/x-pack/plugins/enterprise_search/public/applications/index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/index.tsx @@ -40,12 +40,12 @@ export const renderApp = ( params, core, plugins, - getIsSidebarEnabled, + isSidebarEnabled, }: { params: AppMountParameters; core: CoreStart; plugins: PluginsStart; - getIsSidebarEnabled: () => boolean; + isSidebarEnabled: boolean; }, { config, data }: { config: ClientConfigType; data: ClientData } ) => { @@ -74,7 +74,7 @@ export const renderApp = ( charts: plugins.charts, cloud: plugins.cloud, uiSettings: core.uiSettings, - getIsSidebarEnabled, + isSidebarEnabled, guidedOnboarding: plugins.guidedOnboarding, history: params.history, navigateToUrl: core.application.navigateToUrl, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts index 5ab00b869e93f..418baa7050732 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/kibana/kibana_logic.ts @@ -33,7 +33,7 @@ interface KibanaLogicProps { application: ApplicationStart; config: { host?: string }; productAccess: ProductAccess; - getIsSidebarEnabled: () => boolean; + isSidebarEnabled: boolean; // Kibana core capabilities: Capabilities; history: ScopedHistory; @@ -54,7 +54,6 @@ interface KibanaLogicProps { export interface KibanaValues extends Omit { cloud: Partial; isCloud: boolean; - isSidebarEnabled: boolean; navigateToUrl(path: string, options?: CreateHrefOptions): Promise; } @@ -66,9 +65,9 @@ export const KibanaLogic = kea>({ config: [props.config || {}, {}], charts: [props.charts, {}], cloud: [props.cloud || {}, {}], - getIsSidebarEnabled: [props.getIsSidebarEnabled, {}], guidedOnboarding: [props.guidedOnboarding, {}], history: [props.history, {}], + isSidebarEnabled: [props.isSidebarEnabled, {}], navigateToUrl: [ (url: string, options?: CreateHrefOptions) => { const deps = { history: props.history, http: HttpLogic.values.http }; @@ -87,10 +86,6 @@ export const KibanaLogic = kea>({ }), selectors: ({ selectors }) => ({ isCloud: [() => [selectors.cloud], (cloud?: Partial) => !!cloud?.isCloudEnabled], - isSidebarEnabled: [ - () => [selectors.getIsSidebarEnabled], - (getIsSidebarEnabled: () => boolean) => getIsSidebarEnabled(), - ], }), }); diff --git a/x-pack/plugins/enterprise_search/public/plugin.ts b/x-pack/plugins/enterprise_search/public/plugin.ts index e733d1811a1d1..9aded65b54eb5 100644 --- a/x-pack/plugins/enterprise_search/public/plugin.ts +++ b/x-pack/plugins/enterprise_search/public/plugin.ts @@ -324,7 +324,7 @@ export class EnterpriseSearchPlugin implements Plugin { : undefined; const plugins = { ...pluginsStart, cloud } as PluginsStart; - return { params, core: coreStart, plugins, getIsSidebarEnabled: () => this.isSidebarEnabled }; + return { params, core: coreStart, plugins, isSidebarEnabled: this.isSidebarEnabled }; } private getPluginData() {