Skip to content

Commit

Permalink
Temporarily remove Layout from App Search plugin for 7.10 release (#7…
Browse files Browse the repository at this point in the history
…9506)

- 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
  • Loading branch information
Constance authored Oct 5, 2020
1 parent a08fe39 commit d5b8a95
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
});

Expand Down Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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>
);
Expand Down

0 comments on commit d5b8a95

Please sign in to comment.