Skip to content

Commit

Permalink
[Search][Ent Search deprecation] Removing VersionMismatchPage (elasti…
Browse files Browse the repository at this point in the history
…c#202407)

## Summary

This PR removes the consumption of the
[VersionMismatchPage](https://github.com/elastic/kibana/blob/main/x-pack/plugins/enterprise_search/public/applications/shared/version_mismatch/version_mismatch_page.tsx)
component. Where we were informing about version mismatching versions
between Kibana and Enterprise Search. Due to Enterprise Search node will
go away in 9.0 and as a part of this epic:
elastic/search-team#8231


![image](https://github.com/user-attachments/assets/43341d94-8443-4fe3-9126-253ee34b5e92)
  • Loading branch information
JoseLuisGJ authored Dec 2, 2024
1 parent fc8ca4f commit 41e8de6
Show file tree
Hide file tree
Showing 23 changed files with 17 additions and 371 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,17 @@ import React from 'react';

import { Routes, Route } from '@kbn/shared-ux-router';

import { isVersionMismatch } from '../../../common/is_version_mismatch';
import { InitialAppData } from '../../../common/types';
import { VersionMismatchPage } from '../shared/version_mismatch';

import { AISearchGuide } from './components/ai_search_guide/ai_search_guide';

import { ROOT_PATH } from './routes';

export const EnterpriseSearchAISearch: React.FC<InitialAppData> = (props) => {
const { enterpriseSearchVersion, kibanaVersion } = props;
const incompatibleVersions = isVersionMismatch(enterpriseSearchVersion, kibanaVersion);

const showView = () => {
if (incompatibleVersions) {
return (
<VersionMismatchPage
enterpriseSearchVersion={enterpriseSearchVersion}
kibanaVersion={kibanaVersion}
/>
);
}

return <AISearchGuide />;
};

export const EnterpriseSearchAISearch: React.FC<InitialAppData> = () => {
return (
<Routes>
<Route exact path={ROOT_PATH}>
{showView()}
<AISearchGuide />
</Route>
</Routes>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import React from 'react';

import { shallow } from 'enzyme';

import { VersionMismatchPage } from '../shared/version_mismatch';

import { AnalyticsOverview } from './components/analytics_overview/analytics_overview';

import { Analytics } from '.';
Expand All @@ -30,10 +28,4 @@ describe('EnterpriseSearchAnalytics', () => {

expect(wrapper.find(AnalyticsOverview)).toHaveLength(1);
});

it('renders VersionMismatchPage when there are mismatching versions', () => {
const wrapper = shallow(<Analytics enterpriseSearchVersion="7.15.0" kibanaVersion="7.16.0" />);

expect(wrapper.find(VersionMismatchPage)).toHaveLength(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,18 @@ import React from 'react';

import { Routes, Route } from '@kbn/shared-ux-router';

import { isVersionMismatch } from '../../../common/is_version_mismatch';
import { InitialAppData } from '../../../common/types';
import { VersionMismatchPage } from '../shared/version_mismatch';

import { AnalyticsCollectionView } from './components/analytics_collection_view/analytics_collection_view';
import { AnalyticsOverview } from './components/analytics_overview/analytics_overview';

import { ROOT_PATH, COLLECTION_VIEW_PATH } from './routes';

export const Analytics: React.FC<InitialAppData> = (props) => {
const { enterpriseSearchVersion, kibanaVersion } = props;
const incompatibleVersions = isVersionMismatch(enterpriseSearchVersion, kibanaVersion);

export const Analytics: React.FC<InitialAppData> = () => {
return (
<Routes>
<Route exact path={ROOT_PATH}>
{incompatibleVersions ? (
<VersionMismatchPage
enterpriseSearchVersion={enterpriseSearchVersion}
kibanaVersion={kibanaVersion}
/>
) : (
<AnalyticsOverview />
)}
<AnalyticsOverview />
</Route>
<Route path={COLLECTION_VIEW_PATH}>
<AnalyticsCollectionView />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { Redirect } from 'react-router-dom';

import { shallow, ShallowWrapper } from 'enzyme';

import { VersionMismatchPage } from '../shared/version_mismatch';
import { rerender } from '../test_helpers';

jest.mock('./app_logic', () => ({ AppLogic: jest.fn() }));
Expand All @@ -42,12 +41,6 @@ describe('AppSearch', () => {
expect(wrapper.find(SetupGuide)).toHaveLength(1);
});

it('renders VersionMismatchPage when there are mismatching versions', () => {
const wrapper = shallow(<AppSearch enterpriseSearchVersion="7.15.0" kibanaVersion="7.16.0" />);

expect(wrapper.find(VersionMismatchPage)).toHaveLength(1);
});

it('renders AppSearchUnconfigured when config.host is not set', () => {
setMockValues({ config: { host: '' } });
const wrapper = shallow(<AppSearch />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ import { useValues } from 'kea';

import { Routes, Route } from '@kbn/shared-ux-router';

import { isVersionMismatch } from '../../../common/is_version_mismatch';
import { InitialAppData } from '../../../common/types';
import { HttpLogic } from '../shared/http';
import { KibanaLogic } from '../shared/kibana';
import { EndpointsHeaderAction } from '../shared/layout/endpoints_header_action';
import { VersionMismatchPage } from '../shared/version_mismatch';

import { AppLogic } from './app_logic';
import { Credentials } from './components/credentials';
Expand Down Expand Up @@ -48,19 +46,10 @@ import {
export const AppSearch: React.FC<InitialAppData> = (props) => {
const { config } = useValues(KibanaLogic);
const { errorConnectingMessage } = useValues(HttpLogic);
const { enterpriseSearchVersion, kibanaVersion } = props;
const incompatibleVersions = isVersionMismatch(enterpriseSearchVersion, kibanaVersion);

const showView = () => {
if (!config.host) {
return <AppSearchUnconfigured />;
} else if (incompatibleVersions) {
return (
<VersionMismatchPage
enterpriseSearchVersion={enterpriseSearchVersion}
kibanaVersion={kibanaVersion}
/>
);
} else if (errorConnectingMessage) {
return <ErrorConnecting />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,17 @@ import React from 'react';

import { Routes, Route } from '@kbn/shared-ux-router';

import { isVersionMismatch } from '../../../common/is_version_mismatch';
import { InitialAppData } from '../../../common/types';
import { VersionMismatchPage } from '../shared/version_mismatch';

import { ElasticsearchGuide } from './components/elasticsearch_guide/elasticsearch_guide';

import { ROOT_PATH } from './routes';

export const Elasticsearch: React.FC<InitialAppData> = (props) => {
const { enterpriseSearchVersion, kibanaVersion } = props;
const incompatibleVersions = isVersionMismatch(enterpriseSearchVersion, kibanaVersion);

const showView = () => {
if (incompatibleVersions) {
return (
<VersionMismatchPage
enterpriseSearchVersion={enterpriseSearchVersion}
kibanaVersion={kibanaVersion}
/>
);
}

return <ElasticsearchGuide />;
};

export const Elasticsearch: React.FC<InitialAppData> = () => {
return (
<Routes>
<Route exact path={ROOT_PATH}>
{showView()}
<ElasticsearchGuide />
</Route>
</Routes>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import React from 'react';
import { shallow } from 'enzyme';

import { SetupGuide } from '../enterprise_search_overview/components/setup_guide';
import { VersionMismatchPage } from '../shared/version_mismatch';

import { SearchIndicesRouter } from './components/search_indices';

Expand All @@ -28,15 +27,6 @@ describe('EnterpriseSearchContent', () => {
expect(wrapper.find(SetupGuide)).toHaveLength(1);
});

it('renders VersionMismatchPage when there are mismatching versions', () => {
setMockValues({ config: { canDeployEntSearch: true, host: 'host' } });
const wrapper = shallow(
<EnterpriseSearchContent enterpriseSearchVersion="7.15.0" kibanaVersion="7.16.0" />
);

expect(wrapper.find(VersionMismatchPage)).toHaveLength(1);
});

it('renders EnterpriseSearchContentConfigured when config.host is set & available', () => {
setMockValues({
config: { canDeployEntSearch: true, host: 'some.url' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ import { useValues } from 'kea';

import { Route, Routes } from '@kbn/shared-ux-router';

import { isVersionMismatch } from '../../../common/is_version_mismatch';
import { InitialAppData } from '../../../common/types';
import { SetupGuide } from '../enterprise_search_overview/components/setup_guide';
import { ErrorStatePrompt } from '../shared/error_state';
import { HttpLogic } from '../shared/http';
import { KibanaLogic } from '../shared/kibana';
import { VersionMismatchPage } from '../shared/version_mismatch';

import { ConnectorsRouter } from './components/connectors/connectors_router';
import { CrawlersRouter } from './components/connectors/crawlers_router';
Expand All @@ -36,21 +34,6 @@ import {
export const EnterpriseSearchContent: React.FC<InitialAppData> = (props) => {
const { config } = useValues(KibanaLogic);
const { errorConnectingMessage } = useValues(HttpLogic);
const { enterpriseSearchVersion, kibanaVersion } = props;
const incompatibleVersions = isVersionMismatch(enterpriseSearchVersion, kibanaVersion);

const showView = () => {
if (config.host && config.canDeployEntSearch && incompatibleVersions) {
return (
<VersionMismatchPage
enterpriseSearchVersion={enterpriseSearchVersion}
kibanaVersion={kibanaVersion}
/>
);
}

return <EnterpriseSearchContentConfigured {...(props as Required<InitialAppData>)} />;
};

return (
<Routes>
Expand All @@ -64,7 +47,9 @@ export const EnterpriseSearchContent: React.FC<InitialAppData> = (props) => {
<Redirect to={SEARCH_INDICES_PATH} />
)}
</Route>
<Route>{showView()}</Route>
<Route>
<EnterpriseSearchContentConfigured {...(props as Required<InitialAppData>)} />
</Route>
</Routes>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import React from 'react';

import { shallow } from 'enzyme';

import { VersionMismatchPage } from '../shared/version_mismatch';

import { ProductSelector } from './components/product_selector';
import { SetupGuide } from './components/setup_guide';

Expand All @@ -29,17 +27,4 @@ describe('EnterpriseSearchOverview', () => {
expect(wrapper.find(SetupGuide)).toHaveLength(1);
expect(wrapper.find(ProductSelector)).toHaveLength(1);
});

it('renders the version error message if versions mismatch and the host is configured', () => {
setMockValues({
errorConnectingMessage: '',
config: { host: 'localhost' },
});
const wrapper = shallow(
<EnterpriseSearchOverview enterpriseSearchVersion="7.15.0" kibanaVersion="7.16.0" />
);

expect(wrapper.find(VersionMismatchPage)).toHaveLength(1);
expect(wrapper.find(ProductSelector)).toHaveLength(0);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,22 @@

import React from 'react';

import { useValues } from 'kea';

import { Routes, Route } from '@kbn/shared-ux-router';

import { isVersionMismatch } from '../../../common/is_version_mismatch';
import { InitialAppData } from '../../../common/types';
import { KibanaLogic } from '../shared/kibana';
import { VersionMismatchPage } from '../shared/version_mismatch';

import { ProductSelector } from './components/product_selector';
import { SetupGuide } from './components/setup_guide';
import { ROOT_PATH, SETUP_GUIDE_PATH } from './routes';

export const EnterpriseSearchOverview: React.FC<InitialAppData> = ({
enterpriseSearchVersion,
kibanaVersion,
}) => {
const { config } = useValues(KibanaLogic);

const incompatibleVersions = !!(
config.host && isVersionMismatch(enterpriseSearchVersion, kibanaVersion)
);

const showView = () => {
if (incompatibleVersions) {
return (
<VersionMismatchPage
enterpriseSearchVersion={enterpriseSearchVersion}
kibanaVersion={kibanaVersion}
/>
);
}

return <ProductSelector />;
};

export const EnterpriseSearchOverview: React.FC<InitialAppData> = ({}) => {
return (
<Routes>
<Route exact path={SETUP_GUIDE_PATH}>
<SetupGuide />
</Route>
<Route exact path={ROOT_PATH}>
{showView()}
<ProductSelector />
</Route>
</Routes>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,17 @@ import React from 'react';

import { Routes, Route } from '@kbn/shared-ux-router';

import { isVersionMismatch } from '../../../common/is_version_mismatch';
import { InitialAppData } from '../../../common/types';
import { VersionMismatchPage } from '../shared/version_mismatch';

import { SearchExperiencesGuide } from './components/search_experiences_guide';

import { ROOT_PATH } from './routes';

export const SearchExperiences: React.FC<InitialAppData> = (props) => {
const { enterpriseSearchVersion, kibanaVersion } = props;
const incompatibleVersions = isVersionMismatch(enterpriseSearchVersion, kibanaVersion);

const showView = () => {
if (incompatibleVersions) {
return (
<VersionMismatchPage
enterpriseSearchVersion={enterpriseSearchVersion}
kibanaVersion={kibanaVersion}
/>
);
}

return <SearchExperiencesGuide />;
};

export const SearchExperiences: React.FC<InitialAppData> = () => {
return (
<Routes>
<Route exact path={ROOT_PATH}>
{showView()}
<SearchExperiencesGuide />
</Route>
</Routes>
);
Expand Down
Loading

0 comments on commit 41e8de6

Please sign in to comment.