Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge
commit
966af92b18
@ -0,0 +1,204 @@
|
|||||||
|
import React , {Component} from 'react';
|
||||||
|
import {Link} from 'react-router-dom';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
import Nav from '../Order/Nav';
|
||||||
|
import UploadComponent from '../Upload/Index';
|
||||||
|
|
||||||
|
import{ Modal,Col,Form,Input,Tooltip,Popconfirm,Table} from 'antd'
|
||||||
|
import NoneData from '../../modules/courses/coursesPublic/NoneData';
|
||||||
|
import { getImageUrl } from 'educoder';
|
||||||
|
|
||||||
|
|
||||||
|
const TextArea = Input.TextArea;
|
||||||
|
|
||||||
|
|
||||||
|
class MergeSubmit extends Component{
|
||||||
|
constructor(props){
|
||||||
|
super(props);
|
||||||
|
this.state={
|
||||||
|
data:undefined,
|
||||||
|
isShow:false,
|
||||||
|
imgsrc:'',
|
||||||
|
journalsdata:undefined,
|
||||||
|
//图片区域是否显示 none 隐藏 block 显示
|
||||||
|
display:'none',
|
||||||
|
titledisplay:'none',
|
||||||
|
countvalue:'',
|
||||||
|
//是否需要编辑
|
||||||
|
isedit:'block',
|
||||||
|
limit:50,
|
||||||
|
page:1,
|
||||||
|
titledata:undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount=()=>{
|
||||||
|
|
||||||
|
this.getDetail();
|
||||||
|
}
|
||||||
|
|
||||||
|
getDetail=()=>{
|
||||||
|
const { projectsId , mergeId} = this.props.match.params;
|
||||||
|
const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
|
||||||
|
axios.get(url).then((result)=>{
|
||||||
|
if(result){
|
||||||
|
this.setState({
|
||||||
|
data:result.data,
|
||||||
|
})
|
||||||
|
const { page , limit } = this.state;
|
||||||
|
|
||||||
|
this.getCommitList( result.data.pull_request.base , page , limit );
|
||||||
|
}
|
||||||
|
}).catch((error)=>{
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
handleok=() => {
|
||||||
|
this.setState({
|
||||||
|
isShow:false
|
||||||
|
});
|
||||||
|
};
|
||||||
|
handleCancel=()=>{
|
||||||
|
this.setState({
|
||||||
|
isShow:false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
imgshow=()=>{
|
||||||
|
this.setState({
|
||||||
|
isShow:true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
//获取提交列表
|
||||||
|
getCommitList=(branch , page , limit)=>{
|
||||||
|
const { login } = this.props.current_user;
|
||||||
|
const { projectsId } = this.props.match.params;
|
||||||
|
const url = `/${login}/${projectsId}/commits.json`;
|
||||||
|
axios.get(url,{
|
||||||
|
params:{
|
||||||
|
sha:branch,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
}
|
||||||
|
}).then((result)=>{
|
||||||
|
if(result){
|
||||||
|
const array = [];
|
||||||
|
result.data && result.data.commits.length > 0 && result.data.commits.map((item,key)=>{
|
||||||
|
array.push({
|
||||||
|
name:item.author && item.author.name,
|
||||||
|
image_url:item.author && item.author.image_url,
|
||||||
|
sha:item.sha,
|
||||||
|
time_from_now:item.time_from_now,
|
||||||
|
message:item.message
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.setState({
|
||||||
|
titledata:array,
|
||||||
|
dataCount:result.data.total_count,
|
||||||
|
isSpin:false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch((error)=>{console.log(error)})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render(){
|
||||||
|
const { projectsId,mergeId} = this.props.match.params;
|
||||||
|
const { data,titledata} = this.state;
|
||||||
|
|
||||||
|
|
||||||
|
const columns=[{
|
||||||
|
title:"作者",
|
||||||
|
dataIndex: 'name',
|
||||||
|
width:"10%",
|
||||||
|
render: (text,item) => (
|
||||||
|
<span className="f-wrap-alignCenter">
|
||||||
|
<img src={getImageUrl(`images/${item.image_url}`)} alt="" width="28px" height="28px" className="mr3 radius"/>
|
||||||
|
<label className="hide-1" style={{maxWidth:"75px"}}>{text}</label>
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},{
|
||||||
|
title:"SHA",
|
||||||
|
dataIndex: 'sha',
|
||||||
|
render: (text) => (
|
||||||
|
<span className="commitKey">{text}</span>
|
||||||
|
)
|
||||||
|
},{
|
||||||
|
title:"备注",
|
||||||
|
dataIndex: 'message',
|
||||||
|
render: (text) => (
|
||||||
|
<span>{text}</span>
|
||||||
|
)
|
||||||
|
},{
|
||||||
|
title:"提交时间",
|
||||||
|
className:"edu-txt-right",
|
||||||
|
dataIndex: 'time_from_now',
|
||||||
|
render: (text) => (
|
||||||
|
<span>{text}</span>
|
||||||
|
)
|
||||||
|
}]
|
||||||
|
|
||||||
|
const title =()=>{
|
||||||
|
return(
|
||||||
|
<div className="f-wrap-between" style={{alignItems:"center"}}>
|
||||||
|
<span className="font-16">提交列表</span>
|
||||||
|
{/* <div className="f-wrap-alignCenter">
|
||||||
|
<Input placeholder="搜索提交历史" style={{width:"300px"}}/>
|
||||||
|
<Checkbox className="ml15">所有分支</Checkbox>
|
||||||
|
<a className="btn_32 ml15">搜索</a>
|
||||||
|
</div> */}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = this.props.history.location.pathname;
|
||||||
|
return(
|
||||||
|
<div className="main">
|
||||||
|
<div className="topWrapper">
|
||||||
|
<Nav {...this.props} {...this.state}/>
|
||||||
|
<Link to={`/projects/${projectsId}/merge/new`} className="topWrapper_btn">创建合并请求</Link>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div className="detailContent">
|
||||||
|
<p>
|
||||||
|
<span className="font-16" > { data && data.issue.subject}</span>
|
||||||
|
<div>
|
||||||
|
<Link to={`/projects/${projectsId}/merge/${mergeId}/UpdateMerge`} className="color-blue fr">编辑</Link>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
|
<p className="mt15">{ data && data.issue.description}</p>
|
||||||
|
<p className="mt10 color-grey-c">
|
||||||
|
<div className={data&&data.issue_status==="关闭"?"closedetail":"opendetail"}>{data&&data.issue_status==="关闭"?"关闭中!":"开启中!"} </div>
|
||||||
|
由 { data && data.issue.author_name} 于 { data && data.issue.created_at }创建{ data && data.issue.journals_count && data.issue.journals_count > 0 ?` · ${data.issue.journals_count} 条评论`:""}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div className="detailHeader-wrapper">
|
||||||
|
<div className="normal f-wrap-between">
|
||||||
|
<ul className="headerMenu-wrapper">
|
||||||
|
<li className={url.indexOf("Messagecount")>0? "active" : ""}><Link to={`/projects/${projectsId}/merge/${mergeId}/Messagecount`}>对话内容</Link></li>
|
||||||
|
<li className={url.indexOf("MergeSubmit")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/merge/${mergeId}/MergeSubmit`}>代码提交</Link></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Table
|
||||||
|
className="mt20 wrap-commit-table"
|
||||||
|
columns={columns}
|
||||||
|
dataSource={titledata}
|
||||||
|
showHeader={false}
|
||||||
|
size="small"
|
||||||
|
pagination={false}
|
||||||
|
title={() => title()}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const WrappedMergeSubmitForm = Form.create({ name: 'MergeSubmitForm' })(MergeSubmit);
|
||||||
|
export default WrappedMergeSubmitForm;
|
@ -0,0 +1,355 @@
|
|||||||
|
import React , {Component} from 'react';
|
||||||
|
import {Link} from 'react-router-dom';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
import Nav from '../Order/Nav';
|
||||||
|
|
||||||
|
import UploadComponent from '../Upload/Index';
|
||||||
|
import { getImageUrl } from 'educoder';
|
||||||
|
import{ Modal,Col,Form,Input,Tooltip,Select } from 'antd'
|
||||||
|
import NoneData from '../../modules/courses/coursesPublic/NoneData';
|
||||||
|
|
||||||
|
import Attachments from '../Upload/attachment'
|
||||||
|
|
||||||
|
const TextArea = Input.TextArea;
|
||||||
|
const Option = Select.Option;
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateMerge extends Component{
|
||||||
|
constructor(props){
|
||||||
|
super(props);
|
||||||
|
this.state={
|
||||||
|
data:undefined,
|
||||||
|
isShow:false,
|
||||||
|
imgsrc:'',
|
||||||
|
journalsdata:undefined,
|
||||||
|
//图片区域是否显示 none 隐藏 block 显示
|
||||||
|
display:'none',
|
||||||
|
titledisplay:'none',
|
||||||
|
subject:'',
|
||||||
|
branch_name:"",
|
||||||
|
issue_tag_ids:"",
|
||||||
|
fixed_version_id:"",
|
||||||
|
tracker_id:0,
|
||||||
|
issue_type:0,
|
||||||
|
status_id:0,
|
||||||
|
assigned_to_id:"",
|
||||||
|
priority_id:0,
|
||||||
|
done_ratio:0,
|
||||||
|
textcount:"",
|
||||||
|
fileList:undefined,
|
||||||
|
get_attachments: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount=()=>{
|
||||||
|
this.InitData();
|
||||||
|
this.getDetail();
|
||||||
|
//this.getSelectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
InitData=()=>{
|
||||||
|
// this.props.form.setFieldsValue({
|
||||||
|
// ...this.state
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
getDetail=()=>{
|
||||||
|
const { projectsId , mergeId} = this.props.match.params;
|
||||||
|
const url = `/projects/${projectsId}/pull_requests/${mergeId}/edit.json`;
|
||||||
|
axios.get(url).then((result)=>{
|
||||||
|
if(result){
|
||||||
|
this.setState({
|
||||||
|
data:result.data,
|
||||||
|
subject:result.data.issue.subject,
|
||||||
|
issue_chosen:result.data.issue.issue_chosen,
|
||||||
|
branches:result.data.issue.branches,
|
||||||
|
tracker_id:result.data.issue.tracker_id,
|
||||||
|
issue_type:result.data.issue.issue_type,
|
||||||
|
status_id:result.data.issue.status_id,
|
||||||
|
priority_id:result.data.issue.priority_id,
|
||||||
|
done_ratio:result.data.issue.done_ratio,
|
||||||
|
textcount:result.data.issue.description,
|
||||||
|
branch_name: result.data.issue.branch_name,
|
||||||
|
get_attachments: result.data.issue.attachments,
|
||||||
|
fileList:undefined,
|
||||||
|
issue_tag_ids: result.data.issue.issue_tags && result.data.issue.issue_tags[0].id,
|
||||||
|
fixed_version_id: result.data.issue.fixed_version_id,
|
||||||
|
assigned_to_id: result.data.issue.assigned_to_id
|
||||||
|
})
|
||||||
|
// this.getjournalslist();
|
||||||
|
}
|
||||||
|
}).catch((error)=>{
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
handleok=() => {
|
||||||
|
this.setState({
|
||||||
|
isShow:false
|
||||||
|
});
|
||||||
|
};
|
||||||
|
handleCancel=()=>{
|
||||||
|
this.setState({
|
||||||
|
isShow:false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
imgshow=()=>{
|
||||||
|
this.setState({
|
||||||
|
isShow:true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
changmodelname=(e)=>{
|
||||||
|
this.setState({
|
||||||
|
subject:e.target.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
changmodelcount=(e)=>{
|
||||||
|
this.setState({
|
||||||
|
textcount:e.target.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
renderSelect=(list)=>{
|
||||||
|
if(list && list.length >0){
|
||||||
|
return(
|
||||||
|
list.map((item,key)=>{
|
||||||
|
return(
|
||||||
|
<Option key={key+1} value={item.id}>{item.name}</Option>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获取上传后的文件id数组
|
||||||
|
UploadFunc=(fileList)=>{
|
||||||
|
this.setState({
|
||||||
|
fileList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
handleSubmit=()=>{
|
||||||
|
const { fileList } = this.state;
|
||||||
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
||||||
|
if(!err){
|
||||||
|
const { projectsId} = this.props.match.params;
|
||||||
|
const { subject ,data} = this.state;
|
||||||
|
const url = `/projects/${projectsId}/issues/${data.issue.id}.json`;
|
||||||
|
|
||||||
|
if(values.issue_tag_ids===0){
|
||||||
|
values.issue_tag_ids = ""
|
||||||
|
}else{
|
||||||
|
values.issue_tag_ids = [values.issue_tag_ids]
|
||||||
|
}
|
||||||
|
if(values.assigned_to_id===0){
|
||||||
|
values.assigned_to_id = ""
|
||||||
|
}
|
||||||
|
axios.put(url,{
|
||||||
|
project_id:projectsId,
|
||||||
|
subject:subject,
|
||||||
|
id: data.issue.id,
|
||||||
|
description:this.state.textcount,
|
||||||
|
attachment_ids:fileList,
|
||||||
|
...values
|
||||||
|
}).then(result=>{
|
||||||
|
if(result){
|
||||||
|
this.props.history.push(`/projects/${projectsId}/merge`);
|
||||||
|
}
|
||||||
|
}).catch(error=>{
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render(){
|
||||||
|
const { projectsId,mergeId } = this.props.match.params;
|
||||||
|
const { getFieldDecorator } = this.props.form;
|
||||||
|
const { current_user } = this.props;
|
||||||
|
const { issue_tag_ids , fixed_version_id , branch_name , status_id , tracker_id , issue_type ,assigned_to_id , priority_id , done_ratio,
|
||||||
|
issue_chosen , branches, subject, textcount,get_attachments } = this.state;
|
||||||
|
return(
|
||||||
|
<div className="main">
|
||||||
|
<div className="topWrapper">
|
||||||
|
<Nav {...this.props} {...this.state}/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Form>
|
||||||
|
<div className="f-wrap-between mt20" style={{alignItems:"flex-start"}}>
|
||||||
|
<div className="list-right df" >
|
||||||
|
<Link to={``}><img class="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/></Link>
|
||||||
|
<div className="new_context">
|
||||||
|
<Form.Item>
|
||||||
|
{getFieldDecorator('subject', {
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请填写工单标题'
|
||||||
|
}],
|
||||||
|
initialValue: subject
|
||||||
|
})(
|
||||||
|
<Input placeholder="标题" onChange={this.changmodelname}/>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item>
|
||||||
|
{getFieldDecorator('description', {
|
||||||
|
rules: [],
|
||||||
|
initialValue: textcount
|
||||||
|
})(
|
||||||
|
<TextArea placeholder="请输入工单的描述..." style={{height:"300px"}} onChange={this.changmodelcount}/>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification}></UploadComponent>
|
||||||
|
{
|
||||||
|
get_attachments ?
|
||||||
|
<Attachments attachments={get_attachments} showNotification={this.props.showNotification} canDelete={true}/>
|
||||||
|
:
|
||||||
|
""
|
||||||
|
}
|
||||||
|
<p className="clearfix mt15 text-right">
|
||||||
|
<a className="topWrapper_btn fr" type="submit" style={{marginLeft:5}} onClick={this.handleSubmit}>保存</a>
|
||||||
|
<Link to={`/projects/${projectsId}/merge/${mergeId}/Messagecount`} className="a_btn cancel_btn fr">取消</Link>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="list-left" style={{paddingRight:"0px",paddingLeft:"15px",paddingTop:"10px"}}>
|
||||||
|
<div className="list-l-panel">
|
||||||
|
<Form.Item
|
||||||
|
label="分支"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('branch_name', {
|
||||||
|
initialValue: branch_name,
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select>
|
||||||
|
<Option value={''}>分支未指定</Option>
|
||||||
|
{
|
||||||
|
branches && branches.length >0 && branches.map((item,key)=>{
|
||||||
|
return(
|
||||||
|
<Option value={item}>{item}</Option>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="标签"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('issue_tag_ids', {
|
||||||
|
initialValue: issue_tag_ids ? [issue_tag_ids] : '',
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select>
|
||||||
|
<Option value={''}>未选择标签</Option>
|
||||||
|
{ this.renderSelect(issue_chosen && issue_chosen.issue_tag) }
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="里程碑"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('fixed_version_id', {
|
||||||
|
initialValue: fixed_version_id ? fixed_version_id : "",
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select>
|
||||||
|
<Option value={''}>未选择里程碑</Option>
|
||||||
|
{ this.renderSelect(issue_chosen && issue_chosen.issue_version) }
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="状态"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('status_id', {
|
||||||
|
initialValue:status_id,
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请选择完成状态'
|
||||||
|
}],
|
||||||
|
})(
|
||||||
|
<Select >
|
||||||
|
{ this.renderSelect(issue_chosen && issue_chosen.issue_status) }
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="分类"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('tracker_id', {
|
||||||
|
initialValue:tracker_id,
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请选择分类'
|
||||||
|
}],
|
||||||
|
})(
|
||||||
|
<Select>
|
||||||
|
{ this.renderSelect(issue_chosen && issue_chosen.tracker) }
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="指派成员"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('assigned_to_id', {
|
||||||
|
initialValue: assigned_to_id ? assigned_to_id : "",
|
||||||
|
})(
|
||||||
|
<Select>
|
||||||
|
<Option value={''}>未指派成员</Option>
|
||||||
|
{ this.renderSelect(issue_chosen && issue_chosen.assign_user) }
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="优先度"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('priority_id', {
|
||||||
|
|
||||||
|
initialValue:priority_id,
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请选择优先度'
|
||||||
|
}],
|
||||||
|
})(
|
||||||
|
<Select>
|
||||||
|
{ this.renderSelect(issue_chosen && issue_chosen.priority) }
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="完成度"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('done_ratio', {
|
||||||
|
initialValue:done_ratio,
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请选择完成度'
|
||||||
|
}],
|
||||||
|
})(
|
||||||
|
<Select value={done_ratio}>
|
||||||
|
{ this.renderSelect(issue_chosen && issue_chosen.done_ratio) }
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
<Modal
|
||||||
|
onCancel={this.handleCancel}
|
||||||
|
visible={this.state.isShow}
|
||||||
|
width="400px"
|
||||||
|
footer={
|
||||||
|
[]
|
||||||
|
}
|
||||||
|
bodyStyle={{textAlign:'center'}}
|
||||||
|
>
|
||||||
|
<img class="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
|
||||||
|
</Modal>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const UpdateMergeForm = Form.create({ name: 'UpdateMergeForm' })(UpdateMerge);
|
||||||
|
export default UpdateMergeForm;
|
@ -0,0 +1,13 @@
|
|||||||
|
.mergediv{
|
||||||
|
height: 65px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 15px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
border: 1px solid #EEEEEE;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
text-align: center;
|
||||||
|
border-radius:4px;
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
@ -0,0 +1,199 @@
|
|||||||
|
import React , { Component } from "react";
|
||||||
|
import { Form , Input , Select,Divider,Button,Checkbox,Dropdown,Menu} from 'antd';
|
||||||
|
import {Link} from 'react-router-dom';
|
||||||
|
|
||||||
|
import UploadComponent from '../Upload/Index';
|
||||||
|
import '../Order/order.css';
|
||||||
|
import './version.css';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const Option = Select.Option;
|
||||||
|
const TextArea = Input.TextArea;
|
||||||
|
class NewVersion extends Component{
|
||||||
|
constructor(props){
|
||||||
|
super(props);
|
||||||
|
this.state={
|
||||||
|
branch_name:"",
|
||||||
|
issue_tag_ids:"",
|
||||||
|
fixed_version_id:"",
|
||||||
|
issue_chosen:undefined,
|
||||||
|
fileList:undefined,
|
||||||
|
ischeck:undefined,
|
||||||
|
branches:undefined,
|
||||||
|
pull:undefined,
|
||||||
|
tag_name:'',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount=()=>{
|
||||||
|
this.InitData();
|
||||||
|
this.getSelectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
InitData=()=>{
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
...this.state
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getSelectList=()=>{
|
||||||
|
const { projectsId } = this.props.match.params;
|
||||||
|
const url = `/projects/${projectsId}/pull_requests/new.json`;
|
||||||
|
axios.get(url).then((result)=>{
|
||||||
|
if(result){
|
||||||
|
this.setState({
|
||||||
|
branches:result.data.branches,
|
||||||
|
pull:result.data.branches[0]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch((error)=>{
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderSelect=(list)=>{
|
||||||
|
if(list && list.length >0){
|
||||||
|
return(
|
||||||
|
list.map((item,key)=>{
|
||||||
|
return(
|
||||||
|
<Option key={key+1} value={item.id+""}>{item.name}</Option>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建
|
||||||
|
handleSubmit=(draft)=>{
|
||||||
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
||||||
|
if(!err){
|
||||||
|
const { projectsId } = this.props.match.params;
|
||||||
|
const { pull,tag_name,ischeck } = this.state;
|
||||||
|
const url = `/projects/${projectsId}/version_releases.json`;
|
||||||
|
// if(values.issue_type==="普通"){
|
||||||
|
// values.issue_type="1"
|
||||||
|
// }
|
||||||
|
axios.post(url,{
|
||||||
|
...values,
|
||||||
|
tag_name:tag_name,
|
||||||
|
draft:draft,
|
||||||
|
prerelease:ischeck,
|
||||||
|
target_commitish:pull
|
||||||
|
}).then(result=>{
|
||||||
|
if(result){
|
||||||
|
this.props.history.push(`/projects/${projectsId}/version`);
|
||||||
|
}
|
||||||
|
}).catch(error=>{
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取上传后的文件id数组
|
||||||
|
UploadFunc=(fileList)=>{
|
||||||
|
this.setState({
|
||||||
|
fileList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
RedieonChange=(e)=>{
|
||||||
|
this.setState({
|
||||||
|
ischeck:e.target.checked
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Preservation=()=>{
|
||||||
|
alert(this.state.ischeck)
|
||||||
|
}
|
||||||
|
|
||||||
|
renderMenu =(array,id)=>{
|
||||||
|
return(
|
||||||
|
<Menu>
|
||||||
|
{
|
||||||
|
array && array.length > 0 && array.map((item,key)=>{
|
||||||
|
return(
|
||||||
|
<Menu.Item key={item} onClick={()=>this.getOption(item)}>{item}</Menu.Item>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Menu>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
getOption=(name)=>{
|
||||||
|
this.setState({
|
||||||
|
pull:name
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
changmodelname=(e)=>{
|
||||||
|
this.setState({
|
||||||
|
tag_name:e.target.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
const { getFieldDecorator } = this.props.form;
|
||||||
|
const { current_user } = this.props;
|
||||||
|
const {branches,pull,tag_name} = this.state;
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="main">
|
||||||
|
<Form>
|
||||||
|
<h1 style={{marginLeft:15,marginTop:20}}>发布新版</h1>
|
||||||
|
<h5 style={{marginLeft:15}}>版本发布组织项目的版本。</h5>
|
||||||
|
<Divider/>
|
||||||
|
<div style={{display:'flex'}}>
|
||||||
|
<Input placeholder="标签名称" style={{width:180,marginLeft:15}} value={tag_name} onChange={this.changmodelname}/>
|
||||||
|
<div style={{marginLeft:20,marginRight:20}}>@ </div>
|
||||||
|
<Dropdown overlay={this.renderMenu(branches &&branches,'pull')} trigger={['click']} placement="bottomCenter">
|
||||||
|
<Button style={{width:180}}>{pull}</Button>
|
||||||
|
</Dropdown>
|
||||||
|
</div>
|
||||||
|
<div style={{display:'flex'}}>
|
||||||
|
<div className="versionmilepostleft">
|
||||||
|
<h1>标题</h1>
|
||||||
|
<div>
|
||||||
|
<Form.Item>
|
||||||
|
{getFieldDecorator('name', {
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请输入标题'
|
||||||
|
}],
|
||||||
|
})(
|
||||||
|
<Input placeholder="标题"/>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
<h1>内容</h1>
|
||||||
|
<Form.Item>
|
||||||
|
{getFieldDecorator('body', {
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请输入描述内容'
|
||||||
|
}],
|
||||||
|
})(
|
||||||
|
<TextArea placeholder="添加一个可选的扩展描述。。。" style={{height:"300px"}}/>
|
||||||
|
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<UploadComponent load={this.UploadFunc} style={{width:80,marginLeft:15}}></UploadComponent>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Divider/>
|
||||||
|
<div className="fr">
|
||||||
|
<Checkbox onChange={this.RedieonChange}>标记为预行版</Checkbox>
|
||||||
|
<p>标记此版本不适合生产使用</p>
|
||||||
|
</div>
|
||||||
|
<div className="clearfix mt15" style={{marginTop:5}} >
|
||||||
|
<a className='topWrapper_btn_close fr' onClick={()=>this.handleSubmit(true)} style={{marginLeft:15}} >保存草稿</a> <a className='topWrapper_btn fr' onClick={()=>this.handleSubmit(false)} style={{marginRight:15}}>发布版本</a>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const WrappedNewVersionForm = Form.create({ name: 'NewVersionForm' })(NewVersion);
|
||||||
|
export default WrappedNewVersionForm;
|
@ -0,0 +1,218 @@
|
|||||||
|
import React , { Component } from "react";
|
||||||
|
import { Form , Input , Select,Divider,Button,Checkbox,Dropdown,Menu} from 'antd';
|
||||||
|
import {Link} from 'react-router-dom';
|
||||||
|
|
||||||
|
import UploadComponent from '../Upload/Index';
|
||||||
|
import '../Order/order.css';
|
||||||
|
import './version.css';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const Option = Select.Option;
|
||||||
|
const TextArea = Input.TextArea;
|
||||||
|
class NewVersion extends Component{
|
||||||
|
constructor(props){
|
||||||
|
super(props);
|
||||||
|
this.state={
|
||||||
|
branch_name:"",
|
||||||
|
issue_tag_ids:"",
|
||||||
|
fixed_version_id:"",
|
||||||
|
issue_chosen:undefined,
|
||||||
|
fileList:undefined,
|
||||||
|
ischeck:undefined,
|
||||||
|
pull:undefined,
|
||||||
|
tag_name:'',
|
||||||
|
data:undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount=()=>{
|
||||||
|
this.InitData();
|
||||||
|
this.getSelectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
InitData=()=>{
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
...this.state
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getSelectList=()=>{
|
||||||
|
const { projectsId,versionId} = this.props.match.params;
|
||||||
|
const url = `/projects/${projectsId}/version_releases/${versionId}/edit.json`;
|
||||||
|
axios.get(url).then((result)=>{
|
||||||
|
if(result){
|
||||||
|
this.setState({
|
||||||
|
data:result.data,
|
||||||
|
pull:result.data.target_commitish
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch((error)=>{
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderSelect=(list)=>{
|
||||||
|
if(list && list.length >0){
|
||||||
|
return(
|
||||||
|
list.map((item,key)=>{
|
||||||
|
return(
|
||||||
|
<Option key={key+1} value={item.id+""}>{item.name}</Option>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete
|
||||||
|
deleteversion=()=>{
|
||||||
|
const { projectsId , versionId} = this.props.match.params;
|
||||||
|
const url = `/projects/${projectsId}/version_releases/${versionId}.json`;
|
||||||
|
axios.delete(url,{ data: {
|
||||||
|
project_id: projectsId,
|
||||||
|
id:versionId
|
||||||
|
}
|
||||||
|
}).then((result)=>{
|
||||||
|
if(result){
|
||||||
|
this.props.history.push(`/projects/${projectsId}/orders`);
|
||||||
|
}
|
||||||
|
}).catch((error)=>{
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建
|
||||||
|
handleSubmit=()=>{
|
||||||
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
||||||
|
if(!err){
|
||||||
|
const { projectsId} = this.props.match.params;
|
||||||
|
const { pull,tag_name,ischeck } = this.state;
|
||||||
|
const url = `/projects/${projectsId}/version_releases/.json`;
|
||||||
|
// if(values.issue_type==="普通"){
|
||||||
|
// values.issue_type="1"
|
||||||
|
// }
|
||||||
|
axios.post(url,{
|
||||||
|
...values,
|
||||||
|
tag_name:tag_name,
|
||||||
|
draft:false,
|
||||||
|
prerelease:ischeck,
|
||||||
|
target_commitish:pull
|
||||||
|
}).then(result=>{
|
||||||
|
if(result){
|
||||||
|
this.props.history.push(`/projects/${projectsId}/version`);
|
||||||
|
}
|
||||||
|
}).catch(error=>{
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取上传后的文件id数组
|
||||||
|
UploadFunc=(fileList)=>{
|
||||||
|
this.setState({
|
||||||
|
fileList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
RedieonChange=(e)=>{
|
||||||
|
this.setState({
|
||||||
|
ischeck:e.target.checked
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Preservation=()=>{
|
||||||
|
alert(this.state.ischeck)
|
||||||
|
}
|
||||||
|
|
||||||
|
renderMenu =(array,id)=>{
|
||||||
|
return(
|
||||||
|
<Menu>
|
||||||
|
{
|
||||||
|
array && array.length > 0 && array.map((item,key)=>{
|
||||||
|
return(
|
||||||
|
<Menu.Item key={item} onClick={()=>this.getOption(item)}>{item}</Menu.Item>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Menu>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
getOption=(name)=>{
|
||||||
|
this.setState({
|
||||||
|
pull:name
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
changmodelname=(e)=>{
|
||||||
|
this.setState({
|
||||||
|
tag_name:e.target.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
const { getFieldDecorator } = this.props.form;
|
||||||
|
const { current_user,projectsId} = this.props;
|
||||||
|
const {data,pull,tag_name} = this.state;
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="main">
|
||||||
|
<Form>
|
||||||
|
<h1 style={{marginLeft:15,marginTop:20}}>发布新版</h1>
|
||||||
|
<h5 style={{marginLeft:15}}>版本发布组织项目的版本。</h5>
|
||||||
|
<Divider/>
|
||||||
|
<div style={{display:'flex'}}>
|
||||||
|
{data.tag_name}@{pull}
|
||||||
|
</div>
|
||||||
|
<div style={{display:'flex'}}>
|
||||||
|
<div className="versionmilepostleft">
|
||||||
|
<h1>标题</h1>
|
||||||
|
<div>
|
||||||
|
<Form.Item>
|
||||||
|
{getFieldDecorator('name', {
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请输入标题'
|
||||||
|
}],
|
||||||
|
initialValue: data.name
|
||||||
|
|
||||||
|
})(
|
||||||
|
<Input placeholder="标题"/>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
<h1>内容</h1>
|
||||||
|
<Form.Item>
|
||||||
|
{getFieldDecorator('body', {
|
||||||
|
rules: [{
|
||||||
|
required: true, message: '请输入描述内容'
|
||||||
|
}],
|
||||||
|
initialValue: data.body
|
||||||
|
})(
|
||||||
|
<TextArea placeholder="添加一个可选的扩展描述。。。" style={{height:"300px"}}/>
|
||||||
|
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<UploadComponent load={this.UploadFunc} style={{width:80,marginLeft:15}}></UploadComponent>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Divider/>
|
||||||
|
<div className="fr">
|
||||||
|
<Checkbox onChange={this.RedieonChange}>标记为预行版</Checkbox>
|
||||||
|
<p>标记此版本不适合生产使用</p>
|
||||||
|
</div>
|
||||||
|
<div className="clearfix mt15" style={{marginTop:5}} >
|
||||||
|
<a className='topWrapper_btn_delete fr' onClick={this.deleteversion} style={{marginLeft:15}}>删除发布</a>
|
||||||
|
<a className='topWrapper_btn fr' onClick={this.handleSubmit} style={{marginRight:15}}>编辑发布信息</a>
|
||||||
|
<Link to={`/projects/${projectsId}/version`} className='topWrapper_btn fr'>取消</Link>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const WrappedNewVersionForm = Form.create({ name: 'NewVersionForm' })(NewVersion);
|
||||||
|
export default WrappedNewVersionForm;
|
@ -0,0 +1,24 @@
|
|||||||
|
.versionmilepostleft{
|
||||||
|
padding: 15px;
|
||||||
|
margin-right: 50px;
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
.topWrapper_btn_close {
|
||||||
|
background: #504b4b;
|
||||||
|
color: #FFFFFF!important;
|
||||||
|
padding:0px 12px;
|
||||||
|
text-align: center;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topWrapper_btn_delete {
|
||||||
|
background: #da1010;
|
||||||
|
color: #FFFFFF!important;
|
||||||
|
padding:0px 12px;
|
||||||
|
text-align: center;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
Loading…
Reference in new issue