feat(cp-frontend): Add 404 to router and redirects for not matched routes
This commit is contained in:
parent
b1f76553ce
commit
2f8ca24fa0
@ -6,7 +6,7 @@
|
|||||||
"repository": "github:yldio/joyent-portal",
|
"repository": "github:yldio/joyent-portal",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "REACT_APP_GQL_PORT=3000 PORT=3069 react-scripts start",
|
"dev": "REACT_APP_GQL_PORT=3000 PORT=3069 REACT_APP_GQL_PROTOCOL=http react-scripts start",
|
||||||
"start": "PORT=3069 react-scripts start",
|
"start": "PORT=3069 react-scripts start",
|
||||||
"build": "NODE_ENV=production react-scripts build",
|
"build": "NODE_ENV=production react-scripts build",
|
||||||
"lint:css": "echo 0",
|
"lint:css": "echo 0",
|
||||||
|
@ -90,11 +90,23 @@ const StyledIconButton = styled(IconButton)`
|
|||||||
border: none;
|
border: none;
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
|
&:focus,
|
||||||
&:active,
|
&:active,
|
||||||
&:active:hover,
|
&:active:hover,
|
||||||
&:active:focus {
|
&:active:focus {
|
||||||
background-color: ${props => props.theme.white};
|
background-color: ${props => props.theme.white};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:focus > svg,
|
||||||
|
&:hover > svg {
|
||||||
|
fill: ${props => props.theme.red};
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active > svg,
|
||||||
|
&:active:hover > svg,
|
||||||
|
&:active:focus > svg {
|
||||||
|
fill: ${props => props.theme.redDark};
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const DeploymentGroupList = ({
|
const DeploymentGroupList = ({
|
||||||
|
@ -41,37 +41,54 @@ const serviceRedirect = p =>
|
|||||||
.params.service}/instances`}
|
.params.service}/instances`}
|
||||||
/>;
|
/>;
|
||||||
|
|
||||||
const Router = (
|
// TODO component to be designed
|
||||||
<BrowserRouter>
|
const notFound = p => {
|
||||||
<Container>
|
return <p>
|
||||||
<Route path="/" component={Header} />
|
NOT FOUND
|
||||||
|
</p>;
|
||||||
|
}
|
||||||
|
|
||||||
<Switch>
|
const APP = p => (
|
||||||
<Route
|
<div>
|
||||||
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/delete"
|
|
||||||
exact
|
|
||||||
component={DeploymentGroupDelete}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/deployment-groups/:deploymentGroup/services/:service"
|
|
||||||
component={Menu}
|
|
||||||
/>
|
|
||||||
<Route path="/deployment-groups/:deploymentGroup" component={Menu} />
|
|
||||||
</Switch>
|
|
||||||
|
|
||||||
<Route path="/" exact component={rootRedirect} />
|
<Switch>
|
||||||
<Route path="/deployment-groups" exact component={DeploymentGroupList} />
|
<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/delete"
|
||||||
|
exact
|
||||||
|
component={DeploymentGroupDelete}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/deployment-groups/:deploymentGroup/services/:service"
|
||||||
|
component={Menu}
|
||||||
|
/>
|
||||||
|
<Route path="/deployment-groups/:deploymentGroup" component={Menu} />
|
||||||
|
</Switch>
|
||||||
|
|
||||||
|
<Route path="/deployment-groups" exact component={DeploymentGroupList} />
|
||||||
|
|
||||||
|
<Route
|
||||||
|
path="/deployment-groups/:deploymentGroup/services-list"
|
||||||
|
component={ServicesMenu}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Route
|
||||||
|
path="/deployment-groups/:deploymentGroup/services-topology"
|
||||||
|
component={ServicesMenu}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Switch>
|
||||||
<Route
|
<Route
|
||||||
path="/deployment-groups/:deploymentGroup/delete"
|
path="/deployment-groups/:deploymentGroup/delete"
|
||||||
exact
|
exact
|
||||||
@ -79,74 +96,56 @@ const Router = (
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/deployment-groups/:deploymentGroup"
|
path="/deployment-groups/~create/:stage?"
|
||||||
exact
|
exact
|
||||||
component={deploymentGroupRedirect}
|
component={DeploymentGroupCreate}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/deployment-groups/~import/:slug"
|
||||||
|
exact
|
||||||
|
component={DeploymentGroupImport}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/deployment-groups/:deploymentGroup/services/:service"
|
path="/deployment-groups/:deploymentGroup/instances"
|
||||||
exact
|
exact
|
||||||
component={serviceRedirect}
|
component={InstanceList}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Route
|
||||||
|
path="/deployment-groups/:deploymentGroup/manifest/:stage?"
|
||||||
|
exact
|
||||||
|
component={Manifest}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/deployment-groups/:deploymentGroup/services-list"
|
path="/deployment-groups/:deploymentGroup/services-list"
|
||||||
component={ServicesMenu}
|
component={ServiceList}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/deployment-groups/:deploymentGroup/services-topology"
|
path="/deployment-groups/:deploymentGroup/services-topology"
|
||||||
component={ServicesMenu}
|
component={ServicesTopology}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Switch>
|
<Route
|
||||||
<Route
|
path="/deployment-groups/:deploymentGroup/services/:service/instances"
|
||||||
path="/deployment-groups/~create/:stage?"
|
exact
|
||||||
exact
|
component={InstanceList}
|
||||||
component={DeploymentGroupCreate}
|
/>
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/deployment-groups/~import/:slug"
|
|
||||||
exact
|
|
||||||
component={DeploymentGroupImport}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/deployment-groups/:deploymentGroup/services"
|
path="/deployment-groups/:deploymentGroup/services/:service"
|
||||||
exact
|
component={serviceRedirect}
|
||||||
component={deploymentGroupRedirect}
|
/>
|
||||||
/>
|
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/deployment-groups/:deploymentGroup/instances"
|
path="/deployment-groups/:deploymentGroup"
|
||||||
exact
|
component={deploymentGroupRedirect}
|
||||||
component={InstanceList}
|
/>
|
||||||
/>
|
</Switch>
|
||||||
|
|
||||||
<Route
|
|
||||||
path="/deployment-groups/:deploymentGroup/manifest/:stage?"
|
|
||||||
exact
|
|
||||||
component={Manifest}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
|
<Switch>
|
||||||
<Route
|
<Route
|
||||||
path="/deployment-groups/:deploymentGroup/services-list/:service/scale"
|
path="/deployment-groups/:deploymentGroup/services-list/:service/scale"
|
||||||
exact
|
exact
|
||||||
@ -169,6 +168,28 @@ const Router = (
|
|||||||
exact
|
exact
|
||||||
component={ServiceDelete}
|
component={ServiceDelete}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Route
|
||||||
|
path="/deployment-groups/:deploymentGroup/services-list"
|
||||||
|
component={deploymentGroupRedirect}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path="/deployment-groups/:deploymentGroup/services-topology"
|
||||||
|
component={deploymentGroupRedirect}
|
||||||
|
/>
|
||||||
|
</Switch>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
const Router = (
|
||||||
|
<BrowserRouter>
|
||||||
|
<Container>
|
||||||
|
<Route path="/" component={Header} />
|
||||||
|
<Switch>
|
||||||
|
<Route path="/deployment-groups" component={APP} />
|
||||||
|
<Route path="/" exact component={rootRedirect} />
|
||||||
|
<Route path="/*" component={notFound} />
|
||||||
|
</Switch>
|
||||||
</Container>
|
</Container>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user