This commit is contained in:
caicai8 2020-03-31 15:07:27 +08:00
parent 0ec824d0cb
commit bdf61d7bbb
8 changed files with 256 additions and 227 deletions

View File

@ -256,6 +256,7 @@ class CoderRootDirectory extends Component{
}
const urlRoot = filePath && filePath.length > 0 ? `/${filePath[filePath.length - 1].path}` : "";
const { projectDetail } = this.props;
return(
<React.Fragment>
{
@ -271,7 +272,7 @@ class CoderRootDirectory extends Component{
{
filePath && filePath.length > 0 &&
<span className="ml20 font-16">
<a onClick={()=>this.getProjectRoot(branch)} className="color-blue">{projectsId}</a>
<a onClick={()=>this.getProjectRoot(branch)} className="color-blue">{ projectDetail && projectDetail.identifier }</a>
{
filePath.map((item,key)=>{
return(

View File

@ -113,7 +113,8 @@ class CoderRootFileDetail extends Component{
lineNumbers: true,
mode: 'javascript',
readOnly:readOnly?'nocursor':false,
autofocus:readOnly?false:true
autofocus:readOnly?false:true,
styleActiveLine:true
};
return(
<div>

View File

@ -453,7 +453,7 @@ class Detail extends Component{
<Route path="/projects/:projectsId/merge/:mergeId/MergeSubmit"
render={
(props) => (<MergeSubmit {...this.props} {...props} {...this.state}/>)
(props) => (<MessageCount {...this.props} {...props} {...this.state}/>)
}
></Route>
<Route path="/projects/:projectsId/version/new"

View File

@ -564,5 +564,6 @@ border: 1px solid #2185d0;
background-color: #f7f7f7;
border: 1px solid #e4e4e4;
border-radius: 4px;
height: auto;
}
.text-center{text-align: center;}

View File

@ -1,17 +1,11 @@
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{ Form , Table , Spin } from 'antd'
import { getImageUrl } from 'educoder';
const TextArea = Input.TextArea;
class MergeSubmit extends Component{
constructor(props){
@ -30,15 +24,22 @@ class MergeSubmit extends Component{
limit:50,
page:1,
titledata:undefined,
isSpin:true
}
}
componentDidMount=()=>{
this.getDetail();
// this.getDetail();
const { data } = this.props;
const { page , limit } = this.state;
this.setState({
isSpin:true
})
this.getCommitList( data.pull_request.base , page , limit );
}
getDetail=()=>{
const { projectsId , mergeId} = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
axios.get(url).then((result)=>{
@ -46,32 +47,13 @@ class MergeSubmit extends Component{
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 { projectsId } = this.props.match.params;
@ -105,8 +87,8 @@ class MergeSubmit extends Component{
render(){
const { projectsId,mergeId } = this.props.match.params;
const { data,titledata} = this.state;
// const { projectsId,mergeId } = this.props.match.params;
const { titledata } = this.state;
const columns=[{
@ -153,56 +135,58 @@ class MergeSubmit extends Component{
)
}
const url = this.props.history.location.pathname;
// 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>
{
data ?
<span className="font-20">{ data.issue.issue_classify==='issue'?data.issue.tracker:"合并"}</span>
:
""
}
<span className="font-20" > { data && data.issue.subject }</span>
// <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>
// {
// data ?
// <span className="font-20">【{ data.issue.issue_classify==='issue'?data.issue.tracker:"合并"}】</span>
// :
// ""
// }
// <span className="font-20" > { data && data.issue.subject }</span>
</p>
<p className="mt10 color-grey-c">
<span className={data&&data.issue.issue_status==="关闭"?"closedetail":data&&data.pull_request.status===0?"opendetail":"prdetail"}>{data&&data.issue.issue_status==="关闭"?"关闭中":data&&data.pull_request.status===0?"开启中":"已合并"} </span>
<span className="ml10 lineH32">
{ data && data.issue.author_name} { data && data.issue.created_at }创建{ data && data.issue.journals_count && data.issue.journals_count > 0 ?` · ${data.issue.journals_count} 条评论`:""}
</span>
<span className="pull-right lineH32">
<Link to={`/projects/${projectsId}/merge/${mergeId}/UpdateMerge`} className="color-blue fr">编辑</Link>
</span>
</p>
</div>
// </p>
// <p className="mt10 color-grey-c">
// <span className={data&&data.issue.issue_status==="关闭"?"closedetail":data&&data.pull_request.status===0?"opendetail":"prdetail"}>{data&&data.issue.issue_status==="关闭"?"关闭中":data&&data.pull_request.status===0?"开启中":"已合并"} </span>
// <span className="ml10 lineH32">
// 由 { data && data.issue.author_name} 于 { data && data.issue.created_at }创建{ data && data.issue.journals_count && data.issue.journals_count > 0 ?` · ${data.issue.journals_count} 条评论`:""}
// </span>
// <span className="pull-right lineH32">
// <Link to={`/projects/${projectsId}/merge/${mergeId}/UpdateMerge`} className="color-blue fr">编辑</Link>
// </span>
// </p>
// </div>
<div className="detailHeader-wrapper">
<div className="normal f-wrap-between">
<ul className="headerMenu-wrapper" style={{paddingTop:42,paddingLeft:15}}>
<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>
// <div className="detailHeader-wrapper">
// <div className="normal f-wrap-between">
// <ul className="headerMenu-wrapper" style={{paddingTop:42,paddingLeft:15}}>
// <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>
<Spin spinning={this.state.isSpin}>
<Table
className="mt20 wrap-commit-table"
columns={columns}
dataSource={titledata}
showHeader={false}
size="small"
pagination={false}
title={() => title()}
/>
</Spin>
// </div>
// </div>
)
}
}

View File

@ -9,8 +9,9 @@ import {Modal, Form, Input, Tooltip, Popconfirm, Pagination , Spin,Dropdown,Ico
import Attachments from '../Upload/attachment'
import './merge.css';
import QuillForEditor from '../quillForEditor';
import MergeSubmit from './MergeSubmit';
const TextArea = Input.TextArea;
// const TextArea = Input.TextArea;
const options = [
['bold', 'italic', 'underline'],
@ -46,11 +47,15 @@ class MessageCount extends Component{
title:'',
body:'',
commentsContent:undefined,
quillFlag:false
quillFlag:false,
SpinFlag:true
}
}
componentDidMount=()=>{
this.setState({
SpinFlag:true
})
this.getDetail();
}
@ -140,7 +145,8 @@ class MessageCount extends Component{
search_count:result.data.journals_count,
isSpin:false,
fileList:undefined,
showFiles: true
showFiles: true,
SpinFlag:false
})
}
}).catch(error=>{
@ -487,16 +493,13 @@ class MessageCount extends Component{
</div>
<div>
<div className="detailContent">
<p>
{
data ?
<span className="font-20">{ data.issue.issue_classify==='issue'?data.issue.tracker:"合并"}</span>
:
""
}
<span className="font-20" > { data && data.issue.subject }</span>
</p>
{
data &&
<p>
<span className="font-20">{ data.issue && (data.issue.issue_classify==='issue' ? data.issue.tracker : "合并")}</span>
<span className="font-20" > { data.issue && data.issue.subject }</span>
</p>
}
<p className="mt10 color-grey-c">
<span className={data&&data.issue.issue_status==="关闭"?"closedetail":data&&data.pull_request.status===0?"opendetail":"prdetail"}>{data&&data.issue.issue_status==="关闭"?"关闭中":data&&data.pull_request.status===0?"开启中":"已合并"} </span>
<span className="ml10 lineH32">
@ -522,134 +525,140 @@ class MessageCount extends Component{
<div className="normal f-wrap-between">
<ul className="headerMenu-wrapper" style={{paddingTop:42,paddingLeft:15}}>
<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>
<li className={url.indexOf("MergeSubmit")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/merge/${mergeId}/MergeSubmit`}>代码提交</Link></li>
</ul>
</div>
</div>
</div>
<div className="f-wrap-between mt5" style={{alignItems:"flex-start"}}>
<div className="item-list-right" >
<Spin spinning={isSpin}>
<ul className="ul_width">
{renderList()}
</ul>
</Spin>
{
url.indexOf("Messagecount")>0 ?
<Spin spinning={this.state.SpinFlag}>
<div className="f-wrap-between mt5" style={{alignItems:"flex-start"}}>
<div className="item-list-right" >
<Spin spinning={isSpin}>
<ul className="ul_width">
{renderList()}
</ul>
</Spin>
{ Paginations }
{ Paginations }
{
data && data.issue.user_permission ?
<div className="df" style={{display:this.state.data&&this.state.data.pull_request.status===1?'none':'flex'}}>
<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"}}>
{/* <button className="topmerge_btn" onClick={this.submitmerge} >{this.state.mergename}</button> */}
{/* <Dropdown style={{marginBottom:5}} overlay={menu} trigger={['click']} > */}
<Dropdown.Button overlay={menu} type="primary" onClick={this.submitmerge} icon={<Icon type="caret-down"/>}>
{this.state.mergename}
</Dropdown.Button>
{
data && data.issue.user_permission ?
<div className="df" style={{display:this.state.data&&this.state.data.pull_request.status===1?'none':'flex'}}>
<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"}}>
{/* <button className="topmerge_btn" onClick={this.submitmerge} >{this.state.mergename}</button> */}
{/* <Dropdown style={{marginBottom:5}} overlay={menu} trigger={['click']} > */}
<Dropdown.Button overlay={menu} type="primary" onClick={this.submitmerge} icon={<Icon type="caret-down"/>}>
{this.state.mergename}
</Dropdown.Button>
{/* </Dropdown> */}
</p>
{/* </Dropdown> */}
</p>
<div style={{display:this.state.ismesrge,marginTop:15}}>
<Input placeholder="标题" value={this.state.title} onChange={this.changtitlepr}/>
<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 style={{display:this.state.ismesrge,marginTop:15}}>
<Input placeholder="标题" value={this.state.title} onChange={this.changtitlepr}/>
<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>
<a className="a_btn cancel_btn " type="submit" style={{marginLeft:15}} onClick={this.nonemerge}>取消</a>
</p>
</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>
<a className="a_btn cancel_btn " type="submit" style={{marginLeft:15}} onClick={this.nonemerge}>取消</a>
: ''
}
<div className="order_line" style={{marginLeft:80}}></div>
<div className="df">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
<div className="new_context">
{/* <Form.Item>
{getFieldDecorator('content', {
rules: [{
required: true, message: '请输入内容'
}],
})(
<TextArea placeholder="添加评论..." style={{height: "200px"}}/>
)}
</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>
<a className="Closeor_btn fr" type="submit" style={{display:data&&data.pull_request.status===0?'block':'none'}}
onClick={() => this.closedetail(data && data.issue.issue_status === "关闭" ? 2 : 5)}>{data && data.issue.issue_status === "关闭" ? "开启" : "关闭"}</a>
</p>
</div>
</div>
: ''
}
<div className="order_line" style={{marginLeft:80}}></div>
<div className="df">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
<div className="new_context">
{/* <Form.Item>
{getFieldDecorator('content', {
rules: [{
required: true, message: '请输入内容'
}],
})(
<TextArea placeholder="添加评论..." style={{height: "200px"}}/>
)}
</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>
<a className="Closeor_btn fr" type="submit" style={{display:data&&data.pull_request.status===0?'block':'none'}}
onClick={() => this.closedetail(data && data.issue.issue_status === "关闭" ? 2 : 5)}>{data && data.issue.issue_status === "关闭" ? "开启" : "关闭"}</a>
</div>
<div className="list-left DetailRight mt10">
<p>
<span className="span_title">标签</span>
<span>{
data && data.issue.issue_tags ? <span className="issue-tag-show" style={{background: data.issue.issue_tags[0].color}}>{data.issue.issue_tags[0].name}</span> : "--"
}</span>
</p>
<p>
<span className="span_title">里程碑</span>
<span>{
data && data.issue.version ? data.issue.version : "--"
}</span>
</p>
<p>
<span className="span_title">指派给</span>
<span>{data && data.issue.assign_user_name ? data.issue.assign_user_name : "--"}</span>
</p>
</div>
</div>
</div>
<div className="list-left DetailRight mt10">
<p>
<span className="span_title">标签</span>
<span>{
data && data.issue.issue_tags ? <span className="issue-tag-show" style={{background: data.issue.issue_tags[0].color}}>{data.issue.issue_tags[0].name}</span> : "--"
}</span>
</p>
<p>
<span className="span_title">里程碑</span>
<span>{
data && data.issue.version ? data.issue.version : "--"
}</span>
</p>
<p>
<span className="span_title">指派给</span>
<span>{data && data.issue.assign_user_name ? data.issue.assign_user_name : "--"}</span>
</p>
</div>
</div>
</Spin>
:
<MergeSubmit {...this.props} {...this.state} data={data} />
}
</div>
<Modal
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
}
bodyStyle={{textAlign:'center'}}
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={[]}
bodyStyle={{textAlign:'center'}}
>
<img className="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
</Modal>

View File

@ -239,7 +239,7 @@ class NewMerge extends Component{
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 , desc } = this.state;
const { issue_tag_ids , fixed_version_id ,assigned_to_id , data,titledata , desc } = this.state;
const columns=[{
@ -345,12 +345,12 @@ class NewMerge extends Component{
<QuillForEditor
value = {desc}
wrapStyle={{
height: '220px',
height: '240px',
opacity:1,
}}
// autoFocus={true}
style={{ height: '170px' }}
placeholder="合并请求的描述..."
placeholder="请输入合并请求的描述..."
options={options}
onContentChange={this.onContentChange}
/>

View File

@ -6,15 +6,21 @@ 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{ Modal , Form , Input , Select } from 'antd'
import QuillForEditor from '../quillForEditor';
import Attachments from '../Upload/attachment'
const TextArea = Input.TextArea;
const Option = Select.Option;
const options = [
['bold', 'italic', 'underline'],
[{header: [1,2,3,false]}],
['blockquote', 'code-block'],
['link', 'image'],
['formula']
];
class UpdateMerge extends Component{
constructor(props){
super(props);
@ -38,7 +44,8 @@ class UpdateMerge extends Component{
done_ratio:0,
textcount:"",
fileList:undefined,
get_attachments: undefined
get_attachments: undefined,
desc:undefined
}
}
@ -101,17 +108,31 @@ class UpdateMerge extends Component{
});
};
onContentChange=(value)=>{
this.setState({
textcount:JSON.stringify(value)
})
}
changmodelname=(e)=>{
this.setState({
subject:e.target.value
})
}
changmodelcount=(e)=>{
this.setState({
textcount:e.target.value
})
this.setState({
subject:e.target.value
})
}
// changmodelcount=(e)=>{
// this.setState({
// textcount:e.target.value
// })
// }
stringJson=(value) =>{
let _value = null;
try {
_value = JSON.parse(value);
} catch (e) {
_value = value;
}
return _value
}
renderSelect=(list)=>{
if(list && list.length >0){
@ -135,7 +156,7 @@ class UpdateMerge extends Component{
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
const { projectsId , mergeId } = this.props.match.params;
const { subject ,data} = this.state;
const { subject ,data , textcount } = this.state;
const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
@ -149,9 +170,10 @@ class UpdateMerge extends Component{
values.assigned_to_id = ""
}
axios.put(url,{
project_id:projectsId,
id: data.issue.id,
attachment_ids:fileList,
project_id:projectsId,
id: data.issue.id,
attachment_ids:fileList,
body:textcount,
...values
}).then(result=>{
if(result){
@ -170,8 +192,7 @@ class UpdateMerge extends Component{
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;
const { issue_tag_ids , fixed_version_id , assigned_to_id , issue_chosen , subject, textcount,get_attachments } = this.state;
return(
<div className="main">
<div className="topWrapper">
@ -193,14 +214,26 @@ class UpdateMerge extends Component{
<Input placeholder="标题" onChange={this.changmodelname}/>
)}
</Form.Item>
<Form.Item>
{/* <Form.Item>
{getFieldDecorator('body', {
rules: [],
initialValue: textcount
})(
<TextArea placeholder="请输入工单的描述..." style={{height:"300px"}} onChange={this.changmodelcount}/>
)}
</Form.Item>
</Form.Item> */}
<QuillForEditor
value = {this.stringJson(textcount)}
wrapStyle={{
height: '240px',
opacity:1,
}}
// autoFocus={true}
style={{ height: '170px' }}
placeholder="请输入合并请求的描述..."
options={options}
onContentChange={this.onContentChange}
/>
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true} ></UploadComponent>
{
get_attachments ?