fleet/frontend/router/index.jsx
noahtalerman 98799fdff8
New styles for 404, 500, Login, User settings, and Confirm invite pages. (#108)
- Kolide404 and Kolide500 components renamed to Fleet404 and Fleet500
- Styling for Login and Confirm invite pages are consistent with the recent changes to the Setup page.
- Add "*" character to the 404 <Route />'s path property. Now the 404 page renders when there is no exact path match.
2020-12-08 17:45:08 -08:00

86 lines
3.9 KiB
JavaScript

import React from 'react';
import { browserHistory, IndexRedirect, IndexRoute, Route, Router } from 'react-router';
import { Provider } from 'react-redux';
import { syncHistoryWithStore } from 'react-router-redux';
import AdminAppSettingsPage from 'pages/admin/AppSettingsPage';
import AdminUserManagementPage from 'pages/admin/UserManagementPage';
import AdminOsqueryOptionsPage from 'pages/admin/OsqueryOptionsPage';
import AllPacksPage from 'pages/packs/AllPacksPage';
import App from 'components/App';
import AuthenticatedAdminRoutes from 'components/AuthenticatedAdminRoutes';
import AuthenticatedRoutes from 'components/AuthenticatedRoutes';
import ConfirmInvitePage from 'pages/ConfirmInvitePage';
import ConfirmSSOInvitePage from 'pages/ConfirmSSOInvitePage';
import CoreLayout from 'layouts/CoreLayout';
import EditPackPage from 'pages/packs/EditPackPage';
import EmailTokenRedirect from 'components/EmailTokenRedirect';
import LoginRoutes from 'components/LoginRoutes';
import LogoutPage from 'pages/LogoutPage';
import ManageHostsPage from 'pages/hosts/ManageHostsPage';
import ManageQueriesPage from 'pages/queries/ManageQueriesPage';
import PackPageWrapper from 'components/packs/PackPageWrapper';
import PackComposerPage from 'pages/packs/PackComposerPage';
import QueryPage from 'pages/queries/QueryPage';
import QueryPageWrapper from 'components/queries/QueryPageWrapper';
import RegistrationPage from 'pages/RegistrationPage';
import Fleet404 from 'pages/Fleet404';
import Fleet500 from 'pages/Fleet500';
import store from 'redux/store';
import UserSettingsPage from 'pages/UserSettingsPage';
import PATHS from 'router/paths';
const history = syncHistoryWithStore(browserHistory, store);
const routes = (
<Provider store={store}>
<Router history={history}>
<Route path={PATHS.HOME} component={App}>
<Route path="setup" component={RegistrationPage} />
<Route path="login" component={LoginRoutes}>
<Route path="invites/:invite_token" component={ConfirmInvitePage} />
<Route path="ssoinvites/:invite_token" component={ConfirmSSOInvitePage} />
<Route path="forgot" />
<Route path="reset" />
</Route>
<Route component={AuthenticatedRoutes}>
<Route path="email/change/:token" component={EmailTokenRedirect} />
<Route path="logout" component={LogoutPage} />
<Route component={CoreLayout}>
<IndexRedirect to={PATHS.MANAGE_HOSTS} />
<Route path="admin" component={AuthenticatedAdminRoutes}>
<Route path="users" component={AdminUserManagementPage} />
<Route path="settings" component={AdminAppSettingsPage} />
<Route path="osquery" component={AdminOsqueryOptionsPage} />
</Route>
<Route path="hosts">
<Route path="manage" component={ManageHostsPage} />
<Route path="manage/labels/:label_id" component={ManageHostsPage} />
<Route path="manage/:active_label" component={ManageHostsPage} />
</Route>
<Route path="packs" component={PackPageWrapper}>
<Route path="manage" component={AllPacksPage} />
<Route path="new" component={PackComposerPage} />
<Route path=":id">
<IndexRoute component={EditPackPage} />
<Route path="edit" component={EditPackPage} />
</Route>
</Route>
<Route path="queries" component={QueryPageWrapper}>
<Route path="manage" component={ManageQueriesPage} />
<Route path="new" component={QueryPage} />
<Route path=":id" component={QueryPage} />
</Route>
<Route path="settings" component={UserSettingsPage} />
</Route>
</Route>
</Route>
<Route path="/500" component={Fleet500} />
<Route path="/404" component={Fleet404} />
<Route path="*" component={Fleet404} />
</Router>
</Provider>
);
export default routes;