2018-07-02 14:50:13 +02:00
|
|
|
//@flow
|
2018-07-11 14:59:01 +02:00
|
|
|
import React from "react";
|
2018-07-02 14:50:13 +02:00
|
|
|
|
2018-10-17 17:11:21 +02:00
|
|
|
import { Redirect, Route, Switch, withRouter } from "react-router-dom";
|
2018-07-02 14:50:13 +02:00
|
|
|
|
2018-07-31 16:32:16 +02:00
|
|
|
import Overview from "../repos/containers/Overview";
|
2018-07-11 14:59:01 +02:00
|
|
|
import Users from "../users/containers/Users";
|
2018-07-13 10:57:11 +02:00
|
|
|
import Login from "../containers/Login";
|
|
|
|
|
import Logout from "../containers/Logout";
|
2018-07-12 11:35:28 +02:00
|
|
|
|
2018-10-17 17:11:21 +02:00
|
|
|
import { ProtectedRoute } from "@scm-manager/ui-components";
|
2018-07-18 17:40:05 +02:00
|
|
|
import AddUser from "../users/containers/AddUser";
|
2018-07-25 13:21:49 +02:00
|
|
|
import SingleUser from "../users/containers/SingleUser";
|
2018-08-02 16:09:58 +02:00
|
|
|
import RepositoryRoot from "../repos/containers/RepositoryRoot";
|
|
|
|
|
import Create from "../repos/containers/Create";
|
2018-07-02 14:50:13 +02:00
|
|
|
|
2018-07-31 10:16:18 +02:00
|
|
|
import Groups from "../groups/containers/Groups";
|
2018-07-31 15:09:45 +02:00
|
|
|
import SingleGroup from "../groups/containers/SingleGroup";
|
|
|
|
|
import AddGroup from "../groups/containers/AddGroup";
|
2018-07-31 10:16:18 +02:00
|
|
|
|
2018-08-09 09:38:55 +02:00
|
|
|
import Config from "../config/containers/Config";
|
2018-11-07 14:45:27 +01:00
|
|
|
import ChangeUserPassword from "./ChangeUserPassword";
|
2018-11-07 12:55:09 +01:00
|
|
|
import Profile from "./Profile";
|
2018-08-09 09:38:55 +02:00
|
|
|
|
2018-07-02 14:50:13 +02:00
|
|
|
type Props = {
|
2018-07-13 10:57:11 +02:00
|
|
|
authenticated?: boolean
|
2018-07-11 14:59:01 +02:00
|
|
|
};
|
2018-07-02 14:50:13 +02:00
|
|
|
|
|
|
|
|
class Main extends React.Component<Props> {
|
|
|
|
|
render() {
|
2018-07-13 10:57:11 +02:00
|
|
|
const { authenticated } = this.props;
|
2018-07-02 14:50:13 +02:00
|
|
|
return (
|
2018-07-31 16:32:16 +02:00
|
|
|
<div className="main">
|
2018-07-02 14:50:13 +02:00
|
|
|
<Switch>
|
2018-07-31 16:32:16 +02:00
|
|
|
<Redirect exact path="/" to="/repos" />
|
|
|
|
|
<Route exact path="/login" component={Login} />
|
|
|
|
|
<Route path="/logout" component={Logout} />
|
2018-07-13 10:57:11 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
exact
|
2018-07-31 16:32:16 +02:00
|
|
|
path="/repos"
|
|
|
|
|
component={Overview}
|
2018-07-13 10:57:11 +02:00
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-08-01 14:56:24 +02:00
|
|
|
<ProtectedRoute
|
2018-08-02 16:09:58 +02:00
|
|
|
exact
|
|
|
|
|
path="/repos/create"
|
|
|
|
|
component={Create}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
|
|
|
|
<ProtectedRoute
|
2018-08-01 14:56:24 +02:00
|
|
|
exact
|
|
|
|
|
path="/repos/:page"
|
|
|
|
|
component={Overview}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-08-01 18:23:16 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
path="/repo/:namespace/:name"
|
|
|
|
|
component={RepositoryRoot}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-07-13 10:57:11 +02:00
|
|
|
<ProtectedRoute
|
2018-07-18 17:40:05 +02:00
|
|
|
exact
|
2018-07-13 10:57:11 +02:00
|
|
|
path="/users"
|
|
|
|
|
component={Users}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-07-18 17:40:05 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
authenticated={authenticated}
|
2018-07-25 13:21:49 +02:00
|
|
|
path="/users/add"
|
|
|
|
|
component={AddUser}
|
2018-07-18 17:40:05 +02:00
|
|
|
/>
|
2018-07-26 15:30:28 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
exact
|
|
|
|
|
path="/users/:page"
|
|
|
|
|
component={Users}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-07-18 17:40:05 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
authenticated={authenticated}
|
2018-07-25 13:21:49 +02:00
|
|
|
path="/user/:name"
|
|
|
|
|
component={SingleUser}
|
2018-07-18 17:40:05 +02:00
|
|
|
/>
|
2018-11-07 14:45:27 +01:00
|
|
|
|
2018-07-31 10:16:18 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
exact
|
|
|
|
|
path="/groups"
|
|
|
|
|
component={Groups}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-07-31 15:09:45 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
path="/group/:name"
|
|
|
|
|
component={SingleGroup}
|
|
|
|
|
/>
|
2018-07-31 14:43:55 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
path="/groups/add"
|
|
|
|
|
component={AddGroup}
|
|
|
|
|
/>
|
2018-08-01 15:51:54 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
exact
|
|
|
|
|
path="/groups/:page"
|
|
|
|
|
component={Groups}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-08-09 09:38:55 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
exact
|
|
|
|
|
path="/config"
|
|
|
|
|
component={Config}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-11-05 16:03:54 +01:00
|
|
|
<ProtectedRoute
|
|
|
|
|
path="/me"
|
|
|
|
|
component={Profile}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-07-02 14:50:13 +02:00
|
|
|
</Switch>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-12 08:23:24 +02:00
|
|
|
export default withRouter(Main);
|