forked from Gitlink/forgeplus-react
合并请求
This commit is contained in:
parent
0a5991a93a
commit
99792045bc
|
@ -97,30 +97,35 @@ class CoderRootFileDetail extends Component{
|
|||
}
|
||||
|
||||
render(){
|
||||
const { detail } = this.props;
|
||||
const { detail , current_user , isManager , isReporter , isDeveloper } = this.props;
|
||||
const { readOnly ,value } = this.state;
|
||||
|
||||
const flag = current_user && current_user.login && (isManager || isReporter);
|
||||
return(
|
||||
<div>
|
||||
<div className="branchTable">
|
||||
<p className="branchTitle f-wrap-alignCenter f-wrap-between">
|
||||
<span>{bytesToSize(detail && detail.size)}</span>
|
||||
<span>
|
||||
{
|
||||
readOnly ?
|
||||
<a onClick={this.EditFile} className="ml20"><i className="iconfont icon-bianji font-15 color-grey-6"></i></a>
|
||||
:
|
||||
<React.Fragment>
|
||||
<button type="button" className="ant-btn ant-btn-sm mr10" onClick={this.CancelEdit}><span>取 消</span>
|
||||
</button>
|
||||
<button type="button" className="ant-btn ant-btn-primary ant-btn-sm" onClick={this.UpdateFile}><span>确 定</span>
|
||||
</button>
|
||||
</React.Fragment>
|
||||
}
|
||||
flag &&
|
||||
<span>
|
||||
{
|
||||
readOnly ?
|
||||
<a onClick={this.EditFile} className="ml20"><i className="iconfont icon-bianji font-15 color-grey-6"></i></a>
|
||||
:
|
||||
<React.Fragment>
|
||||
<button type="button" className="ant-btn ant-btn-sm mr10" onClick={this.CancelEdit}><span>取 消</span>
|
||||
</button>
|
||||
<button type="button" className="ant-btn ant-btn-primary ant-btn-sm" onClick={this.UpdateFile}><span>确 定</span>
|
||||
</button>
|
||||
</React.Fragment>
|
||||
}
|
||||
|
||||
<Popconfirm title="确认删除这个文件?" className="ml20" okText="确定" cancelText="取消" onConfirm={this.deleteFile}>
|
||||
<a><i className="iconfont icon-shanchu font-15 color-grey-6"></i></a>
|
||||
</Popconfirm>
|
||||
</span>
|
||||
<Popconfirm title="确认删除这个文件?" className="ml20" okText="确定" cancelText="取消" onConfirm={this.deleteFile}>
|
||||
<a><i className="iconfont icon-shanchu font-15 color-grey-6"></i></a>
|
||||
</Popconfirm>
|
||||
</span>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
<div className="content-file">
|
||||
|
|
|
@ -5,15 +5,20 @@ import axios from 'axios';
|
|||
import Nav from '../Order/Nav';
|
||||
import UploadComponent from '../Upload/Index';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import {Modal, Col, Form, Input, Tooltip, Popconfirm, Pagination , Spin,Dropdown,Icon,Menu} from 'antd'
|
||||
import NoneData from '../../modules/courses/coursesPublic/NoneData';
|
||||
import {Modal, Form, Input, Tooltip, Popconfirm, Pagination , Spin,Dropdown,Icon,Menu} from 'antd'
|
||||
import Attachments from '../Upload/attachment'
|
||||
import './merge.css';
|
||||
|
||||
import QuillForEditor from '../quillForEditor';
|
||||
|
||||
const TextArea = Input.TextArea;
|
||||
|
||||
|
||||
const options = [
|
||||
['bold', 'italic', 'underline'],
|
||||
[{header: [1,2,3,false]}],
|
||||
['blockquote', 'code-block'],
|
||||
['link', 'image'],
|
||||
['formula']
|
||||
];
|
||||
class MessageCount extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
|
@ -39,7 +44,9 @@ class MessageCount extends Component{
|
|||
mergename:'合并请求',
|
||||
mergekey:'merge',
|
||||
title:'',
|
||||
body:''
|
||||
body:'',
|
||||
commentsContent:undefined,
|
||||
quillFlag:false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,12 +88,19 @@ class MessageCount extends Component{
|
|||
|
||||
//添加评论
|
||||
addjournals=()=>{
|
||||
const { data, page, limit, fileList , commentsContent } = this.state;
|
||||
if(!commentsContent){
|
||||
this.setState({
|
||||
quillFlag:true
|
||||
})
|
||||
return;
|
||||
}
|
||||
this.props.form.validateFieldsAndScroll((err, values) => {
|
||||
if(!err){
|
||||
const { data, page, limit, fileList } = this.state;
|
||||
const url = `/issues/${data.issue.id}/journals.json`;
|
||||
axios.post(url,{
|
||||
...values,
|
||||
content:JSON.stringify(commentsContent),
|
||||
issue_id:data.id,
|
||||
attachment_ids:fileList
|
||||
}).then(result=>{
|
||||
|
@ -96,7 +110,9 @@ class MessageCount extends Component{
|
|||
attachments_ids: undefined
|
||||
});
|
||||
this.setState({
|
||||
showFiles: false
|
||||
showFiles: false,
|
||||
quillFlag:false,
|
||||
commentsContent:undefined
|
||||
})
|
||||
this.getjournalslist(page, limit);
|
||||
this.props.showNotification("评论成功!");
|
||||
|
@ -160,7 +176,7 @@ class MessageCount extends Component{
|
|||
project_id:projectsId,
|
||||
id:data.pull_request.id,
|
||||
do:mergekey,
|
||||
body:body,
|
||||
body:JSON.stringify(body),
|
||||
title:title,
|
||||
}).then(result=>{
|
||||
if(result){
|
||||
|
@ -173,14 +189,14 @@ class MessageCount extends Component{
|
|||
|
||||
//修改评论
|
||||
updatedetail=(id)=>{
|
||||
console.log("updtedetail", this.state)
|
||||
// console.log("updtedetail", this.state)
|
||||
const {page, limit,data } = this.state;
|
||||
const {orderId} = this.props.match.params;
|
||||
const url = `/issues/${data.issue.id}/journals/${id}.json`;
|
||||
axios.put(url,{
|
||||
issue_id:orderId,
|
||||
id:id,
|
||||
content:this.state.countvalue
|
||||
content:JSON.stringify(this.state.countvalue)
|
||||
}).then(result=>{
|
||||
if(result){
|
||||
this.setState({
|
||||
|
@ -217,9 +233,9 @@ class MessageCount extends Component{
|
|||
})
|
||||
}
|
||||
|
||||
changmodelname=(e)=>{
|
||||
changmodelname=(value)=>{
|
||||
this.setState({
|
||||
countvalue:e.target.value
|
||||
countvalue:value
|
||||
})
|
||||
}
|
||||
changtitlepr=(e)=>{
|
||||
|
@ -228,9 +244,9 @@ class MessageCount extends Component{
|
|||
})
|
||||
}
|
||||
|
||||
changbodypr=(e)=>{
|
||||
changbodypr=(value)=>{
|
||||
this.setState({
|
||||
body:e.target.value
|
||||
body:value
|
||||
})
|
||||
}
|
||||
editdetail=(count,status)=>{
|
||||
|
@ -314,9 +330,48 @@ class MessageCount extends Component{
|
|||
})
|
||||
}
|
||||
|
||||
changeComments=(value)=>{
|
||||
this.setState({
|
||||
commentsContent:value
|
||||
})
|
||||
if(value){
|
||||
this.setState({
|
||||
quillFlag:false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
stringJson=(value) =>{
|
||||
let _value = null;
|
||||
|
||||
try {
|
||||
_value = JSON.parse(value);
|
||||
} catch (e) {
|
||||
_value = value;
|
||||
}
|
||||
return _value
|
||||
}
|
||||
commentCtx = (ctx) => {
|
||||
let _ctx = null;
|
||||
|
||||
try {
|
||||
_ctx = JSON.parse(ctx);
|
||||
} catch (e) {
|
||||
_ctx = ctx;
|
||||
}
|
||||
|
||||
return (
|
||||
<QuillForEditor
|
||||
readOnly={true}
|
||||
value={_ctx}
|
||||
showUploadImage={this.handleShowImage}
|
||||
/>
|
||||
)
|
||||
};
|
||||
|
||||
render(){
|
||||
const { projectsId,mergeId } = this.props.match.params;
|
||||
const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles } = this.state;
|
||||
const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles , commentsContent , quillFlag } = this.state;
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
const { current_user } = this.props;
|
||||
const url = this.props.history.location.pathname;
|
||||
|
@ -370,7 +425,7 @@ class MessageCount extends Component{
|
|||
<div style={{display: (isedit && isedit === item.id) ? "none" : "block"}} >
|
||||
{
|
||||
item.content ?
|
||||
<div>{item.content}</div>
|
||||
this.commentCtx(item.content)
|
||||
:
|
||||
<div>
|
||||
{this.renderJournalList(item.journal_details)}
|
||||
|
@ -384,7 +439,20 @@ class MessageCount extends Component{
|
|||
}
|
||||
</div>
|
||||
<div style={{display: (isedit && isedit === item.id) ? "block" : "none"}}>
|
||||
<TextArea style={{height:"200px"}} value={this.state.countvalue} onChange={this.changmodelname}/>
|
||||
<QuillForEditor
|
||||
value = {this.stringJson(this.state.countvalue)}
|
||||
wrapStyle={{
|
||||
height: '220px',
|
||||
opacity:1,
|
||||
marginTop:"20px"
|
||||
}}
|
||||
// autoFocus={true}
|
||||
style={{ height: '170px' }}
|
||||
placeholder="评论内容"
|
||||
options={options}
|
||||
onContentChange={this.changmodelname}
|
||||
/>
|
||||
{/* <TextArea style={{height:"200px"}} value={this.state.countvalue} onChange={this.changmodelname}/> */}
|
||||
<p className="clearfix mt15">
|
||||
<a className="topWrapper_btn fr" type="submit" onClick={()=>this.updatedetail(item.id)}>保存</a>
|
||||
<a className="a_btn cancel_btn fr" type="submit" onClick={()=>this.editdetail(item.content,undefined)}>取消</a>
|
||||
|
@ -462,7 +530,7 @@ class MessageCount extends Component{
|
|||
|
||||
{ Paginations }
|
||||
<div className="df" style={{display:this.state.data&&this.state.data.pull_request.status===1?'none':'flex'}}>
|
||||
<Link to={``}><img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/></Link>
|
||||
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
|
||||
<div className="new_context" >
|
||||
<p>该合并请求可以进行自动合并操作</p>
|
||||
<p style={{marginTop:15,display:this.state.mergekey==='rebase'?this.state.buttonshow==='none'?"block":"none":this.state.ismesrge==='none'?"block":"none"}}>
|
||||
|
@ -477,7 +545,21 @@ class MessageCount extends Component{
|
|||
|
||||
<div style={{display:this.state.ismesrge,marginTop:15}}>
|
||||
<Input placeholder="标题" value={this.state.title} onChange={this.changtitlepr}/>
|
||||
<TextArea placeholder="=描述..." style={{height:"300px",marginTop:15}} value={this.state.body} onChange={this.changbodypr} />
|
||||
<div className="quillContent" style={{marginTop:"20px"}}>
|
||||
<QuillForEditor
|
||||
value = {this.state.body}
|
||||
wrapStyle={{
|
||||
height: '220px',
|
||||
opacity:1,
|
||||
}}
|
||||
// autoFocus={true}
|
||||
style={{ height: '170px' }}
|
||||
placeholder="评论内容..."
|
||||
options={options}
|
||||
onContentChange={this.changbodypr}
|
||||
/>
|
||||
</div>
|
||||
{/* <TextArea placeholder="请输入合并描述..." style={{height:"300px",marginTop:15}} value={this.state.body} onChange={this.changbodypr} /> */}
|
||||
</div>
|
||||
<p className="clearfix mt15" style={{display:this.state.buttonshow}}>
|
||||
<a className="topWrapper_btn " type="submit" onClick={()=>this.prmerge()}>合并请求</a>
|
||||
|
@ -488,10 +570,9 @@ class MessageCount extends Component{
|
|||
</div>
|
||||
<div className="order_line" style={{marginLeft:80}}></div>
|
||||
<div className="df">
|
||||
<Link to={``}><img className="user_img"
|
||||
src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/></Link>
|
||||
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
|
||||
<div className="new_context">
|
||||
<Form.Item>
|
||||
{/* <Form.Item>
|
||||
{getFieldDecorator('content', {
|
||||
rules: [{
|
||||
required: true, message: '请输入内容'
|
||||
|
@ -499,7 +580,24 @@ class MessageCount extends Component{
|
|||
})(
|
||||
<TextArea placeholder="添加评论..." style={{height: "200px"}}/>
|
||||
)}
|
||||
</Form.Item>
|
||||
</Form.Item> */}
|
||||
<div className="quillContent">
|
||||
<QuillForEditor
|
||||
value = {commentsContent}
|
||||
wrapStyle={{
|
||||
height: '240px',
|
||||
opacity:1,
|
||||
}}
|
||||
// autoFocus={true}
|
||||
style={{ height: '170px' }}
|
||||
placeholder="请输入合并描述..."
|
||||
options={options}
|
||||
onContentChange={this.changeComments}
|
||||
/>
|
||||
<p className="quillFlag">
|
||||
{ quillFlag && <span className="">请输入评论内容</span>}
|
||||
</p>
|
||||
</div>
|
||||
<UploadComponent load={this.UploadFunc} isComplete={showFiles}></UploadComponent>
|
||||
<p className="clearfix mt15">
|
||||
<a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a>
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
import React , {Component} from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import {Radio, Form,Menu,Dropdown,Input,Select,Table} from 'antd';
|
||||
import NoneData from '../../modules/courses/coursesPublic/NoneData';
|
||||
import reactCSS from 'reactcss'
|
||||
import axios from 'axios';
|
||||
import moment from 'moment'
|
||||
import UploadComponent from '../Upload/Index';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import '../Order/order.css';
|
||||
import QuillForEditor from '../quillForEditor';
|
||||
|
||||
const { Group, Button } = Radio;
|
||||
|
||||
const { Button } = Radio;
|
||||
const Option = Select.Option;
|
||||
const TextArea = Input.TextArea;
|
||||
|
||||
const options = [
|
||||
['bold', 'italic', 'underline'],
|
||||
[{header: [1,2,3,false]}],
|
||||
['blockquote', 'code-block'],
|
||||
['link', 'image'],
|
||||
['formula']
|
||||
];
|
||||
class NewMerge extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
|
@ -21,6 +27,7 @@ class NewMerge extends Component{
|
|||
merge:undefined,
|
||||
pull:undefined,
|
||||
//判断 是否显示创建合并请求的页面
|
||||
desc:undefined,
|
||||
iscreatemerge:'none',
|
||||
issue_tag_ids:"",
|
||||
fixed_version_id:"",
|
||||
|
@ -147,9 +154,10 @@ class NewMerge extends Component{
|
|||
}else{
|
||||
values.issue_tag_ids = []
|
||||
}
|
||||
|
||||
const { desc } = this.state;
|
||||
axios.post(url,{
|
||||
...values,
|
||||
body:JSON.stringify(desc),
|
||||
project_id:projectsId,
|
||||
head:this.state.merge,
|
||||
base:this.state.pull,
|
||||
|
@ -220,12 +228,18 @@ class NewMerge extends Component{
|
|||
|
||||
}
|
||||
|
||||
onContentChange=(value)=>{
|
||||
this.setState({
|
||||
desc:value
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
render(){
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
const { projectsId } = this.props.match.params;
|
||||
const { current_user } = this.props;
|
||||
const { issue_tag_ids , fixed_version_id ,assigned_to_id ,issue_chosen,data,titledata} = this.state;
|
||||
const { issue_tag_ids , fixed_version_id ,assigned_to_id ,issue_chosen,data,titledata , desc } = this.state;
|
||||
|
||||
|
||||
const columns=[{
|
||||
|
@ -317,7 +331,7 @@ class NewMerge extends Component{
|
|||
<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>
|
||||
<img class="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
|
||||
<div className="new_context">
|
||||
<Form.Item>
|
||||
{getFieldDecorator('title', {
|
||||
|
@ -328,13 +342,25 @@ class NewMerge extends Component{
|
|||
<Input placeholder="标题"/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<QuillForEditor
|
||||
value = {desc}
|
||||
wrapStyle={{
|
||||
height: '220px',
|
||||
opacity:1,
|
||||
}}
|
||||
// autoFocus={true}
|
||||
style={{ height: '170px' }}
|
||||
placeholder="合并请求的描述..."
|
||||
options={options}
|
||||
onContentChange={this.onContentChange}
|
||||
/>
|
||||
{/* <Form.Item>
|
||||
{getFieldDecorator('body', {
|
||||
rules: [],
|
||||
})(
|
||||
<TextArea placeholder="合并请求的描述。。。" style={{height:"300px"}}/>
|
||||
)}
|
||||
</Form.Item>
|
||||
</Form.Item> */}
|
||||
<UploadComponent load={this.UploadFunc} isComplete={true} ></UploadComponent>
|
||||
<p className="clearfix mt15">
|
||||
<a className="topWrapper_btn fr" type="submit" onClick={this.submit}>创建合并请求</a>
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
border-radius:4px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.new_context{
|
||||
flex:1;
|
||||
}
|
||||
.topmerge_btn{
|
||||
background: #21ba45;
|
||||
color: #FFFFFF!important;
|
||||
|
|
|
@ -6,7 +6,6 @@ import { getImageUrl } from 'educoder';
|
|||
import Nav from './Nav';
|
||||
import UploadComponent from '../Upload/Index';
|
||||
import QuillForEditor from '../quillForEditor';
|
||||
import { QuillDeltaToHtmlConverter } from 'quill-delta-to-html'
|
||||
|
||||
import './order.css';
|
||||
|
||||
|
@ -164,7 +163,7 @@ class New extends Component{
|
|||
<QuillForEditor
|
||||
value = {description}
|
||||
wrapStyle={{
|
||||
height: '220px',
|
||||
height: '240px',
|
||||
opacity:1,
|
||||
}}
|
||||
// autoFocus={true}
|
||||
|
|
Loading…
Reference in New Issue