Merge pull request #11185 from influxdata/fixes/clean-up-routes

Clean up routes
pull/11188/head
Brandon Farmer 2019-01-16 17:05:03 -08:00 committed by GitHub
commit bd5dc23461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 45 deletions

View File

@ -3,7 +3,7 @@ import 'babel-polyfill'
import React, {PureComponent} from 'react' import React, {PureComponent} from 'react'
import {render} from 'react-dom' import {render} from 'react-dom'
import {Provider} from 'react-redux' import {Provider} from 'react-redux'
import {Router, Route, useRouterHistory, IndexRedirect} from 'react-router' import {Router, Route, useRouterHistory, IndexRoute} from 'react-router'
import {createHistory, History} from 'history' import {createHistory, History} from 'history'
import configureStore from 'src/store/configureStore' import configureStore from 'src/store/configureStore'
@ -75,19 +75,6 @@ window.addEventListener('keyup', event => {
} }
}) })
const MainLine = ({children}) => {
const {pathname} = window.location
if (
pathname.includes('signin') ||
pathname.includes('onboarding') ||
pathname.includes('logout')
) {
return null
}
return children
}
class Root extends PureComponent { class Root extends PureComponent {
public render() { public render() {
return ( return (
@ -95,46 +82,46 @@ class Root extends PureComponent {
<Router history={history}> <Router history={history}>
<Route component={GetLinks}> <Route component={GetLinks}>
<Route component={Setup}> <Route component={Setup}>
<Route <Route path="/onboarding">
path="/onboarding/:stepID" <Route path=":stepID" component={OnboardingWizardPage} />
component={OnboardingWizardPage} <Route
/> path=":stepID/:substepID"
<Route component={OnboardingWizardPage}
path="/onboarding/:stepID/:substepID" />
component={OnboardingWizardPage} </Route>
/>
<Route path="/signin" component={SigninPage} /> <Route path="/signin" component={SigninPage} />
<Route component={MainLine}> <Route path="/logout" component={Logout} />
<Route path="/">
<Route component={Signin}> <Route component={Signin}>
<Route component={GetMe}> <Route component={GetMe}>
<Route component={GetOrganizations}> <Route component={GetOrganizations}>
<Route component={App}> <Route component={App}>
<Route component={GetSources}> <Route component={GetSources}>
<Route path="/" component={SetActiveSource}> <Route component={SetActiveSource}>
<IndexRedirect to="/dashboards" /> <IndexRoute component={DashboardsIndex} />
<Route <Route path="organizations">
path="dashboards/:dashboardID" <IndexRoute component={OrganizationsIndex} />
component={DashboardPage} <Route
/> path="/:orgID/:tab"
<Route path="tasks" component={TasksPage} /> component={OrganizationView}
<Route />
path="organizations" </Route>
component={OrganizationsIndex} <Route path="tasks">
/> <IndexRoute component={TasksPage} />
<Route <Route path="new" component={TaskPage} />
path="organizations/:orgID/:tab" <Route path=":id" component={TaskEditPage} />
component={OrganizationView} </Route>
/>
<Route path="tasks/new" component={TaskPage} />
<Route path="tasks/:id" component={TaskEditPage} />
<Route <Route
path="data-explorer" path="data-explorer"
component={DataExplorerPage} component={DataExplorerPage}
/> />
<Route <Route path="dashboards">
path="dashboards" <IndexRoute component={DashboardsIndex} />
component={DashboardsIndex} <Route
/> path=":dashboardID"
component={DashboardPage}
/>
</Route>
<Route path="me" component={MePage} /> <Route path="me" component={MePage} />
<Route path="account/:tab" component={Account} /> <Route path="account/:tab" component={Account} />
<Route path="sources" component={SourcesPage} /> <Route path="sources" component={SourcesPage} />
@ -149,7 +136,6 @@ class Root extends PureComponent {
</Route> </Route>
</Route> </Route>
</Route> </Route>
<Route path="/logout" component={Logout} />
</Route> </Route>
</Route> </Route>
<Route path="*" component={NotFound} /> <Route path="*" component={NotFound} />