Skip to content

Commit

Permalink
Update routers
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Jun 17, 2021
1 parent b4973b6 commit a226623
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import { Overview } from './views/overview';
import { RoleMappings } from './views/role_mappings';
import { Security } from './views/security';
import { SettingsRouter } from './views/settings';
import { SettingsSubNav } from './views/settings/components/settings_sub_nav';
import { SetupGuide } from './views/setup_guide';

export const WorkplaceSearch: React.FC<InitialAppData> = (props) => {
Expand Down Expand Up @@ -149,13 +148,7 @@ export const WorkplaceSearchConfigured: React.FC<InitialAppData> = (props) => {
</Layout>
</Route>
<Route path={ORG_SETTINGS_PATH}>
<Layout
navigation={<WorkplaceSearchNav settingsSubNav={<SettingsSubNav />} />}
restrictWidth
readOnlyMode={readOnlyMode}
>
<SettingsRouter />
</Layout>
<SettingsRouter />
</Route>
<Route>
<Layout navigation={<WorkplaceSearchNav />} restrictWidth readOnlyMode={readOnlyMode}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { Route, Redirect, Switch } from 'react-router-dom';

import { shallow } from 'enzyme';

import { FlashMessages } from '../../../shared/flash_messages';
import { SetWorkplaceSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome';
import { staticSourceData } from '../content_sources/source_data';

import { Connectors } from './components/connectors';
Expand All @@ -37,8 +35,6 @@ describe('SettingsRouter', () => {
it('renders', () => {
const wrapper = shallow(<SettingsRouter />);

expect(wrapper.find(FlashMessages)).toHaveLength(1);
expect(wrapper.find(SetPageChrome)).toHaveLength(3);
expect(wrapper.find(Switch)).toHaveLength(1);
expect(wrapper.find(Route)).toHaveLength(NUM_ROUTES);
expect(wrapper.find(Redirect)).toHaveLength(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { Redirect, Route, Switch } from 'react-router-dom';

import { useActions } from 'kea';

import { FlashMessages } from '../../../shared/flash_messages';
import { SetWorkplaceSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome';
import { NAV } from '../../constants';
import {
ORG_SETTINGS_PATH,
ORG_SETTINGS_CUSTOMIZE_PATH,
Expand All @@ -35,28 +32,22 @@ export const SettingsRouter: React.FC = () => {
}, []);

return (
<>
<FlashMessages />
<Switch>
<Redirect exact from={ORG_SETTINGS_PATH} to={ORG_SETTINGS_CUSTOMIZE_PATH} />
<Route exact path={ORG_SETTINGS_CUSTOMIZE_PATH}>
<SetPageChrome trail={[NAV.SETTINGS]} />
<Customize />
<Switch>
<Redirect exact from={ORG_SETTINGS_PATH} to={ORG_SETTINGS_CUSTOMIZE_PATH} />
<Route exact path={ORG_SETTINGS_CUSTOMIZE_PATH}>
<Customize />
</Route>
<Route exact path={ORG_SETTINGS_CONNECTORS_PATH}>
<Connectors />
</Route>
<Route exact path={ORG_SETTINGS_OAUTH_APPLICATION_PATH}>
<OauthApplication />
</Route>
{staticSourceData.map(({ editPath }, i) => (
<Route key={i} exact path={editPath}>
<SourceConfig sourceIndex={i} />
</Route>
<Route exact path={ORG_SETTINGS_CONNECTORS_PATH}>
<SetPageChrome trail={[NAV.SETTINGS, NAV.SETTINGS_SOURCE_PRIORITIZATION]} />
<Connectors />
</Route>
<Route exact path={ORG_SETTINGS_OAUTH_APPLICATION_PATH}>
<SetPageChrome trail={[NAV.SETTINGS, NAV.SETTINGS_OAUTH]} />
<OauthApplication />
</Route>
{staticSourceData.map(({ editPath }, i) => (
<Route key={i} exact path={editPath}>
<SourceConfig sourceIndex={i} />
</Route>
))}
</Switch>
</>
))}
</Switch>
);
};

0 comments on commit a226623

Please sign in to comment.