2017-05-18 21:21:33 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom';
|
|
|
|
|
2017-05-25 19:32:19 +03:00
|
|
|
import { Header, Breadcrumb, Menu } from '@containers/navigation';
|
2017-06-09 07:26:25 +03:00
|
|
|
|
|
|
|
import {
|
|
|
|
DeploymentGroupList,
|
|
|
|
DeploymentGroupCreate
|
|
|
|
} from '@containers/deployment-groups';
|
2017-05-18 21:21:33 +03:00
|
|
|
|
|
|
|
import {
|
|
|
|
ServiceList,
|
|
|
|
ServicesTopology,
|
|
|
|
ServicesMenu
|
|
|
|
} from '@containers/services';
|
|
|
|
|
2017-06-16 17:12:28 +03:00
|
|
|
import { ServiceScale, ServiceDelete } from '@containers/service';
|
|
|
|
|
|
|
|
import { InstanceList } from '@containers/instances';
|
|
|
|
|
2017-05-18 21:21:33 +03:00
|
|
|
const rootRedirect = p => <Redirect to="/deployment-groups" />;
|
|
|
|
|
2017-06-09 07:26:25 +03:00
|
|
|
const deploymentGroupRedirect = p =>
|
2017-05-18 21:21:33 +03:00
|
|
|
<Redirect
|
|
|
|
to={`/deployment-groups/${p.match.params.deploymentGroup}/services-list`}
|
2017-06-09 07:26:25 +03:00
|
|
|
/>;
|
2017-05-18 21:21:33 +03:00
|
|
|
|
2017-06-09 07:26:25 +03:00
|
|
|
const serviceRedirect = p =>
|
2017-05-18 21:21:33 +03:00
|
|
|
<Redirect
|
2017-06-09 07:26:25 +03:00
|
|
|
to={`/deployment-groups/${p.match.params.deploymentGroup}/services/${p.match
|
|
|
|
.params.service}/instances`}
|
|
|
|
/>;
|
2017-05-18 21:21:33 +03:00
|
|
|
|
|
|
|
const Router = (
|
|
|
|
<BrowserRouter>
|
2017-06-16 17:12:28 +03:00
|
|
|
<div style={{ position: 'relative' }}>
|
2017-05-18 21:21:33 +03:00
|
|
|
|
|
|
|
<Route path="/" component={Header} />
|
|
|
|
|
|
|
|
<Switch>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services/:service"
|
|
|
|
component={Breadcrumb}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup"
|
|
|
|
component={Breadcrumb}
|
|
|
|
/>
|
|
|
|
<Route path="/deployment-groups" component={Breadcrumb} />
|
|
|
|
</Switch>
|
|
|
|
<Switch>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services/:service"
|
|
|
|
component={Menu}
|
|
|
|
/>
|
|
|
|
<Route path="/deployment-groups/:deploymentGroup" component={Menu} />
|
|
|
|
</Switch>
|
|
|
|
|
|
|
|
<Route path="/" exact component={rootRedirect} />
|
|
|
|
<Route path="/deployment-groups" exact component={DeploymentGroupList} />
|
|
|
|
|
2017-06-09 07:26:25 +03:00
|
|
|
<Switch>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/~create/:stage?"
|
|
|
|
exact
|
|
|
|
component={DeploymentGroupCreate}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup"
|
|
|
|
exact
|
|
|
|
component={deploymentGroupRedirect}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services"
|
|
|
|
exact
|
|
|
|
component={deploymentGroupRedirect}
|
|
|
|
/>
|
|
|
|
</Switch>
|
|
|
|
|
2017-05-18 21:21:33 +03:00
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/instances"
|
|
|
|
exact
|
|
|
|
component={InstanceList}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-list"
|
|
|
|
component={ServicesMenu}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-list"
|
|
|
|
component={ServiceList}
|
|
|
|
/>
|
2017-06-16 17:12:28 +03:00
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-list/:service/scale"
|
|
|
|
exact
|
|
|
|
component={ServiceScale}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-list/:service/delete"
|
|
|
|
exact
|
|
|
|
component={ServiceDelete}
|
|
|
|
/>
|
2017-05-18 21:21:33 +03:00
|
|
|
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-topology"
|
|
|
|
component={ServicesMenu}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-topology"
|
|
|
|
component={ServicesTopology}
|
|
|
|
/>
|
2017-06-16 17:12:28 +03:00
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-topology/:service/scale"
|
|
|
|
exact
|
|
|
|
component={ServiceScale}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-topology/:service/delete"
|
|
|
|
exact
|
|
|
|
component={ServiceDelete}
|
|
|
|
/>
|
2017-05-18 21:21:33 +03:00
|
|
|
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services/:service"
|
|
|
|
exact
|
|
|
|
component={serviceRedirect}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services/:service/instances"
|
|
|
|
exact
|
|
|
|
component={InstanceList}
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</BrowserRouter>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default Router;
|