2017-09-20 12:30:53 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom';
|
|
|
|
import get from 'lodash.get';
|
|
|
|
|
|
|
|
import { PageContainer } from 'joyent-ui-toolkit';
|
|
|
|
|
|
|
|
import { Breadcrumb, Menu } from '@containers/navigation';
|
|
|
|
import { Header } from '@components/navigation';
|
|
|
|
|
|
|
|
import {
|
|
|
|
List as Instances,
|
2017-11-28 16:50:55 +02:00
|
|
|
Home as InstanceHome,
|
2017-09-20 12:30:53 +03:00
|
|
|
Tags as InstanceTags,
|
|
|
|
Metadata as InstanceMetadata,
|
|
|
|
Networks as InstanceNetworks,
|
|
|
|
Firewall as InstanceFirewall,
|
2017-10-25 20:09:02 +03:00
|
|
|
Dns as InstanceDns,
|
2017-10-11 19:59:59 +03:00
|
|
|
Snapshots as InstanceSnapshots,
|
|
|
|
Resize as InstanceResize,
|
|
|
|
CreateSnapshot as InstanceCreateSnapshot
|
2017-09-20 12:30:53 +03:00
|
|
|
} from '@containers/instances';
|
|
|
|
|
|
|
|
export default () => (
|
|
|
|
<BrowserRouter>
|
|
|
|
<PageContainer>
|
2017-10-11 19:59:59 +03:00
|
|
|
{/* Header */}
|
2017-09-20 12:30:53 +03:00
|
|
|
<Route path="*" component={Header} />
|
|
|
|
|
2017-10-11 19:59:59 +03:00
|
|
|
{/* Breadcrumb */}
|
2017-09-20 12:30:53 +03:00
|
|
|
<Switch>
|
2017-10-11 19:59:59 +03:00
|
|
|
<Route
|
|
|
|
path="/instances/~:action/:instance?"
|
|
|
|
exact
|
|
|
|
component={Breadcrumb}
|
|
|
|
/>
|
|
|
|
<Route path="/instances/:instance?" component={Breadcrumb} />
|
2017-09-20 12:30:53 +03:00
|
|
|
</Switch>
|
|
|
|
|
2017-10-11 19:59:59 +03:00
|
|
|
{/* Menu */}
|
2017-09-20 12:30:53 +03:00
|
|
|
<Switch>
|
2017-10-11 19:59:59 +03:00
|
|
|
<Route path="/instances/~:action/:id?" exact component={Menu} />
|
|
|
|
<Route path="/instances/:instance?/:section?" component={Menu} />
|
2017-09-20 12:30:53 +03:00
|
|
|
</Switch>
|
|
|
|
|
2017-10-11 19:59:59 +03:00
|
|
|
{/* Instances List */}
|
|
|
|
<Switch>
|
|
|
|
<Route path="/instances" exact component={Instances} />
|
|
|
|
</Switch>
|
2017-09-20 12:30:53 +03:00
|
|
|
|
2017-10-11 19:59:59 +03:00
|
|
|
{/* Instance Sections */}
|
|
|
|
<Switch>
|
|
|
|
<Route path="/instances/~:action" component={() => null} />
|
|
|
|
<Route
|
|
|
|
path="/instances/:instance/:section?/~create-snapshot"
|
|
|
|
component={() => null}
|
|
|
|
/>
|
|
|
|
<Route
|
2017-11-28 16:50:55 +02:00
|
|
|
path="/instances/:instance/home"
|
2017-10-11 19:59:59 +03:00
|
|
|
exact
|
2017-11-28 16:50:55 +02:00
|
|
|
component={InstanceHome}
|
2017-10-11 19:59:59 +03:00
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/instances/:instance/tags"
|
|
|
|
exact
|
|
|
|
component={InstanceTags}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/instances/:instance/metadata"
|
|
|
|
exact
|
|
|
|
component={InstanceMetadata}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/instances/:instance/networks"
|
|
|
|
exact
|
|
|
|
component={InstanceNetworks}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/instances/:instance/firewall"
|
|
|
|
exact
|
|
|
|
component={InstanceFirewall}
|
|
|
|
/>
|
2017-10-25 20:09:02 +03:00
|
|
|
<Route path="/instances/:instance/dns" exact component={InstanceDns} />
|
2017-10-11 19:59:59 +03:00
|
|
|
<Route
|
|
|
|
path="/instances/:instance/snapshots"
|
|
|
|
exact
|
|
|
|
component={InstanceSnapshots}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/instances/:instance"
|
|
|
|
exact
|
|
|
|
component={({ match }) => (
|
|
|
|
<Redirect
|
2017-11-28 16:50:55 +02:00
|
|
|
to={`/instances/${get(match, 'params.instance')}/home`}
|
2017-10-11 19:59:59 +03:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</Switch>
|
|
|
|
|
|
|
|
{/* Actions */}
|
|
|
|
<Switch>
|
|
|
|
<Route
|
|
|
|
path="/instances/~resize/:instance"
|
|
|
|
exact
|
|
|
|
component={InstanceResize}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/instances/:instance/:section?/~resize"
|
|
|
|
exact
|
|
|
|
component={InstanceResize}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="/instances/~create-snapshot/:instance"
|
|
|
|
exact
|
|
|
|
component={InstanceCreateSnapshot}
|
|
|
|
/>
|
|
|
|
<Route
|
2017-10-13 22:56:08 +03:00
|
|
|
path="/instances/:instance/snapshots/~create"
|
2017-10-11 19:59:59 +03:00
|
|
|
exact
|
|
|
|
component={InstanceCreateSnapshot}
|
|
|
|
/>
|
|
|
|
</Switch>
|
2017-09-20 12:30:53 +03:00
|
|
|
|
|
|
|
<Route path="/" exact component={() => <Redirect to="/instances" />} />
|
|
|
|
</PageContainer>
|
|
|
|
</BrowserRouter>
|
|
|
|
);
|