forked from Gitlink/forgeplus-react
change pr
This commit is contained in:
parent
4ab6194c5e
commit
b38e8bd1b9
|
@ -1569,6 +1569,7 @@ a.edu-txt-w80,
|
|||
.font-80 {
|
||||
font-size: 80px !important;
|
||||
}
|
||||
.color-grey-b{color: #bbb !important}
|
||||
|
||||
/*a标签的下划线*/
|
||||
a.decoration {
|
||||
|
|
|
@ -98,7 +98,8 @@ export function initAxiosInterceptors(props) {
|
|||
|
||||
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
|
||||
// TODO 读取到package.json中的配置?
|
||||
var proxy = "http://localhost:3000"
|
||||
var
|
||||
// proxy = "http://localhost:3000"
|
||||
// proxy = "https://pre-newweb.educoder.net"
|
||||
proxy = "https://testforgeplus.trustie.net"
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ class Detail extends Component {
|
|||
<div className="detailHeader-wrapper">
|
||||
<div className="normal">
|
||||
<div className="f-wrap-between mb15" style={{ position: "relative" }}>
|
||||
<p className="font-18 color-white df flex-1 lineH2 mt15" style={{ alignItems: "center" }}>
|
||||
<p className="font-22 color-white df flex-1 lineH2 mt15" style={{ alignItems: "center" }}>
|
||||
{projectDetail && projectDetail.author &&
|
||||
<Link to={`/users/${projectDetail.author.login}`} className="show-user-link color-white">
|
||||
{projectDetail.author.name}
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { Component } from "react";
|
|||
import { Link } from "react-router-dom";
|
||||
import { Popconfirm, Tag } from "antd";
|
||||
import { getImageUrl } from "educoder";
|
||||
import "./merge.css"
|
||||
import "./merge.css";
|
||||
|
||||
class MergeItem extends Component {
|
||||
constructor(props) {
|
||||
|
@ -42,7 +42,7 @@ class MergeItem extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { issues, project_name } = this.props;
|
||||
const { issues, project_name, project_author_name } = this.props;
|
||||
const { projectsId } = this.props.match.params;
|
||||
const { current_user } = this.props;
|
||||
const renderList = () => {
|
||||
|
@ -60,7 +60,11 @@ class MergeItem extends Component {
|
|||
{item.name}
|
||||
</Link>
|
||||
<Tag className={`pr_tags_${item.pull_request_staus}`}>
|
||||
{item.pull_request_staus==="merged" ? "已合并" : (item.pull_request_staus === "closed"?"已拒绝" : "开启的") }
|
||||
{item.pull_request_staus === "merged"
|
||||
? "已合并"
|
||||
: item.pull_request_staus === "closed"
|
||||
? "已拒绝"
|
||||
: "开启的"}
|
||||
</Tag>
|
||||
</p>
|
||||
<p className="grid-item font-13">
|
||||
|
@ -94,19 +98,31 @@ class MergeItem extends Component {
|
|||
<span className="ml15">
|
||||
<Tag>
|
||||
<Link
|
||||
to={`projects/${projectsId}/coders?branch=${item.pull_request_head}`} className="maxW200px hide-1 ver-middle"
|
||||
to={`projects/${
|
||||
item.is_original ? item.fork_project_id : projectsId
|
||||
}/coders?branch=${item.pull_request_head}`}
|
||||
className="maxW200px hide-1 ver-middle"
|
||||
>
|
||||
{project_name}:{item.pull_request_head}
|
||||
{item.is_original
|
||||
? item.fork_project_user
|
||||
: project_author_name}
|
||||
:{item.pull_request_head}
|
||||
</Link>
|
||||
</Tag>
|
||||
<span className="mr8 ver-middle">
|
||||
<i className={"iconfont icon-youjiang color-grey-c font-16"}></i>
|
||||
<i
|
||||
className={
|
||||
"iconfont icon-youjiang color-grey-c font-16"
|
||||
}
|
||||
></i>
|
||||
</span>
|
||||
<Tag>
|
||||
<Link
|
||||
to={`projects/${projectsId}/coders?branch=${item.pull_request_base}`} className="maxW200px hide-1 ver-middle"
|
||||
to={`projects/${projectsId}/coders?branch=${item.pull_request_base}`}
|
||||
className="maxW200px hide-1 ver-middle"
|
||||
>
|
||||
{project_name}:{item.pull_request_base}
|
||||
{/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */}
|
||||
{project_author_name}:{item.pull_request_base}
|
||||
</Link>
|
||||
</Tag>
|
||||
</span>
|
||||
|
@ -133,7 +149,7 @@ class MergeItem extends Component {
|
|||
)}
|
||||
</li>
|
||||
<li>{item.version || "--"}</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div
|
||||
className="flex1 df"
|
||||
|
|
|
@ -258,10 +258,10 @@ class MessageCount extends Component {
|
|||
<div className="mt15">
|
||||
<Tag>
|
||||
<Link
|
||||
to={`projects/${projectsId}/coders?branch=${data.pull_request.head}`}
|
||||
to={`projects/${data.pull_request.is_original?data.pull_request.fork_project_id:projectsId}/coders?branch=${data.pull_request.head}`}
|
||||
className="ver-middle"
|
||||
>
|
||||
{data.project_name}:{data.pull_request.head}
|
||||
{data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}:{data.pull_request.head}
|
||||
</Link>
|
||||
</Tag>
|
||||
<span className="mr8 ver-middle">
|
||||
|
@ -276,7 +276,8 @@ class MessageCount extends Component {
|
|||
to={`projects/${projectsId}/coders?branch=${data.pull_request.base}`}
|
||||
className="ver-middle"
|
||||
>
|
||||
{data.project_name}:{data.pull_request.base}
|
||||
{/* {data.pull_request.is_fork ? data.pull_request.base : `${data.pull_request.pull_request_user}:${data.pull_request.base}`} */}
|
||||
{data.issue.project_author_name}:{data.pull_request.base}
|
||||
</Link>
|
||||
</Tag>
|
||||
</div>
|
||||
|
|
|
@ -3,8 +3,8 @@ import { Input, Select, Button, Spin, Alert } from "antd";
|
|||
import axios from "axios";
|
||||
import "../Order/order.css";
|
||||
import "./merge.css";
|
||||
import MergeForm from "./merge_form"
|
||||
import MergeFooter from "./merge_footer"
|
||||
import MergeForm from "./merge_form";
|
||||
import MergeFooter from "./merge_footer";
|
||||
const Option = Select.Option;
|
||||
class NewMerge extends Component {
|
||||
constructor(props) {
|
||||
|
@ -12,56 +12,132 @@ class NewMerge extends Component {
|
|||
this.state = {
|
||||
data: undefined,
|
||||
branches: undefined,
|
||||
origin_branches: undefined,
|
||||
merge: undefined,
|
||||
pull: undefined,
|
||||
merge_branches: undefined,
|
||||
merge_projects: undefined,
|
||||
merge: "master",
|
||||
pull: "master",
|
||||
is_fork: false,
|
||||
projects_names: undefined,
|
||||
isSpin: false,
|
||||
show_message: true,
|
||||
merge_head: false, // 是否向fork后的源项目发起合并请求
|
||||
default_message: "必须选择不同的分支",
|
||||
project_id: undefined, // 当前项目的id,也即开始发送合并请求的源项目id
|
||||
merge_project_user: undefined
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
this.getmergelist();
|
||||
const { projectsId } = this.props.match.params;
|
||||
|
||||
this.getmergelist(projectsId);
|
||||
};
|
||||
|
||||
//获取新建分枝数据
|
||||
getmergelist = () => {
|
||||
const { projectsId } = this.props.match.params;
|
||||
getmergelist = (projectsId) => {
|
||||
this.setState({isSpin: true})
|
||||
const url = `/projects/${projectsId}/pull_requests/new.json`;
|
||||
axios
|
||||
.get(url)
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
this.setState({
|
||||
data: result.data,
|
||||
is_fork: result.data.is_fork,
|
||||
projects_names: result.data.projects_names,
|
||||
merge_projects: result.data.merge_projects,
|
||||
branches: result.data.branches,
|
||||
origin_branches: result.data.branches,
|
||||
merge_branches: result.data.branches,
|
||||
project_id: result.data.project_id,
|
||||
});
|
||||
this.set_default_pull()
|
||||
this.set_default_merge()
|
||||
}
|
||||
this.setState({isSpin: false})
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({isSpin: false})
|
||||
console.log(error);
|
||||
});
|
||||
};
|
||||
|
||||
set_default_pull = () => {
|
||||
const {branches} = this.state;
|
||||
let default_pull = branches.filter((e) => e.name === "master")
|
||||
if (default_pull.length > 0){
|
||||
this.state.pull = default_pull[0].name
|
||||
}else{
|
||||
this.state.pull = "master"
|
||||
}
|
||||
}
|
||||
|
||||
set_default_merge = () => {
|
||||
const {merge_branches} = this.state;
|
||||
let default_merge = merge_branches.filter((e) => e.name === "master")
|
||||
if (default_merge.length > 0){
|
||||
this.state.merge = default_merge[0].name
|
||||
}else{
|
||||
this.state.merge = "master"
|
||||
}
|
||||
this.ischeckmerge();
|
||||
}
|
||||
|
||||
newMergelist = (projectsId) => {
|
||||
this.setState({isSpin: true})
|
||||
const url = `/projects/${projectsId}/pull_requests/get_branches.json`;
|
||||
axios
|
||||
.get(url)
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
this.setState({
|
||||
merge_branches: result.data
|
||||
})
|
||||
this.set_default_merge()
|
||||
}
|
||||
this.setState({isSpin: false})
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({isSpin: false})
|
||||
console.log(error);
|
||||
});
|
||||
};
|
||||
|
||||
selectBrach = (type, value) => {
|
||||
const {merge_head,projects_names} = this.state;
|
||||
this.state[type] = value;
|
||||
this.ischeckmerge();
|
||||
};
|
||||
|
||||
selectProjectName = (value) => {
|
||||
const { project_id, projects_names } = this.state;
|
||||
|
||||
let is_fork_id = parseInt(value) !== parseInt(project_id)
|
||||
this.setState({
|
||||
isSpin: true,
|
||||
merge_head: is_fork_id,
|
||||
data: {
|
||||
is_original: is_fork_id,
|
||||
fork_project_id: is_fork_id ? project_id : "",
|
||||
merge_user_login: is_fork_id ? projects_names[0].project_user_login : undefined
|
||||
}
|
||||
})
|
||||
this.props.history.push(`/projects/${value}/merge/new`);
|
||||
this.newMergelist(value);
|
||||
|
||||
};
|
||||
|
||||
//判断2分支是否可以合并
|
||||
|
||||
ischeckmerge = () => {
|
||||
this.setState({ isSpin: true });
|
||||
const { projectsId } = this.props.match.params;
|
||||
const { pull, merge } = this.state;
|
||||
const { pull, merge, project_id, merge_head } = this.state;
|
||||
const url = `/projects/${projectsId}/pull_requests/check_can_merge.json`;
|
||||
axios
|
||||
.post(url, {
|
||||
project_id: projectsId,
|
||||
head: merge ? merge : "master",
|
||||
base: pull ? pull : "master",
|
||||
head: merge,
|
||||
base: pull,
|
||||
is_original: merge_head,
|
||||
fork_project_id: merge_head ? project_id : ""
|
||||
})
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
|
@ -95,20 +171,38 @@ class NewMerge extends Component {
|
|||
const {
|
||||
data,
|
||||
branches,
|
||||
origin_branches,
|
||||
merge_branches,
|
||||
merge_projects,
|
||||
pull,
|
||||
merge,
|
||||
isSpin,
|
||||
show_message,
|
||||
default_message,
|
||||
merge_head,
|
||||
projects_names,
|
||||
} = this.state;
|
||||
|
||||
const renderBrances = (list) => {
|
||||
const { projectsId } = this.props.match.params;
|
||||
const renderBrances = (list, type) => {
|
||||
if (list && list.length > 0) {
|
||||
return list.map((item, key) => {
|
||||
return (
|
||||
<Option key={key + 1} value={item}>
|
||||
{item}
|
||||
<Option
|
||||
key={key + 1}
|
||||
value={item.name}
|
||||
>
|
||||
{type ? `${item.user_name}:${item.name}` : item.name}
|
||||
</Option>
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const renderProjectNames = (list) => {
|
||||
if (list && list.length > 0) {
|
||||
return list.map((item, key) => {
|
||||
return (
|
||||
<Option key={key + 1} value={item.project_id}>
|
||||
{item.project_name}
|
||||
</Option>
|
||||
);
|
||||
});
|
||||
|
@ -120,65 +214,77 @@ class NewMerge extends Component {
|
|||
};
|
||||
|
||||
return (
|
||||
<div >
|
||||
<div>
|
||||
<div className="main">
|
||||
<Spin spinning={isSpin}>
|
||||
<div className="merge-header width100 inline-block">
|
||||
<div className="width45 pull-left">
|
||||
<div className="color-grey-3 mb10 fwb">源分支:</div>
|
||||
<Input.Group compact className="display-flex">
|
||||
<Button className="merge-header-button maxW50 hide-1 task-hide">
|
||||
{data && data.project_author} / {data && data.project_name}
|
||||
</Button>
|
||||
<Select
|
||||
defaultValue={pull ? pull : "master"}
|
||||
onSelect={(e) => this.selectBrach("pull", e)}
|
||||
showSearch
|
||||
className="minW50 merge-flex1"
|
||||
>
|
||||
{renderBrances(branches)}
|
||||
</Select>
|
||||
</Input.Group>
|
||||
</div>
|
||||
<div className="width10 pull-left text-center mt25">
|
||||
<i className={"iconfont icon-youjiang color-grey-c font-32"}></i>
|
||||
</div>
|
||||
<div className="width45 pull-left">
|
||||
<div>
|
||||
<div className="color-grey-3 mb10 fwb">目标分支:</div>
|
||||
<Spin spinning={isSpin}>
|
||||
<div className="merge-header width100 inline-block">
|
||||
<div className="width45 pull-left">
|
||||
<div className="color-grey-3 mb10 fwb">源分支:</div>
|
||||
<Input.Group compact className="display-flex">
|
||||
<Button className="merge-header-button maxW50 hide-1 task-hide">
|
||||
{data && data.project_author} / {data && data.project_name}
|
||||
</Button>
|
||||
<Select
|
||||
defaultValue={merge ? merge : "master"}
|
||||
onSelect={(e) => this.selectBrach("merge", e)}
|
||||
defaultValue={parseInt(projectsId)}
|
||||
class=" maxW50 hide-1 task-hide"
|
||||
disabled
|
||||
>
|
||||
{renderProjectNames(projects_names)}
|
||||
</Select>
|
||||
<Select
|
||||
defaultValue={pull}
|
||||
onSelect={(e) => this.selectBrach("pull", e)}
|
||||
showSearch
|
||||
className="minW50 merge-flex1"
|
||||
>
|
||||
{renderBrances(branches)}
|
||||
{renderBrances(branches, false)}
|
||||
</Select>
|
||||
</Input.Group>
|
||||
</div>
|
||||
<div className="width10 pull-left text-center mt25">
|
||||
<i
|
||||
className={"iconfont icon-youjiang color-grey-c font-32"}
|
||||
></i>
|
||||
</div>
|
||||
<div className="width45 pull-left">
|
||||
<div>
|
||||
<div className="color-grey-3 mb10 fwb">目标分支:</div>
|
||||
<Input.Group compact className="display-flex">
|
||||
<Select
|
||||
defaultValue={parseInt(projectsId)}
|
||||
class=" maxW50 hide-1 task-hide"
|
||||
onSelect={(e) => this.selectProjectName(e)}
|
||||
>
|
||||
{renderProjectNames(merge_projects)}
|
||||
</Select>
|
||||
<Select
|
||||
defaultValue={merge}
|
||||
value={merge}
|
||||
onSelect={(e) => this.selectBrach("merge", e)}
|
||||
showSearch
|
||||
className="minW50 merge-flex1"
|
||||
>
|
||||
{renderBrances(merge_branches, merge_head)}
|
||||
</Select>
|
||||
</Input.Group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{show_message ? (
|
||||
<div className="mb50 mt50">
|
||||
<Alert
|
||||
description={withHtml(default_message)}
|
||||
type="error"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
:
|
||||
<MergeForm {...this.props} merge_type="new" data={data} merge={merge?merge:"master"} pull={pull?pull:"master"}></MergeForm>
|
||||
}
|
||||
</Spin>
|
||||
{show_message ? (
|
||||
<div className="mb50 mt50">
|
||||
<Alert description={withHtml(default_message)} type="error" />
|
||||
</div>
|
||||
) : (
|
||||
<MergeForm
|
||||
{...this.props}
|
||||
merge_type="new"
|
||||
data={data}
|
||||
merge={merge}
|
||||
pull={pull}
|
||||
></MergeForm>
|
||||
)}
|
||||
</Spin>
|
||||
</div>
|
||||
<div className=" main">
|
||||
{/* <div className=" main">
|
||||
<MergeFooter footer_type="new" {...this.props}></MergeFooter>
|
||||
</div>
|
||||
|
||||
</div> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -57,13 +57,13 @@ class UpdateMerge extends Component {
|
|||
<div className="merge-header width100 inline-block">
|
||||
<div className="width45 pull-left">
|
||||
<div className="color-grey-3 mb10 fwb">源分支:</div>
|
||||
|
||||
<Input.Group compact className="display-flex">
|
||||
<Button className="merge-header-button maxW50 hide-1 task-hide">
|
||||
{data && data.project_author} /{" "}
|
||||
{data && data.project_name}
|
||||
{data.is_original ? `${data.fork_project_user_name}/${data.fork_project_identifier}` : `${data.project_author}/${data.project_name}`}
|
||||
</Button>
|
||||
<Select
|
||||
defaultValue={pull ? pull : "master"}
|
||||
defaultValue={data.is_original ? `${data.fork_project_user}:${pull}` : `${pull}`}
|
||||
className="minW50 merge-flex1"
|
||||
disabled
|
||||
></Select>
|
||||
|
@ -79,11 +79,10 @@ class UpdateMerge extends Component {
|
|||
<div className="color-grey-3 mb10 fwb">目标分支:</div>
|
||||
<Input.Group compact className="display-flex">
|
||||
<Button className="merge-header-button maxW50 hide-1 task-hide">
|
||||
{data && data.project_author} /{" "}
|
||||
{data && data.project_name}
|
||||
{`${data.project_author}/${data.project_name}`}
|
||||
</Button>
|
||||
<Select
|
||||
defaultValue={merge ? merge : "master"}
|
||||
defaultValue={data.is_original ? `${data.project_login}:${merge}` : `${merge}`}
|
||||
className="minW50 merge-flex1"
|
||||
disabled
|
||||
></Select>
|
||||
|
@ -105,9 +104,9 @@ class UpdateMerge extends Component {
|
|||
)}
|
||||
</Spin>
|
||||
</div>
|
||||
<div className=" main">
|
||||
{/* <div className=" main">
|
||||
<MergeFooter footer_type="new" {...this.props}></MergeFooter>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -417,6 +417,7 @@ class merge extends Component {
|
|||
page={select_params.page}
|
||||
limit={select_params.limit}
|
||||
project_name={data.project_name}
|
||||
project_author_name={data.project_author_name}
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
></OrderItem>
|
||||
|
|
|
@ -33,12 +33,12 @@ class MergeFooter extends Component {
|
|||
</TabPane>
|
||||
}
|
||||
|
||||
<TabPane tab={<span className="ml-3 font-16">提交</span>} key="2">
|
||||
{/* <TabPane tab={<span className="ml-3 font-16">提交</span>} key="2">
|
||||
<CodesCommit {...this.props} main_class="pd10"></CodesCommit>
|
||||
</TabPane>
|
||||
<TabPane tab={<span className="ml-3 font-16">文件</span>} key="3">
|
||||
</TabPane> */}
|
||||
{/* <TabPane tab={<span className="ml-3 font-16">文件</span>} key="3">
|
||||
<Empty />
|
||||
</TabPane>
|
||||
</TabPane> */}
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { Component } from "react";
|
||||
import { Button, Form, Menu, Input, Select, Tag, Checkbox } from "antd";
|
||||
import { Button, Form, Menu, Input, Select, Tag, Checkbox, Spin } from "antd";
|
||||
import axios from "axios";
|
||||
|
||||
import "../Order/order.css";
|
||||
|
@ -21,19 +21,45 @@ class MergeForm extends Component {
|
|||
mergedata: undefined,
|
||||
priority_id: undefined,
|
||||
title: undefined,
|
||||
members: undefined,
|
||||
issue_tags: undefined,
|
||||
issue_versions: undefined,
|
||||
issue_priories: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
this.get_default_selects();
|
||||
this.set_defatul();
|
||||
};
|
||||
get_default_selects = () => {
|
||||
const { projectsId } = this.props.match.params;
|
||||
this.setState({ isSpin: true });
|
||||
axios
|
||||
.get(`/projects/${projectsId}/pull_requests/create_merge_infos.json`)
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
this.setState({
|
||||
members: result.data.members,
|
||||
issue_tags: result.data.issue_tags,
|
||||
issue_versions: result.data.issue_versions,
|
||||
issue_priories: result.data.issue_priories,
|
||||
});
|
||||
}
|
||||
this.setState({ isSpin: false });
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({ isSpin: false });
|
||||
console.log(error);
|
||||
});
|
||||
};
|
||||
set_defatul = () => {
|
||||
const { data, merge_type } = this.props;
|
||||
if (data && merge_type === "edit") {
|
||||
this.setState({
|
||||
desc: data.body,
|
||||
issue_tag_ids: data.issue_tag_ids[0],
|
||||
fixed_version_id: String(data.fixed_version_id),
|
||||
fixed_version_id: data.fixed_version_id ? String(data.fixed_version_id) : undefined,
|
||||
assigned_to_id: String(data.assigned_to_id),
|
||||
priority_id: String(data.priority_id),
|
||||
title: data.title,
|
||||
|
@ -106,6 +132,8 @@ class MergeForm extends Component {
|
|||
values.issue_tag_ids = [];
|
||||
}
|
||||
const { desc } = this.state;
|
||||
const { data } = this.props;
|
||||
console.log("merge_type", merge_type)
|
||||
if (merge_type === "new") {
|
||||
let url = `/projects/${projectsId}/pull_requests.json`;
|
||||
axios
|
||||
|
@ -114,6 +142,9 @@ class MergeForm extends Component {
|
|||
body: desc,
|
||||
head: pull,
|
||||
base: merge,
|
||||
is_original: data.is_original,
|
||||
fork_project_id: data.fork_project_id,
|
||||
merge_user_login: data.merge_user_login
|
||||
})
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
|
@ -136,30 +167,32 @@ class MergeForm extends Component {
|
|||
} else {
|
||||
let url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
|
||||
axios
|
||||
.put(url, {
|
||||
...values,
|
||||
body: desc,
|
||||
head: pull,
|
||||
base: merge,
|
||||
})
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
.put(url, {
|
||||
...values,
|
||||
body: desc,
|
||||
head: pull,
|
||||
base: merge,
|
||||
})
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
this.setState({
|
||||
isSpin: false,
|
||||
});
|
||||
this.props.history.push(
|
||||
`/projects/${projectsId}/merge/${mergeId}/Messagecount`
|
||||
);
|
||||
} else {
|
||||
this.setState({
|
||||
isSpin: false,
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({
|
||||
isSpin: false,
|
||||
});
|
||||
this.props.history.push(`/projects/${projectsId}/merge/${mergeId}/Messagecount`);
|
||||
} else {
|
||||
this.setState({
|
||||
isSpin: false,
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({
|
||||
isSpin: false,
|
||||
console.log(error);
|
||||
});
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setState({
|
||||
|
@ -187,130 +220,136 @@ class MergeForm extends Component {
|
|||
desc,
|
||||
isSpin,
|
||||
title,
|
||||
members,
|
||||
issue_tags,
|
||||
issue_versions,
|
||||
issue_priories,
|
||||
} = this.state;
|
||||
return (
|
||||
<div>
|
||||
<div className="mt20 mb20">
|
||||
<span className="font-16 fwb mr10 ver-middle">
|
||||
{merge_type === "new" ? "新建" : "编辑"}合并请求:
|
||||
</span>
|
||||
<Tag color="#28BD6C" className="ver-middle">
|
||||
可合并的
|
||||
</Tag>
|
||||
</div>
|
||||
<Form>
|
||||
<div className="width100 inline-block">
|
||||
<div className="width70 pull-left">
|
||||
<Form.Item>
|
||||
{getFieldDecorator("title", {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写请求标题",
|
||||
},
|
||||
],
|
||||
initialValue: title,
|
||||
})(<Input placeholder="标题" />)}
|
||||
</Form.Item>
|
||||
<MDEditor
|
||||
placeholder={"请输入合并请求的描述..."}
|
||||
height={350}
|
||||
mdID={"merge-new-description"}
|
||||
initValue={desc}
|
||||
onChange={this.onContentChange}
|
||||
></MDEditor>
|
||||
<p className="clearfix mt20">
|
||||
<Button
|
||||
type="primary"
|
||||
loading={isSpin}
|
||||
onClick={this.handleSubmit}
|
||||
>
|
||||
<span className="plr10">
|
||||
{merge_type === "new" ? "创建" : "提交"}
|
||||
</span>
|
||||
</Button>
|
||||
<Button
|
||||
type="default"
|
||||
className="ml30"
|
||||
href={
|
||||
merge_type === "new"
|
||||
? `/projects/${projectsId}/merge`
|
||||
: `/projects/${projectsId}/merge/${mergeId}/detail`
|
||||
}
|
||||
>
|
||||
<span className="plr10">取消</span>
|
||||
</Button>
|
||||
</p>
|
||||
</div>
|
||||
<div className="width30 pull-left">
|
||||
<div className="pl30">
|
||||
<Spin spinning={isSpin}>
|
||||
<div className="mt20 mb20">
|
||||
<span className="font-16 fwb mr10 ver-middle">
|
||||
{merge_type === "new" ? "新建" : "编辑"}合并请求:
|
||||
</span>
|
||||
<Tag color="#28BD6C" className="ver-middle">
|
||||
可合并的
|
||||
</Tag>
|
||||
</div>
|
||||
<Form>
|
||||
<div className="width100 inline-block">
|
||||
<div className="width70 pull-left">
|
||||
<Form.Item>
|
||||
{getFieldDecorator("assigned_to_id", {
|
||||
initialValue: assigned_to_id,
|
||||
})(
|
||||
<Select placeholder="审查人员" showSearch>
|
||||
{this.renderSelect(data && data.members)}
|
||||
</Select>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
{getFieldDecorator("fixed_version_id", {
|
||||
initialValue: fixed_version_id,
|
||||
})(
|
||||
<Select
|
||||
placeholder={
|
||||
data && data.issue_versions.length > 0
|
||||
? "未选择里程碑"
|
||||
: "请添加里程碑"
|
||||
}
|
||||
showSearch
|
||||
>
|
||||
{this.renderSelect(data && data.issue_versions)}
|
||||
</Select>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
{getFieldDecorator("issue_tag_ids", {
|
||||
initialValue: issue_tag_ids,
|
||||
})(
|
||||
<Select
|
||||
placeholder={
|
||||
data && data.issue_tags.length > 0
|
||||
? "未选择标签"
|
||||
: "请在仓库设置里添加标签"
|
||||
}
|
||||
showSearch
|
||||
>
|
||||
{this.renderSelect(data && data.issue_tags)}
|
||||
</Select>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
{getFieldDecorator("priority_id", {
|
||||
initialValue: priority_id,
|
||||
})(
|
||||
<Select placeholder="优先级" showSearch>
|
||||
{this.renderSelect(data && data.issue_priories)}
|
||||
</Select>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item name="checkbox-group" label="其他">
|
||||
<Checkbox.Group>
|
||||
<div>
|
||||
<Checkbox value="A">必须审查代码</Checkbox>
|
||||
</div>
|
||||
<div>
|
||||
<Checkbox value="B">合并后删除提交分支</Checkbox>
|
||||
</div>
|
||||
<div>
|
||||
<Checkbox value="C">合并后关闭提到的任务</Checkbox>
|
||||
</div>
|
||||
</Checkbox.Group>
|
||||
{getFieldDecorator("title", {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写请求标题",
|
||||
},
|
||||
],
|
||||
initialValue: title,
|
||||
})(<Input placeholder="标题" />)}
|
||||
</Form.Item>
|
||||
<MDEditor
|
||||
placeholder={"请输入合并请求的描述..."}
|
||||
height={350}
|
||||
mdID={"merge-new-description"}
|
||||
initValue={desc}
|
||||
onChange={this.onContentChange}
|
||||
></MDEditor>
|
||||
<p className="clearfix mt20">
|
||||
<Button
|
||||
type="primary"
|
||||
loading={isSpin}
|
||||
onClick={this.handleSubmit}
|
||||
>
|
||||
<span className="plr10">
|
||||
{merge_type === "new" ? "创建" : "提交"}
|
||||
</span>
|
||||
</Button>
|
||||
<Button
|
||||
type="default"
|
||||
className="ml30"
|
||||
href={
|
||||
merge_type === "new"
|
||||
? `/projects/${projectsId}/merge`
|
||||
: `/projects/${projectsId}/merge/${mergeId}/detail`
|
||||
}
|
||||
>
|
||||
<span className="plr10">取消</span>
|
||||
</Button>
|
||||
</p>
|
||||
</div>
|
||||
<div className="width30 pull-left">
|
||||
<div className="pl30">
|
||||
<Form.Item>
|
||||
{getFieldDecorator("assigned_to_id", {
|
||||
initialValue: assigned_to_id,
|
||||
})(
|
||||
<Select placeholder="审查人员" showSearch>
|
||||
{this.renderSelect(members)}
|
||||
</Select>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
{getFieldDecorator("fixed_version_id", {
|
||||
initialValue: fixed_version_id,
|
||||
})(
|
||||
<Select
|
||||
placeholder={
|
||||
issue_versions && issue_versions.length > 0
|
||||
? "未选择里程碑"
|
||||
: "请添加里程碑"
|
||||
}
|
||||
showSearch
|
||||
>
|
||||
{this.renderSelect(issue_versions)}
|
||||
</Select>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
{getFieldDecorator("issue_tag_ids", {
|
||||
initialValue: issue_tag_ids,
|
||||
})(
|
||||
<Select
|
||||
placeholder={
|
||||
issue_tags && issue_tags.length > 0
|
||||
? "未选择标签"
|
||||
: "请在仓库设置里添加标签"
|
||||
}
|
||||
showSearch
|
||||
>
|
||||
{this.renderSelect(issue_tags)}
|
||||
</Select>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
{getFieldDecorator("priority_id", {
|
||||
initialValue: priority_id,
|
||||
})(
|
||||
<Select placeholder="优先级" showSearch>
|
||||
{this.renderSelect(issue_priories)}
|
||||
</Select>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item name="checkbox-group" label="其他">
|
||||
<Checkbox.Group>
|
||||
<div>
|
||||
<Checkbox value="A">必须审查代码</Checkbox>
|
||||
</div>
|
||||
<div>
|
||||
<Checkbox value="B">合并后删除提交分支</Checkbox>
|
||||
</div>
|
||||
<div>
|
||||
<Checkbox value="C">合并后关闭提到的任务</Checkbox>
|
||||
</div>
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
</Form>
|
||||
</Spin>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class Nodata extends Component{
|
|||
<div className="none_panels">
|
||||
<div>
|
||||
<div className="mb15">
|
||||
<i className="iconfont icon-hebingqingqiu font-80 ver-middle color-grey-8"></i>
|
||||
<i className="iconfont icon-hebingqingqiu font-80 ver-middle color-grey-b"></i>
|
||||
</div>
|
||||
<h3>欢迎使用合并请求!</h3>
|
||||
|
||||
|
|
Loading…
Reference in New Issue