[Search] Deprecate canDeployEntSearch config value (#204272)

This commit is contained in:
Rodney Norris 2024-12-17 07:16:33 -06:00 committed by GitHub
parent 790c58932f
commit 9f53fbbcc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 74 additions and 99 deletions

View file

@ -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?)',

View file

@ -62,7 +62,6 @@ export interface Meta {
}
export interface ClientConfigType {
canDeployEntSearch: boolean;
host?: string;
ui: {
enabled: boolean;

View file

@ -80,9 +80,7 @@ export const SyncsContextMenu: React.FC<SyncsContextMenuProps> = ({ 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 ||

View file

@ -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(<EnterpriseSearchContent />);
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(<EnterpriseSearchContent />);
expect(wrapper.find(EnterpriseSearchContentConfigured)).toHaveLength(1);
});
});
describe('EnterpriseSearchContentConfigured', () => {

View file

@ -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', () => {

View file

@ -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(<ProductSelector />);
expect(wrapper.find(ElasticsearchProductCard)).toHaveLength(1);
});
it('renders the trial callout', () => {
setMockValues({ config: { canDeployEntSearch: true, host: 'localhost' } });
setMockValues({ config: { host: 'localhost' } });
const wrapper = shallow(<ProductSelector />);
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', () => {

View file

@ -44,7 +44,6 @@ export const mockKibanaProps: KibanaLogicProps = {
isCloudEnabled: false,
},
config: {
canDeployEntSearch: true,
host: 'http://localhost:3002',
ui: {
enabled: true,

View file

@ -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);
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();
// 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');
const { renderApp } = await import('./applications');
const { WorkplaceSearch } = await import('./applications/workplace_search');
return renderApp(WorkplaceSearch, kibanaDeps, pluginData);
},
title: WORKPLACE_SEARCH_PLUGIN.NAME,
visibleIn: [],
});
}
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',

View file

@ -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<typeof configSchema>;
export const config: PluginConfigDescriptor<ConfigType> = {
deprecations: ({ unused }) => [unused('canDeployEntSearch', { level: 'warning' })],
exposeToBrowser: {
canDeployEntSearch: true,
host: true,
ui: true,
},

View file

@ -50,7 +50,6 @@ describe('checkAccess', () => {
const mockDependencies = {
request: { auth: { isAuthenticated: true } },
config: {
canDeployEntSearch: true,
host: 'http://localhost:3002',
},
globalConfigService: new GlobalConfigService(),

View file

@ -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);
}

View file

@ -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,