2018-02-20 02:35:31 +02:00
|
|
|
import React from 'react';
|
|
|
|
import { Redirect, Route, Switch } from 'react-router-dom';
|
|
|
|
import get from 'lodash.get';
|
|
|
|
|
|
|
|
import {
|
|
|
|
PageContainer,
|
|
|
|
ViewContainer,
|
|
|
|
Message,
|
|
|
|
MessageDescription,
|
2018-02-26 17:54:25 +02:00
|
|
|
MessageTitle,
|
|
|
|
Footer
|
2018-02-20 02:35:31 +02:00
|
|
|
} from 'joyent-ui-toolkit';
|
|
|
|
|
|
|
|
import { Breadcrumb, Menu } from '@containers/navigation';
|
|
|
|
import CreateInstance from '@containers/create-instance';
|
|
|
|
import { Route as ServerError } from '@root/server-error';
|
|
|
|
|
|
|
|
import {
|
|
|
|
List as Instances,
|
|
|
|
Summary as InstanceSummary,
|
|
|
|
Tags as InstanceTags,
|
|
|
|
Metadata as InstanceMetadata,
|
|
|
|
Networks as InstanceNetworks,
|
|
|
|
Firewall as InstanceFirewall,
|
|
|
|
Cns as InstanceCns,
|
|
|
|
Snapshots as InstanceSnapshots,
|
|
|
|
UserScript as InstanceUserScript
|
|
|
|
} from '@containers/instances';
|
|
|
|
|
|
|
|
export default () => (
|
|
|
|
<PageContainer>
|
|
|
|
{/* Breadcrumb */}
|
|
|
|
<Switch>
|
2018-03-06 03:14:33 +02:00
|
|
|
<Route path="/instances/~create/:section?" exact component={Breadcrumb} />
|
|
|
|
<Route
|
|
|
|
path="/instances/~:action/:instance?"
|
|
|
|
exact
|
|
|
|
component={Breadcrumb}
|
|
|
|
/>
|
|
|
|
<Route path="/instances/:instance?" component={Breadcrumb} />
|
2018-02-20 02:35:31 +02:00
|
|
|
</Switch>
|
|
|
|
|
|
|
|
{/* Menu */}
|
|
|
|
<Switch>
|
|
|
|
<Route path="/~server-error" component={() => null} />
|
2018-03-06 03:14:33 +02:00
|
|
|
<Route path="/instances/~:action/:id?" exact component={Menu} />
|
|
|
|
<Route path="/instances/:instance?/:section?" component={Menu} />
|
2018-02-20 02:35:31 +02:00
|
|
|
</Switch>
|
|
|
|
|
|
|
|
{/* Instances List */}
|
|
|
|
<Switch>
|
2018-03-06 03:14:33 +02:00
|
|
|
<Route path="/instances" exact component={Instances} />
|
2018-02-20 02:35:31 +02:00
|
|
|
</Switch>
|
|
|
|
|
|
|
|
{/* Instance Sections */}
|
|
|
|
<Switch>
|
2018-03-06 03:14:33 +02:00
|
|
|
<Route path="/instances/~:action" component={() => null} />
|
|
|
|
<Route
|
|
|
|
path="/instances/:instance/summary"
|
|
|
|
exact
|
|
|
|
component={InstanceSummary}
|
|
|
|
/>
|
|
|
|
<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}
|
|
|
|
/>
|
2018-02-20 02:35:31 +02:00
|
|
|
<Route
|
2018-03-06 03:14:33 +02:00
|
|
|
path="/instances/:instance/snapshots"
|
|
|
|
exact
|
|
|
|
component={InstanceSnapshots}
|
|
|
|
/>
|
|
|
|
<Route path="/instances/:instance/cns" exact component={InstanceCns} />
|
|
|
|
<Route
|
|
|
|
path="/instances/:instance/user-script"
|
2018-02-20 02:35:31 +02:00
|
|
|
exact
|
|
|
|
component={InstanceUserScript}
|
|
|
|
/>
|
|
|
|
<Route
|
2018-03-06 03:14:33 +02:00
|
|
|
path="/instances/:instance"
|
2018-02-20 02:35:31 +02:00
|
|
|
exact
|
|
|
|
component={({ match }) => (
|
2018-03-06 03:14:33 +02:00
|
|
|
<Redirect
|
|
|
|
to={`/instances/${get(match, 'params.instance')}/summary`}
|
|
|
|
/>
|
2018-02-20 02:35:31 +02:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</Switch>
|
|
|
|
|
|
|
|
{/* Actions */}
|
|
|
|
<Switch>
|
|
|
|
{/* Create Instance */}
|
|
|
|
<Route
|
2018-03-06 03:14:33 +02:00
|
|
|
path="/instances/~create/"
|
2018-02-20 02:35:31 +02:00
|
|
|
exact
|
2018-03-06 03:47:30 +02:00
|
|
|
component={({ match, location }) => (
|
|
|
|
<Redirect to={`/instances/~create/name${location.search}`} />
|
|
|
|
)}
|
2018-02-20 02:35:31 +02:00
|
|
|
/>
|
2018-03-06 03:14:33 +02:00
|
|
|
<Route path="/instances/~create/:step" component={CreateInstance} />
|
2018-02-20 02:35:31 +02:00
|
|
|
</Switch>
|
|
|
|
|
|
|
|
<Route path="/~server-error" exact component={ServerError} />
|
|
|
|
|
2018-03-06 03:14:33 +02:00
|
|
|
<Route path="/" exact component={() => <Redirect to="/instances" />} />
|
|
|
|
|
2018-02-20 02:35:31 +02:00
|
|
|
<noscript>
|
|
|
|
<ViewContainer main>
|
|
|
|
<Message warning>
|
|
|
|
<MessageTitle>Ooops!</MessageTitle>
|
|
|
|
<MessageDescription>
|
|
|
|
You need to enable JavaScript to run this app.
|
|
|
|
</MessageDescription>
|
|
|
|
</Message>
|
|
|
|
</ViewContainer>
|
|
|
|
</noscript>
|
|
|
|
<Footer />
|
|
|
|
</PageContainer>
|
|
|
|
);
|