2017-05-18 21:21:33 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom';
|
2017-06-26 17:29:12 +03:00
|
|
|
import styled from 'styled-components';
|
2017-05-18 21:21:33 +03:00
|
|
|
|
2017-05-25 19:32:19 +03:00
|
|
|
import { Header, Breadcrumb, Menu } from '@containers/navigation';
|
2017-06-26 17:29:12 +03:00
|
|
|
import { ServiceScale, ServiceDelete } from '@containers/service';
|
|
|
|
import { InstanceList } from '@containers/instances';
|
2017-06-09 07:26:25 +03:00
|
|
|
|
|
|
|
import {
|
|
|
|
DeploymentGroupList,
|
2017-06-26 17:29:12 +03:00
|
|
|
DeploymentGroupCreate,
|
2017-06-27 19:45:38 +03:00
|
|
|
DeploymentGroupImport,
|
|
|
|
DeploymentGroupManifest
|
2017-06-09 07:26:25 +03:00
|
|
|
} from '@containers/deployment-groups';
|
2017-05-18 21:21:33 +03:00
|
|
|
|
|
|
|
import {
|
|
|
|
ServiceList,
|
|
|
|
ServicesTopology,
|
|
|
|
ServicesMenu
|
|
|
|
} from '@containers/services';
|
|
|
|
|
2017-06-26 17:29:12 +03:00
|
|
|
const Container = styled.div`
|
|
|
|
display: flex;
|
|
|
|
flex: 1 1 auto;
|
|
|
|
position: relative;
|
|
|
|
flex-flow: column;
|
|
|
|
`;
|
2017-06-16 17:12:28 +03:00
|
|
|
|
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-26 17:29:12 +03:00
|
|
|
<Container>
|
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-27 19:45:38 +03:00
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-list"
|
|
|
|
component={ServicesMenu}
|
|
|
|
/>
|
|
|
|
|
2017-06-09 07:26:25 +03:00
|
|
|
<Switch>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/~create/:stage?"
|
|
|
|
exact
|
|
|
|
component={DeploymentGroupCreate}
|
|
|
|
/>
|
2017-06-26 17:29:12 +03:00
|
|
|
<Route
|
|
|
|
path="/deployment-groups/~import/:slug"
|
|
|
|
exact
|
|
|
|
component={DeploymentGroupImport}
|
|
|
|
/>
|
2017-06-09 07:26:25 +03:00
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup"
|
|
|
|
exact
|
|
|
|
component={deploymentGroupRedirect}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services"
|
|
|
|
exact
|
|
|
|
component={deploymentGroupRedirect}
|
|
|
|
/>
|
|
|
|
|
2017-06-27 19:45:38 +03:00
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/instances"
|
|
|
|
exact
|
|
|
|
component={InstanceList}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/manifest/:stage?"
|
|
|
|
exact
|
|
|
|
component={DeploymentGroupManifest}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-list"
|
|
|
|
component={ServiceList}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services-topology"
|
|
|
|
component={ServicesTopology}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Route
|
|
|
|
path="/deployment-groups/:deploymentGroup/services/:service/instances"
|
|
|
|
exact
|
|
|
|
component={InstanceList}
|
|
|
|
/>
|
|
|
|
</Switch>
|
2017-05-18 21:21:33 +03:00
|
|
|
|
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}
|
|
|
|
/>
|
2017-06-27 19:45:38 +03:00
|
|
|
|
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}
|
|
|
|
/>
|
|
|
|
|
2017-06-26 17:29:12 +03:00
|
|
|
</Container>
|
2017-05-18 21:21:33 +03:00
|
|
|
</BrowserRouter>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default Router;
|