From 9756d6c510b83afe470f0d2dc6e18e1aafd09701 Mon Sep 17 00:00:00 2001 From: Rodney Norris Date: Tue, 17 Dec 2024 07:16:33 -0600 Subject: [PATCH] [Search] Deprecate canDeployEntSearch config value (#204272) --- .../test_suites/core_plugins/rendering.ts | 1 - .../enterprise_search/common/types/index.ts | 1 - .../header_actions/syncs_context_menu.tsx | 4 +- .../enterprise_search_content/index.test.tsx | 9 +- .../enterprise_search_product_card.test.tsx | 2 +- .../product_selector.test.tsx | 6 +- .../test_helpers/test_utils.test_helper.tsx | 1 - .../enterprise_search/public/plugin.ts | 126 +++++++++--------- .../plugins/enterprise_search/server/index.ts | 3 +- .../server/lib/check_access.test.ts | 1 - .../enterprise_search/server/plugin.ts | 23 ++-- .../utils/search_result_provider.test.ts | 2 - 12 files changed, 77 insertions(+), 102 deletions(-) diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index 87b8fe406263b..1bda105ba07a6 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -128,7 +128,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'data_visualizer.resultLinks.fileBeat.enabled (boolean)', 'dev_tools.deeplinks.navLinkStatus (string?)', 'discover.experimental.enabledProfiles (array?)', - 'enterpriseSearch.canDeployEntSearch (boolean?)', 'enterpriseSearch.host (string?)', 'enterpriseSearch.ui.enabled (boolean?)', 'home.disableWelcomeScreen (boolean?)', diff --git a/x-pack/plugins/enterprise_search/common/types/index.ts b/x-pack/plugins/enterprise_search/common/types/index.ts index 1d9fb9b2cb0c1..364008ef18b49 100644 --- a/x-pack/plugins/enterprise_search/common/types/index.ts +++ b/x-pack/plugins/enterprise_search/common/types/index.ts @@ -62,7 +62,6 @@ export interface Meta { } export interface ClientConfigType { - canDeployEntSearch: boolean; host?: string; ui: { enabled: boolean; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/shared/header_actions/syncs_context_menu.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/shared/header_actions/syncs_context_menu.tsx index bdae6e0e2853c..b0c887a4c2228 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/shared/header_actions/syncs_context_menu.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/shared/header_actions/syncs_context_menu.tsx @@ -80,9 +80,7 @@ export const SyncsContextMenu: React.FC = ({ disabled = f const shouldShowIncrementalSync = productFeatures.hasIncrementalSyncEnabled && hasIncrementalSyncFeature; - const isEnterpriseSearchNotAvailable = Boolean( - config.host && config.canDeployEntSearch && errorConnectingMessage - ); + const isEnterpriseSearchNotAvailable = Boolean(config.host && errorConnectingMessage); const isSyncsDisabled = (connector?.is_native && isEnterpriseSearchNotAvailable) || ingestionStatus === IngestionStatus.INCOMPLETE || diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/index.test.tsx index a32062256eec5..dbbc6a746ee51 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/index.test.tsx @@ -29,20 +29,13 @@ describe('EnterpriseSearchContent', () => { it('renders EnterpriseSearchContentConfigured when config.host is set & available', () => { setMockValues({ - config: { canDeployEntSearch: true, host: 'some.url' }, + config: { host: 'some.url' }, errorConnectingMessage: '', }); const wrapper = shallow(); expect(wrapper.find(EnterpriseSearchContentConfigured)).toHaveLength(1); }); - - it('renders EnterpriseSearchContentConfigured when config.host is not set & Ent Search cannot be deployed', () => { - setMockValues({ config: { canDeployEntSearch: false, host: '' }, errorConnectingMessage: '' }); - const wrapper = shallow(); - - expect(wrapper.find(EnterpriseSearchContentConfigured)).toHaveLength(1); - }); }); describe('EnterpriseSearchContentConfigured', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/enterprise_search_product_card.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/enterprise_search_product_card.test.tsx index 74be43ab32253..b1c0394e80235 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/enterprise_search_product_card.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/enterprise_search_product_card.test.tsx @@ -17,7 +17,7 @@ import { WorkplaceSearchProductCard } from './workplace_search_product_card'; describe('EnterpriseSearchProductCard', () => { beforeEach(() => { - setMockValues({ config: { canDeployEntSearch: true, host: 'localhost' } }); + setMockValues({ config: { host: 'localhost' } }); }); it('renders both services with access', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/product_selector.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/product_selector.test.tsx index 3718a495cd17b..b8f7ba1d354d5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/product_selector.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/product_selector.test.tsx @@ -19,14 +19,14 @@ import { ProductSelector } from '.'; describe('ProductSelector', () => { it('renders the overview page, product cards, & setup guide CTAs with no host set', () => { - setMockValues({ config: { canDeployEntSearch: true, host: '' } }); + setMockValues({ config: { host: '' } }); const wrapper = shallow(); expect(wrapper.find(ElasticsearchProductCard)).toHaveLength(1); }); it('renders the trial callout', () => { - setMockValues({ config: { canDeployEntSearch: true, host: 'localhost' } }); + setMockValues({ config: { host: 'localhost' } }); const wrapper = shallow(); expect(wrapper.find(TrialCallout)).toHaveLength(1); @@ -34,7 +34,7 @@ describe('ProductSelector', () => { describe('access checks when host is set', () => { beforeEach(() => { - setMockValues({ config: { canDeployEntSearch: true, host: 'localhost' } }); + setMockValues({ config: { host: 'localhost' } }); }); it('does not render the Setup CTA when there is a host', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/test_helpers/test_utils.test_helper.tsx b/x-pack/plugins/enterprise_search/public/applications/test_helpers/test_utils.test_helper.tsx index e046bfa904e55..13694a3f7db64 100644 --- a/x-pack/plugins/enterprise_search/public/applications/test_helpers/test_utils.test_helper.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/test_helpers/test_utils.test_helper.tsx @@ -44,7 +44,6 @@ export const mockKibanaProps: KibanaLogicProps = { isCloudEnabled: false, }, config: { - canDeployEntSearch: true, host: 'http://localhost:3002', ui: { enabled: true, diff --git a/x-pack/plugins/enterprise_search/public/plugin.ts b/x-pack/plugins/enterprise_search/public/plugin.ts index 0f90f60d29749..0a472cd2aa564 100644 --- a/x-pack/plugins/enterprise_search/public/plugin.ts +++ b/x-pack/plugins/enterprise_search/public/plugin.ts @@ -441,55 +441,53 @@ export class EnterpriseSearchPlugin implements Plugin { registerLocators(share!); - if (config.canDeployEntSearch) { - core.application.register({ - appRoute: APP_SEARCH_PLUGIN.URL, - category: DEFAULT_APP_CATEGORIES.enterpriseSearch, - deepLinks: appSearchLinks, - euiIconType: ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.LOGO, - id: APP_SEARCH_PLUGIN.ID, - mount: async (params: AppMountParameters) => { - const kibanaDeps = await this.getKibanaDeps(core, params, cloud); - const { chrome, http } = kibanaDeps.core; - chrome.docTitle.change(APP_SEARCH_PLUGIN.NAME); + core.application.register({ + appRoute: APP_SEARCH_PLUGIN.URL, + category: DEFAULT_APP_CATEGORIES.enterpriseSearch, + deepLinks: appSearchLinks, + euiIconType: ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.LOGO, + id: APP_SEARCH_PLUGIN.ID, + mount: async (params: AppMountParameters) => { + const kibanaDeps = await this.getKibanaDeps(core, params, cloud); + const { chrome, http } = kibanaDeps.core; + chrome.docTitle.change(APP_SEARCH_PLUGIN.NAME); - await this.getInitialData(http); - const pluginData = this.getPluginData(); + await this.getInitialData(http); + const pluginData = this.getPluginData(); - const { renderApp } = await import('./applications'); - const { AppSearch } = await import('./applications/app_search'); + const { renderApp } = await import('./applications'); + const { AppSearch } = await import('./applications/app_search'); - return renderApp(AppSearch, kibanaDeps, pluginData); - }, - title: APP_SEARCH_PLUGIN.NAME, - visibleIn: [], - }); + return renderApp(AppSearch, kibanaDeps, pluginData); + }, + title: APP_SEARCH_PLUGIN.NAME, + visibleIn: [], + }); - core.application.register({ - appRoute: WORKPLACE_SEARCH_PLUGIN.URL, - category: DEFAULT_APP_CATEGORIES.enterpriseSearch, - euiIconType: ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.LOGO, - id: WORKPLACE_SEARCH_PLUGIN.ID, - mount: async (params: AppMountParameters) => { - const kibanaDeps = await this.getKibanaDeps(core, params, cloud); - const { chrome, http } = kibanaDeps.core; - chrome.docTitle.change(WORKPLACE_SEARCH_PLUGIN.NAME); - - // The Workplace Search Personal dashboard needs the chrome hidden. We hide it globally - // here first to prevent a flash of chrome on the Personal dashboard and unhide it for admin routes. - if (this.config.host) chrome.setIsVisible(false); - await this.getInitialData(http); - const pluginData = this.getPluginData(); - - const { renderApp } = await import('./applications'); - const { WorkplaceSearch } = await import('./applications/workplace_search'); - - return renderApp(WorkplaceSearch, kibanaDeps, pluginData); - }, - title: WORKPLACE_SEARCH_PLUGIN.NAME, - visibleIn: [], - }); - } + core.application.register({ + appRoute: WORKPLACE_SEARCH_PLUGIN.URL, + category: DEFAULT_APP_CATEGORIES.enterpriseSearch, + euiIconType: ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.LOGO, + id: WORKPLACE_SEARCH_PLUGIN.ID, + mount: async (params: AppMountParameters) => { + const kibanaDeps = await this.getKibanaDeps(core, params, cloud); + const { chrome, http } = kibanaDeps.core; + chrome.docTitle.change(WORKPLACE_SEARCH_PLUGIN.NAME); + + // The Workplace Search Personal dashboard needs the chrome hidden. We hide it globally + // here first to prevent a flash of chrome on the Personal dashboard and unhide it for admin routes. + if (this.config.host) chrome.setIsVisible(false); + await this.getInitialData(http); + const pluginData = this.getPluginData(); + + const { renderApp } = await import('./applications'); + const { WorkplaceSearch } = await import('./applications/workplace_search'); + + return renderApp(WorkplaceSearch, kibanaDeps, pluginData); + }, + title: WORKPLACE_SEARCH_PLUGIN.NAME, + visibleIn: [], + }); if (plugins.home) { plugins.home.featureCatalogue.registerSolution({ @@ -511,27 +509,25 @@ export class EnterpriseSearchPlugin implements Plugin { title: ANALYTICS_PLUGIN.NAME, }); - if (config.canDeployEntSearch) { - plugins.home.featureCatalogue.register({ - category: 'data', - description: APP_SEARCH_PLUGIN.DESCRIPTION, - icon: 'appSearchApp', - id: APP_SEARCH_PLUGIN.ID, - path: APP_SEARCH_PLUGIN.URL, - showOnHomePage: false, - title: APP_SEARCH_PLUGIN.NAME, - }); + plugins.home.featureCatalogue.register({ + category: 'data', + description: APP_SEARCH_PLUGIN.DESCRIPTION, + icon: 'appSearchApp', + id: APP_SEARCH_PLUGIN.ID, + path: APP_SEARCH_PLUGIN.URL, + showOnHomePage: false, + title: APP_SEARCH_PLUGIN.NAME, + }); - plugins.home.featureCatalogue.register({ - category: 'data', - description: WORKPLACE_SEARCH_PLUGIN.DESCRIPTION, - icon: 'workplaceSearchApp', - id: WORKPLACE_SEARCH_PLUGIN.ID, - path: WORKPLACE_SEARCH_PLUGIN.URL, - showOnHomePage: false, - title: WORKPLACE_SEARCH_PLUGIN.NAME, - }); - } + plugins.home.featureCatalogue.register({ + category: 'data', + description: WORKPLACE_SEARCH_PLUGIN.DESCRIPTION, + icon: 'workplaceSearchApp', + id: WORKPLACE_SEARCH_PLUGIN.ID, + path: WORKPLACE_SEARCH_PLUGIN.URL, + showOnHomePage: false, + title: WORKPLACE_SEARCH_PLUGIN.NAME, + }); plugins.home.featureCatalogue.register({ category: 'data', diff --git a/x-pack/plugins/enterprise_search/server/index.ts b/x-pack/plugins/enterprise_search/server/index.ts index 53d8cbca7f540..9efaa123ea996 100644 --- a/x-pack/plugins/enterprise_search/server/index.ts +++ b/x-pack/plugins/enterprise_search/server/index.ts @@ -16,7 +16,6 @@ export const plugin = async (initializerContext: PluginInitializerContext) => { export const configSchema = schema.object({ accessCheckTimeout: schema.number({ defaultValue: 5000 }), accessCheckTimeoutWarning: schema.number({ defaultValue: 300 }), - canDeployEntSearch: schema.boolean({ defaultValue: true }), customHeaders: schema.maybe(schema.object({}, { unknowns: 'allow' })), enabled: schema.boolean({ defaultValue: true }), hasConnectors: schema.boolean({ defaultValue: true }), @@ -44,8 +43,8 @@ export const configSchema = schema.object({ export type ConfigType = TypeOf; export const config: PluginConfigDescriptor = { + deprecations: ({ unused }) => [unused('canDeployEntSearch', { level: 'warning' })], exposeToBrowser: { - canDeployEntSearch: true, host: true, ui: true, }, diff --git a/x-pack/plugins/enterprise_search/server/lib/check_access.test.ts b/x-pack/plugins/enterprise_search/server/lib/check_access.test.ts index ab4b27ed1f1c2..ef956ae85f689 100644 --- a/x-pack/plugins/enterprise_search/server/lib/check_access.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/check_access.test.ts @@ -50,7 +50,6 @@ describe('checkAccess', () => { const mockDependencies = { request: { auth: { isAuthenticated: true } }, config: { - canDeployEntSearch: true, host: 'http://localhost:3002', }, globalConfigService: new GlobalConfigService(), diff --git a/x-pack/plugins/enterprise_search/server/plugin.ts b/x-pack/plugins/enterprise_search/server/plugin.ts index 0fbbc174c83db..1d4ba5e6dfd1f 100644 --- a/x-pack/plugins/enterprise_search/server/plugin.ts +++ b/x-pack/plugins/enterprise_search/server/plugin.ts @@ -169,7 +169,8 @@ export class EnterpriseSearchPlugin implements Plugin { ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.ID, ENTERPRISE_SEARCH_CONTENT_PLUGIN.ID, ELASTICSEARCH_PLUGIN.ID, - ...(config.canDeployEntSearch ? [APP_SEARCH_PLUGIN.ID, WORKPLACE_SEARCH_PLUGIN.ID] : []), + APP_SEARCH_PLUGIN.ID, + WORKPLACE_SEARCH_PLUGIN.ID, SEARCH_EXPERIENCES_PLUGIN.ID, VECTOR_SEARCH_PLUGIN.ID, SEMANTIC_SEARCH_PLUGIN.ID, @@ -300,9 +301,9 @@ export class EnterpriseSearchPlugin implements Plugin { }; registerConfigDataRoute(dependencies); - if (config.canDeployEntSearch) registerAppSearchRoutes(dependencies); + registerAppSearchRoutes(dependencies); registerEnterpriseSearchRoutes(dependencies); - if (config.canDeployEntSearch) registerWorkplaceSearchRoutes(dependencies); + registerWorkplaceSearchRoutes(dependencies); // Enterprise Search Routes if (config.hasConnectors) registerConnectorRoutes(dependencies); if (config.hasWebCrawler) registerCrawlerRoutes(dependencies); @@ -319,10 +320,8 @@ export class EnterpriseSearchPlugin implements Plugin { * Bootstrap the routes, saved objects, and collector for telemetry */ savedObjects.registerType(enterpriseSearchTelemetryType); - if (config.canDeployEntSearch) { - savedObjects.registerType(appSearchTelemetryType); - savedObjects.registerType(workplaceSearchTelemetryType); - } + savedObjects.registerType(appSearchTelemetryType); + savedObjects.registerType(workplaceSearchTelemetryType); let savedObjectsStarted: SavedObjectsServiceStart; void getStartServices().then(([coreStart]) => { @@ -331,10 +330,8 @@ export class EnterpriseSearchPlugin implements Plugin { if (usageCollection) { registerESTelemetryUsageCollector(usageCollection, savedObjectsStarted, this.logger); registerCNTelemetryUsageCollector(usageCollection, this.logger); - if (config.canDeployEntSearch) { - registerASTelemetryUsageCollector(usageCollection, savedObjectsStarted, this.logger); - registerWSTelemetryUsageCollector(usageCollection, savedObjectsStarted, this.logger); - } + registerASTelemetryUsageCollector(usageCollection, savedObjectsStarted, this.logger); + registerWSTelemetryUsageCollector(usageCollection, savedObjectsStarted, this.logger); } }); registerTelemetryRoute({ ...dependencies, getSavedObjectsService: () => savedObjectsStarted }); @@ -370,9 +367,7 @@ export class EnterpriseSearchPlugin implements Plugin { /** * Register a config for the search guide */ - if (config.canDeployEntSearch) { - guidedOnboarding?.registerGuideConfig(appSearchGuideId, appSearchGuideConfig); - } + guidedOnboarding?.registerGuideConfig(appSearchGuideId, appSearchGuideConfig); if (config.hasWebCrawler) { guidedOnboarding?.registerGuideConfig(websiteSearchGuideId, websiteSearchGuideConfig); } diff --git a/x-pack/plugins/enterprise_search/server/utils/search_result_provider.test.ts b/x-pack/plugins/enterprise_search/server/utils/search_result_provider.test.ts index 3e7a0777dad23..b3709df9ef5bd 100644 --- a/x-pack/plugins/enterprise_search/server/utils/search_result_provider.test.ts +++ b/x-pack/plugins/enterprise_search/server/utils/search_result_provider.test.ts @@ -292,7 +292,6 @@ describe('Search search provider', () => { it('does not return results for legacy app search', () => { const searchProvider = getSearchResultProvider( { - canDeployEntSearch: true, hasConnectors: false, hasWebCrawler: false, } as any, @@ -315,7 +314,6 @@ describe('Search search provider', () => { it('does not return results for legacy workplace search', () => { const searchProvider = getSearchResultProvider( { - canDeployEntSearch: true, hasConnectors: false, hasWebCrawler: false, } as any,