forgeplus-react/src/forge/Settings/Index.js

200 lines
6.4 KiB
JavaScript
Raw Normal View History

2020-05-22 17:00:18 +08:00
import React, { Component } from "react";
import { Link, Route, Switch } from "react-router-dom";
2020-03-16 14:12:11 +08:00
2020-06-22 14:07:06 +08:00
import "../css/index.scss";
2020-06-17 09:43:08 +08:00
import "./setting.scss";
2020-03-16 14:12:11 +08:00
2020-05-22 17:00:18 +08:00
import Loadable from "react-loadable";
import Loading from "../../Loading";
2020-06-19 14:08:05 +08:00
import { Box, Long, Short, Gap } from '../Component/layout';
2020-03-16 14:12:11 +08:00
2020-06-19 14:08:05 +08:00
const BranchNew = Loadable({
loader: () => import("./BranchRule"),
loading: Loading,
});
2020-03-16 14:12:11 +08:00
const Branch = Loadable({
2020-05-22 17:00:18 +08:00
loader: () => import("./Branch"),
loading: Loading,
});
2020-03-16 14:12:11 +08:00
const Setting = Loadable({
2020-05-22 17:00:18 +08:00
loader: () => import("./Setting"),
loading: Loading,
});
2021-07-30 15:06:32 +08:00
const WebhookNew = Loadable({
loader: () => import("./Webhooks/New"),
loading: Loading,
});
const Webhook = Loadable({
loader: () => import("./Webhooks/Index"),
loading: Loading,
});
2020-03-16 14:12:11 +08:00
const Collaborator = Loadable({
2020-05-22 17:00:18 +08:00
loader: () => import("./Collaborator"),
loading: Loading,
});
2020-04-09 18:13:26 +08:00
const Tags = Loadable({
2020-05-22 17:00:18 +08:00
loader: () => import("./new_tags"),
2020-04-09 18:13:26 +08:00
loading: Loading,
2020-05-22 17:00:18 +08:00
});
2020-06-18 11:36:05 +08:00
const Manage = Loadable({
loader: () => import("./ManageWeb"),
loading: Loading,
});
const ManageNew = Loadable({
loader: () => import("./ManageWebNew"),
loading: Loading,
});
2020-05-22 17:00:18 +08:00
class Index extends Component {
render() {
2020-08-12 18:13:18 +08:00
const { projectsId , owner } = this.props.match.params;
2020-03-16 14:12:11 +08:00
const { pathname } = this.props.history.location;
2021-09-03 09:23:12 +08:00
const flag = pathname === `/${owner}/${projectsId}/settings`;
2020-05-22 17:00:18 +08:00
return (
2021-01-05 14:27:35 +08:00
<Box className="ProjectListIndex">
<Short>
2020-05-22 17:00:18 +08:00
<ul className="list-l-Menu">
<li className={flag ? "active" : ""}>
<p>
2021-09-03 09:23:12 +08:00
<Link to={`/${owner}/${projectsId}/settings`} className="w-100">
2020-06-19 14:08:05 +08:00
<i className="iconfont icon-huabanfuben font-18 mr10"></i>
2020-08-18 16:56:52 +08:00
</Link>
2020-05-22 17:00:18 +08:00
</p>
</li>
<li
className={
2021-09-03 11:38:22 +08:00
pathname.indexOf("settings/collaborators") > -1 ? "active" : ""
2020-03-16 14:12:11 +08:00
}
2020-05-22 17:00:18 +08:00
>
<p>
2021-09-03 11:38:22 +08:00
<Link to={`/${owner}/${projectsId}/settings/collaborators`} className="w-100">
2020-06-19 14:08:05 +08:00
<i className="iconfont icon-chengyuan font-18 mr10"></i>
2020-05-22 17:00:18 +08:00
协作者管理
</Link>
</p>
</li>
2021-07-30 15:06:32 +08:00
<li
className={
2021-09-03 09:23:12 +08:00
pathname.indexOf("settings/webhooks") > -1 ? "active" : ""
2021-07-30 15:06:32 +08:00
}
>
<p>
2021-09-03 09:23:12 +08:00
<Link to={`/${owner}/${projectsId}/settings/webhooks`} className="w-100">
2021-07-30 15:06:32 +08:00
<i className="iconfont icon-a-xuanzhongwebhookicon font-18 mr10 color-grey-9"></i>
Webhooks
</Link>
</p>
</li>
2020-12-04 19:26:14 +08:00
<li
2020-05-22 17:00:18 +08:00
className={
2021-09-03 09:23:12 +08:00
pathname.indexOf("settings/branch") > -1 ? "active" : ""
2020-03-16 14:12:11 +08:00
}
2020-05-22 17:00:18 +08:00
>
<p>
2021-09-03 14:39:21 +08:00
<Link to={`/${owner}/${projectsId}/settings/branches`} className="w-100">
2020-05-22 17:00:18 +08:00
<i className="iconfont icon-fenzhi font-20 mr10"></i>
分支设置
</Link>
</p>
2020-12-04 19:26:14 +08:00
</li>
2020-05-22 17:00:18 +08:00
<li
2021-09-03 14:39:21 +08:00
className={pathname.indexOf("settings/labels") > -1 ? "active" : ""}
2020-05-22 17:00:18 +08:00
>
<p>
2021-09-03 14:39:21 +08:00
<Link to={`/${owner}/${projectsId}/settings/labels`} className="w-100">
2021-03-19 15:46:37 +08:00
<i className="iconfont icon-biaoqian3 font-18 mr10 color-grey-6"></i>
2020-05-22 17:00:18 +08:00
项目标签
</Link>
</p>
</li>
2020-04-09 18:13:26 +08:00
2020-05-22 17:12:44 +08:00
{/* <li
2020-05-22 17:00:18 +08:00
className={
2021-09-03 09:23:12 +08:00
pathname.indexOf("settings/manage") > -1 ? "active" : ""
2020-05-22 17:00:18 +08:00
}
>
<p>
2020-06-18 11:36:05 +08:00
<Link to={""} className="w-100">
2020-05-22 17:00:18 +08:00
<i className="iconfont icon-zhongqingdianxinicon10 font-18 mr10"></i>
管理Web钩子
</Link>
</p>
2020-05-22 17:12:44 +08:00
</li> */}
2020-05-22 17:00:18 +08:00
</ul>
2021-01-05 14:27:35 +08:00
</Short>
<Long>
2021-07-30 15:06:32 +08:00
<Gap>
2020-06-19 14:08:05 +08:00
<Switch {...this.props}>
2021-07-30 15:06:32 +08:00
{/* webhooks */}
<Route
2021-09-03 09:23:12 +08:00
path="/:owner/:projectsId/settings/webhooks/new"
2021-07-30 15:06:32 +08:00
render={(props) => (
<WebhookNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
2021-09-03 09:23:12 +08:00
path="/:owner/:projectsId/settings/webhooks/:id"
2021-07-30 15:06:32 +08:00
render={(props) => (
<WebhookNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
2021-09-03 09:23:12 +08:00
path="/:owner/:projectsId/settings/webhooks"
2021-07-30 15:06:32 +08:00
render={(props) => (
<Webhook {...this.props} {...props} {...this.state} />
)}
></Route>
2020-05-22 17:00:18 +08:00
{/* 协作者 */}
<Route
2021-09-03 11:38:22 +08:00
path="/:owner/:projectsId/settings/collaborators"
2020-05-22 17:00:18 +08:00
render={(props) => (
<Collaborator {...this.props} {...props} {...this.state} />
)}
></Route>
{/* 修改仓库信息 */}
<Route
2021-09-03 14:39:21 +08:00
path="/:owner/:projectsId/settings/labels"
2020-05-22 17:00:18 +08:00
render={(props) => (
<Tags {...this.props} {...props} {...this.state} />
)}
></Route>
2020-06-19 14:08:05 +08:00
<Route
2021-09-03 14:39:21 +08:00
path="/:owner/:projectsId/settings/branches/:branch"
2020-06-19 14:08:05 +08:00
render={(props) => (
<BranchNew {...this.props} {...props} {...this.state} />
)}
></Route>
2020-06-17 09:43:08 +08:00
<Route
2021-09-03 14:39:21 +08:00
path="/:owner/:projectsId/settings/branches"
2020-06-17 09:43:08 +08:00
render={(props) => (
2020-12-01 16:49:24 +08:00
<Branch {...this.props} {...props } {...this.state} />
2020-06-17 09:43:08 +08:00
)}
></Route>
2020-06-18 11:36:05 +08:00
<Route
2021-09-03 09:23:12 +08:00
path="/:owner/:projectsId/settings/manage/new"
2020-06-18 11:36:05 +08:00
render={(props) => (
<ManageNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
2021-09-03 09:23:12 +08:00
path="/:owner/:projectsId/settings/manage"
2020-06-18 11:36:05 +08:00
render={(props) => (
<Manage {...this.props} {...props} {...this.state} />
)}
></Route>
2020-05-22 17:00:18 +08:00
{/* 修改仓库信息 */}
<Route
2021-09-03 09:23:12 +08:00
path="/:owner/:projectsId/settings"
2020-05-22 17:00:18 +08:00
render={(props) => (
<Setting {...this.props} {...props} {...this.state} />
)}
></Route>
</Switch>
2021-01-05 14:27:35 +08:00
</Gap>
</Long>
</Box>
2020-05-22 17:00:18 +08:00
);
2020-03-16 14:12:11 +08:00
}
}
2020-05-22 17:00:18 +08:00
export default Index;