Temporarily remove Layout from App Search plugin for 7.10 release (#79506)

- Since our other top level pages (settings, credentials, role mappings) aren't yet ready, we'll stick to the same UI for 7.9, only showing the Engines Overview to users
This commit is contained in:
Constance 2020-10-05 11:51:21 -07:00 committed by GitHub
parent a08fe39710
commit d5b8a95694
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 31 deletions

View file

@ -13,7 +13,7 @@ import React from 'react';
import { Redirect } from 'react-router-dom';
import { shallow } from 'enzyme';
import { Layout, SideNav, SideNavLink } from '../shared/layout';
import { SideNav, SideNavLink } from '../shared/layout';
import { SetupGuide } from './components/setup_guide';
import { ErrorConnecting } from './components/error_connecting';
import { EngineOverview } from './components/engine_overview';
@ -51,11 +51,9 @@ describe('AppSearchConfigured', () => {
setMockActions({ initializeAppData: () => {} });
});
it('renders with layout', () => {
it('renders', () => {
const wrapper = shallow(<AppSearchConfigured />);
expect(wrapper.find(Layout)).toHaveLength(1);
expect(wrapper.find(Layout).prop('readOnlyMode')).toBeFalsy();
expect(wrapper.find(EngineOverview)).toHaveLength(1);
});
@ -86,14 +84,6 @@ describe('AppSearchConfigured', () => {
expect(wrapper.find(ErrorConnecting)).toHaveLength(1);
});
it('passes readOnlyMode state', () => {
setMockValues({ myRole: {}, readOnlyMode: true });
const wrapper = shallow(<AppSearchConfigured />);
expect(wrapper.find(Layout).prop('readOnlyMode')).toEqual(true);
});
describe('ability checks', () => {
// TODO: Use this section for routes wrapped in canViewX conditionals
// e.g., it('renders settings if a user can view settings')

View file

@ -8,6 +8,7 @@ import React, { useEffect } from 'react';
import { Route, Redirect, Switch } from 'react-router-dom';
import { useActions, useValues } from 'kea';
import { EuiPage, EuiPageBody } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { getAppSearchUrl } from '../shared/enterprise_search_url';
@ -17,7 +18,7 @@ import { AppLogic } from './app_logic';
import { IInitialAppData } from '../../../common/types';
import { APP_SEARCH_PLUGIN } from '../../../common/constants';
import { Layout, SideNav, SideNavLink } from '../shared/layout';
import { SideNav, SideNavLink } from '../shared/layout';
import {
ROOT_PATH,
@ -52,7 +53,7 @@ export const AppSearchUnconfigured: React.FC = () => (
export const AppSearchConfigured: React.FC<IInitialAppData> = (props) => {
const { initializeAppData } = useActions(AppLogic);
const { hasInitialized } = useValues(AppLogic);
const { errorConnecting, readOnlyMode } = useValues(HttpLogic);
const { errorConnecting } = useValues(HttpLogic);
useEffect(() => {
if (!hasInitialized) initializeAppData(props);
@ -64,23 +65,25 @@ export const AppSearchConfigured: React.FC<IInitialAppData> = (props) => {
<SetupGuide />
</Route>
<Route>
<Layout navigation={<AppSearchNav />} readOnlyMode={readOnlyMode}>
{errorConnecting ? (
<ErrorConnecting />
) : (
<Switch>
<Route exact path={ROOT_PATH}>
<Redirect to={ENGINES_PATH} />
</Route>
<Route exact path={ENGINES_PATH}>
<EngineOverview />
</Route>
<Route>
<NotFound product={APP_SEARCH_PLUGIN} />
</Route>
</Switch>
)}
</Layout>
<EuiPage>
<EuiPageBody restrictWidth>
{errorConnecting ? (
<ErrorConnecting />
) : (
<Switch>
<Route exact path={ROOT_PATH}>
<Redirect to={ENGINES_PATH} />
</Route>
<Route exact path={ENGINES_PATH}>
<EngineOverview />
</Route>
<Route>
<NotFound product={APP_SEARCH_PLUGIN} />
</Route>
</Switch>
)}
</EuiPageBody>
</EuiPage>
</Route>
</Switch>
);