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

[Search] remove entsearch product access usage #206682

Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ export const DEFAULT_INITIAL_APP_DATA = {
},
},
},
access: {
hasAppSearchAccess: true,
hasWorkplaceSearchAccess: true,
},
features: {
hasConnectors: true,
hasDefaultIngestPipeline: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from './workplace_search';

export interface InitialAppData {
access?: ProductAccess;
appSearch?: AppSearchAccount;
configuredLimits?: ConfiguredLimits;
enterpriseSearchVersion?: string;
Expand All @@ -31,11 +30,6 @@ export interface ConfiguredLimits {
workplaceSearch: WorkplaceSearchConfiguredLimits;
}

export interface ProductAccess {
hasAppSearchAccess: boolean;
hasWorkplaceSearchAccess: boolean;
}

export interface ProductFeatures {
hasConnectors: boolean;
hasDefaultIngestPipeline: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ export const mockKibanaValues = {
} as unknown as LensPublicStart,
ml: mlPluginMock.createStartContract(),
navigateToUrl: jest.fn(),
productAccess: {
hasAppSearchAccess: true,
hasWorkplaceSearchAccess: true,
},
productFeatures: {
hasDocumentLevelSecurityEnabled: true,
hasIncrementalSyncEnabled: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import { kea, MakeLogicType } from 'kea';

import { Actions } from '../../../shared/api_logic/create_api_logic';
import { KibanaLogic } from '../../../shared/kibana/kibana_logic';
import {
AddConnectorApiLogic,
AddConnectorApiLogicArgs,
Expand Down Expand Up @@ -88,15 +87,12 @@ export const NewSearchIndexLogic = kea<MakeLogicType<NewSearchIndexValues, NewSe
},
listeners: ({ actions, values }) => ({
apiIndexCreated: () => {
if (!KibanaLogic.values.productAccess.hasAppSearchAccess) return;
flashIndexCreatedToast();
},
connectorIndexCreated: () => {
if (!KibanaLogic.values.productAccess.hasAppSearchAccess) return;
flashIndexCreatedToast();
},
crawlerIndexCreated: () => {
if (!KibanaLogic.values.productAccess.hasAppSearchAccess) return;
flashIndexCreatedToast();
},
setRawName: async (_, breakpoint) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import { Router } from '@kbn/shared-ux-router';

import { DEFAULT_PRODUCT_FEATURES } from '../../common/constants';
import { ClientConfigType, InitialAppData, ProductAccess } from '../../common/types';
import { ClientConfigType, InitialAppData } from '../../common/types';
import { PluginsStart, ClientData, ESConfig, UpdateSideNavDefinitionFn } from '../plugin';

import { externalUrl } from './shared/enterprise_search_url';
Expand Down Expand Up @@ -59,7 +59,6 @@ export const renderApp = (
{ config, data, esConfig }: { config: ClientConfigType; data: ClientData; esConfig: ESConfig }
) => {
const {
access,
appSearch,
configuredLimits,
enterpriseSearchVersion,
Expand Down Expand Up @@ -89,12 +88,6 @@ export const renderApp = (
const entCloudHost = getCloudEnterpriseSearchHost(plugins.cloud);
externalUrl.enterpriseSearchUrl = publicUrl || entCloudHost || config.host || '';

const noProductAccess: ProductAccess = {
hasAppSearchAccess: false,
hasWorkplaceSearchAccess: false,
};

const productAccess = access || noProductAccess;
const productFeatures = features ?? { ...DEFAULT_PRODUCT_FEATURES };

const EmptyContext: FC<PropsWithChildren<unknown>> = ({ children }) => <>{children}</>;
Expand Down Expand Up @@ -128,7 +121,6 @@ export const renderApp = (
lens,
ml,
navigateToUrl,
productAccess,
productFeatures,
renderHeaderActions: (HeaderActions) =>
params.setHeaderActionMenu(
Expand Down Expand Up @@ -170,7 +162,6 @@ export const renderApp = (
<Provider store={store}>
<Router history={params.history}>
<App
access={productAccess}
appSearch={appSearch}
configuredLimits={configuredLimits}
enterpriseSearchVersion={enterpriseSearchVersion}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { ConnectorDefinition } from '@kbn/search-connectors';
import { AuthenticatedUser, SecurityPluginStart } from '@kbn/security-plugin/public';
import { SharePluginStart } from '@kbn/share-plugin/public';

import { ClientConfigType, ProductAccess, ProductFeatures } from '../../../../common/types';
import { ClientConfigType, ProductFeatures } from '../../../../common/types';
import { ESConfig, UpdateSideNavDefinitionFn } from '../../../plugin';

import { HttpLogic } from '../http';
Expand Down Expand Up @@ -64,7 +64,6 @@ export interface KibanaLogicProps {
lens?: LensPublicStart;
ml?: MlPluginStart;
navigateToUrl: RequiredFieldsOnly<ApplicationStart['navigateToUrl']>;
productAccess: ProductAccess;
productFeatures: ProductFeatures;
renderHeaderActions(HeaderActions?: FC): void;
security?: SecurityPluginStart;
Expand Down Expand Up @@ -100,7 +99,6 @@ export interface KibanaValues {
lens: LensPublicStart | null;
ml: MlPluginStart | null;
navigateToUrl(path: string, options?: CreateHrefOptions): Promise<void>;
productAccess: ProductAccess;
productFeatures: ProductFeatures;
renderHeaderActions(HeaderActions?: FC): void;
security: SecurityPluginStart | null;
Expand Down Expand Up @@ -146,7 +144,6 @@ export const KibanaLogic = kea<MakeLogicType<KibanaValues>>({
},
{},
],
productAccess: [props.productAccess, {}],
productFeatures: [props.productFeatures, {}],
renderHeaderActions: [props.renderHeaderActions, {}],
security: [props.security || null, {}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,13 @@ import { renderHook } from '@testing-library/react';
import { EuiSideNavItemType } from '@elastic/eui';

import { DEFAULT_PRODUCT_FEATURES } from '../../../../common/constants';
import { ProductAccess } from '../../../../common/types';

import {
useEnterpriseSearchNav,
useEnterpriseSearchApplicationNav,
useEnterpriseSearchAnalyticsNav,
} from './nav';

const DEFAULT_PRODUCT_ACCESS: ProductAccess = {
hasAppSearchAccess: true,
hasWorkplaceSearchAccess: true,
};
const baseNavItems = [
expect.objectContaining({
'data-test-subj': 'searchSideNav-Home',
Expand Down Expand Up @@ -186,16 +181,6 @@ const mockNavLinks = [
title: 'Inference Endpoints',
url: '/app/elasticsearch/relevance/inference_endpoints',
},
{
id: 'appSearch:engines',
title: 'App Search',
url: '/app/enterprise_search/app_search',
},
{
id: 'workplaceSearch',
title: 'Workplace Search',
url: '/app/enterprise_search/workplace_search',
},
{
id: 'enterpriseSearchElasticsearch',
title: 'Elasticsearch',
Expand All @@ -221,7 +206,6 @@ const mockNavLinks = [
const defaultMockValues = {
hasEnterpriseLicense: true,
isSidebarEnabled: true,
productAccess: DEFAULT_PRODUCT_ACCESS,
productFeatures: DEFAULT_PRODUCT_FEATURES,
};

Expand All @@ -233,11 +217,7 @@ describe('useEnterpriseSearchContentNav', () => {
});

it('returns an array of top-level Enterprise Search nav items', () => {
const fullProductAccess: ProductAccess = DEFAULT_PRODUCT_ACCESS;
setMockValues({
...defaultMockValues,
productAccess: fullProductAccess,
});
setMockValues(defaultMockValues);

const { result } = renderHook(() => useEnterpriseSearchNav());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ export const mockKibanaProps: KibanaLogicProps = {
} as unknown as LensPublicStart,
ml: mlPluginMock.createStartContract(),
navigateToUrl: jest.fn(),
productAccess: {
hasAppSearchAccess: true,
hasWorkplaceSearchAccess: true,
},
productFeatures: {
hasConnectors: true,
hasDefaultIngestPipeline: true,
Expand Down
Loading
Loading