From bf7afa9087744872818ef06c93d2c6583a6bbaa8 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Mon, 30 Mar 2020 19:26:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA+issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/New/Index.js | 205 ++++++++++++++++++++++---------- src/forge/Order/Detail.js | 44 +++---- src/forge/Order/UpdateDetail.js | 6 +- 3 files changed, 167 insertions(+), 88 deletions(-) diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index 68ec6cad7..294616766 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -1,11 +1,12 @@ import React , { Component } from 'react'; import { Link } from 'react-router-dom'; -import { Input , Form , Select , Checkbox , Button , Divider ,Spin } from 'antd'; +import { Input , Form , Select , Checkbox , Button , Divider , Spin , AutoComplete } from 'antd'; import '../css/index.css'; import './new.css' import axios from 'axios' ; +import { callbackify } from 'util'; const Option = Select.Option class Index extends Component{ constructor(props){ @@ -23,6 +24,21 @@ class Index extends Component{ GitignoreList:undefined, LicensesList:undefined, isSpin:false, + + project_language_id:undefined, + project_category_id:undefined, + license_id:undefined, + ignore_id:undefined, + + project_language_list:undefined, + project_category_list:undefined, + license_list:undefined, + ignore_list:undefined, + + project_language_name:undefined, + project_category_name:undefined, + license_name:undefined, + ignore_name:undefined } } getUserInfo=()=>{ @@ -53,9 +69,9 @@ class Index extends Component{ const url = `/project_categories.json` axios.get(url).then((result)=>{ if(result){ - let CategoryList = this.setOptionsList(result.data.project_categories) + this.setOptionsList(result.data.project_categories,'project_category'); this.setState({ - CategoryList + CategoryList:result.data.project_categories }) } }).catch((error)=>{}) @@ -65,9 +81,9 @@ class Index extends Component{ const url = `/project_languages.json` axios.get(url).then((result)=>{ if(result){ - let LanguageList = this.setOptionsList(result.data.project_languages) + this.setOptionsList(result.data.project_languages,'project_language') this.setState({ - LanguageList + LanguageList:result.data.project_languages }) } }).catch((error)=>{}) @@ -77,9 +93,9 @@ class Index extends Component{ const url = `/ignores.json` axios.get(url).then((result)=>{ if(result){ - let GitignoreList = this.setOptionsList(result.data.ignores) + this.setOptionsList(result.data.ignores,'ignore'); this.setState({ - GitignoreList + GitignoreList:result.data.ignores }) } }).catch((error)=>{}) @@ -89,24 +105,30 @@ class Index extends Component{ const url = `/licenses.json` axios.get(url).then((result)=>{ if(result){ - let LicensesList = this.setOptionsList(result.data.licenses) + this.setOptionsList(result.data.licenses,'license'); this.setState({ - LicensesList + LicensesList:result.data.licenses }) } }).catch((error)=>{}) } - setOptionsList = (data) =>{ - let list = undefined; + // 设置option + setOptionsList = (data,_head,name) =>{ if(data && data.length > 0){ - list = data.map((item,key)=>{ - return( - - ) + let _data = data; + if(name){ + _data = data.filter(item=>item.name.indexOf(name)>-1); + } + let list = _data && _data.map((item) => ( + + )); + this.setState({ + [_head+"_list"]:list }) } - return list; } subMitFrom = () =>{ @@ -117,9 +139,14 @@ class Index extends Component{ if(!err){ const { current_user } = this.props; const { projectsType } =this.props.match.params; + const { project_language_id, project_category_id, license_id, ignore_id } = this.state; const url = projectsType === "deposit" ? "/projects.json" :"/projects/migrate.json"; axios.post(url,{ ...values, + project_language_id, + project_category_id, + license_id, + ignore_id, user_id:current_user.user_id }).then((result)=>{ if(result){ @@ -145,6 +172,39 @@ class Index extends Component{ }) } + ChangePlatform=(value,e,name,list)=>{ + this.setOptionsList(list,name,value) + this.setState({ + [name+"_id"]:e.key, + [name+"_name"]:value, + }) + } + + blurCategory=(value,list,name)=>{ + // console.log(value); + let filter = list && list.filter(item=>item.name === value); + if(!filter || filter.length===0){ + this.props.form.setFieldsValue({ + [name]:undefined + }) + this.setState({ + [name+"_name"]:undefined, + [name+"_id"]:undefined + }) + this.setOptionsList(list,name); + } + } + + checkId=(rule, value, callback,list,title)=>{ + let filter = list.filter(item=>item.name === value); + if(filter && filter.length>0){ + callback(); + }else{ + callback('请在下拉选项中选择正确的'+title+"!"); + } + callback(); + } + render(){ const { getFieldDecorator } = this.props.form; // 项目类型:deposit-托管项目,mirror-镜像项目 @@ -161,10 +221,18 @@ class Index extends Component{ LanguageList, GitignoreList, LicensesList, - isSpin - }=this.state; + isSpin, + project_language_name, + project_category_name, + license_name, + ignore_name, - console.log("current_user",this.props); + project_language_list, + project_category_list, + license_list, + ignore_list, + }=this.state; + console.log("a:",project_category_list); return(
@@ -172,21 +240,8 @@ class Index extends Component{
- {/* - {getFieldDecorator('user_id', { - rules: [{ - required: true, message: '请选择拥有者' - }], - })( - - )} - */} { - projectsType != "deposit" && + projectsType !== "deposit" &&

好的存储库名称使用简单、深刻和独特的关键字

- {/*
*/} - {getFieldDecorator('project_category_id', { + {getFieldDecorator('project_category', { rules: [{ - required: true, message: '请选择大类别' + required: true, message: '请选择大类别', + },{ + validator:(rule, value, callback)=>this.checkId(rule, value, callback,CategoryList,'项目类别') }], })( - + this.ChangePlatform(value,e,'project_category',CategoryList)} + className="plateAutoComplete" + onBlur={(value)=>this.blurCategory(value,CategoryList,"project_category")} + > + {/* {this.setOptionsList(CategoryList,project_category_name)} */} + {project_category_list} + )} - {/* - {getFieldDecorator('project_language_id', { - rules: [{ - required: true, message: '请选择子类别' - }], - })( - - )} - */} - {/*
*/} - {getFieldDecorator('project_language_id', { + {getFieldDecorator('project_language', { rules: [{ required: true, message: '请选择项目语言' + },{ + validator:(rule, value, callback)=>this.checkId(rule, value, callback,LanguageList,'项目语言') }], })( - + this.ChangePlatform(value,e,'project_language',LanguageList)} + className="plateAutoComplete" + onBlur={(value)=>this.blurCategory(value,LanguageList,"project_language")} + > + {/* {this.setOptionsList(LanguageList,project_language_name)} */} + {project_language_list} + )}
@@ -288,19 +345,39 @@ class Index extends Component{ - {getFieldDecorator('ignore_id')( - + {getFieldDecorator('ignore',{ + rules: [{ + validator:(rule, value, callback)=>this.checkId(rule, value, callback,GitignoreList,'gitignore') + }], + })( + this.ChangePlatform(value,e,'ignore',GitignoreList)} + className="plateAutoComplete" + onBlur={(value)=>this.blurCategory(value,GitignoreList,"ignore")} + > + {/* {this.setOptionsList(GitignoreList,ignore_name)} */} + {ignore_list} + )} - {getFieldDecorator('license_id')( - + {getFieldDecorator('license',{ + rules: [{ + validator:(rule, value, callback)=>this.checkId(rule, value, callback,LicensesList,'开源许可证') + }], + })( + this.ChangePlatform(value,e,'license',LicensesList)} + className="plateAutoComplete" + onBlur={(value)=>this.blurCategory(value,LicensesList,"license")} + > + {/* {this.setOptionsList(LicensesList,license_name)} */} + {license_list} + )} diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js index 2d42fe851..a14a4788e 100644 --- a/src/forge/Order/Detail.js +++ b/src/forge/Order/Detail.js @@ -101,7 +101,8 @@ class Detail extends Component{ issue_id:data.id, attachment_ids:fileList }).then(result=>{ - if(result && result.journals_count > 0){ + if(result){ + this.props.showNotification("评论成功!"); this.props.form.setFieldsValue({ content: "" }); @@ -111,7 +112,6 @@ class Detail extends Component{ quillFlag:false }) this.getjournalslist(page, limit); - this.props.showNotification("评论成功!"); } }).catch(error=>{ console.log(error); @@ -178,13 +178,13 @@ class Detail extends Component{ //修改评论 updatedetail=(id)=>{ - const {page, limit } = this.state; + const { page , limit , countvalue } = this.state; const {orderId} = this.props.match.params; const url = `/issues/${orderId}/journals/${id}.json`; axios.put(url,{ issue_id:orderId, id:id, - content:this.state.countvalue + content:JSON.stringify(countvalue) }).then(result=>{ if(result){ this.setState({ @@ -221,20 +221,15 @@ class Detail extends Component{ }) } - changmodelname=(e)=>{ - this.setState({ - countvalue:e.target.value - }) - } + editdetail=(count,status)=>{ this.setState({ - countvalue:count, + countvalue:this.stringJson(count), isedit:status }) } renderJournalList=(list)=>{ - // console.log(list); if(list && list.length >0){ return( list.map((item,key)=>{ @@ -299,6 +294,7 @@ class Detail extends Component{ showFiles:flag }) } + // 新建评论 onContentChange=(value)=>{ if(value){ this.setState({ @@ -307,6 +303,14 @@ class Detail extends Component{ }) } } + // 编辑评论 + onEditContentChange=(value)=>{ + if(value){ + this.setState({ + countvalue:value + }) + } + } handleShowImage=(value)=>{ // console.log("imgOnclick",value); @@ -336,14 +340,14 @@ class Detail extends Component{ ) }; render(){ const { projectsId , orderId } = this.props.match.params; - const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles , quillValue , quillFlag } = this.state; + const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles , quillValue , quillFlag , countvalue } = this.state; const { current_user } = this.props; const Paginations = ( @@ -398,20 +402,19 @@ class Detail extends Component{ }
-
+

{ quillFlag && 请输入评论内容} @@ -538,8 +541,7 @@ class Detail extends Component{ options={options} value={quillValue} onContentChange={this.onContentChange} - showUploadImage={this.handleShowImage} - // onContentChange={handleContentChange} + // showUploadImage={this.handleShowImage} />

{ quillFlag && 请输入评论内容} diff --git a/src/forge/Order/UpdateDetail.js b/src/forge/Order/UpdateDetail.js index e2e17d532..438a44ecc 100644 --- a/src/forge/Order/UpdateDetail.js +++ b/src/forge/Order/UpdateDetail.js @@ -109,7 +109,7 @@ class UpdateDetail extends Component{ onContentChange=(value)=>{ this.setState({ - textcount:value + textcount:JSON.stringify(value) }) } @@ -174,12 +174,12 @@ class UpdateDetail extends Component{ project_id:projectsId, subject:subject, id: orderId, - description:JSON.stringify(textcount), + description:textcount, attachment_ids:fileList, ...values }).then(result=>{ if(result){ - this.props.history.push(`/projects/${projectsId}/orders`); + this.props.history.push(`/projects/${projectsId}/orders/${orderId}/detail`); } }).catch(error=>{ console.log(error); From bdf61d7bbbb3d0877043a8db1877afac9c3df0c2 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Tue, 31 Mar 2020 15:07:27 +0800 Subject: [PATCH 2/2] issue --- src/forge/Main/CoderRootDirectory.js | 3 +- src/forge/Main/CoderRootFileDetail.js | 3 +- src/forge/Main/Detail.js | 2 +- src/forge/Main/list.css | 1 + src/forge/Merge/MergeSubmit.js | 138 +++++++------- src/forge/Merge/MessageCount.js | 253 +++++++++++++------------- src/forge/Merge/NewMerge.js | 6 +- src/forge/Merge/UpdateMerge.js | 77 +++++--- 8 files changed, 256 insertions(+), 227 deletions(-) diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 6f1b397a5..21186ff9e 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -256,6 +256,7 @@ class CoderRootDirectory extends Component{ } const urlRoot = filePath && filePath.length > 0 ? `/${filePath[filePath.length - 1].path}` : ""; + const { projectDetail } = this.props; return( { @@ -271,7 +272,7 @@ class CoderRootDirectory extends Component{ { filePath && filePath.length > 0 && - this.getProjectRoot(branch)} className="color-blue">{projectsId} + this.getProjectRoot(branch)} className="color-blue">{ projectDetail && projectDetail.identifier } { filePath.map((item,key)=>{ return( diff --git a/src/forge/Main/CoderRootFileDetail.js b/src/forge/Main/CoderRootFileDetail.js index d15dbbf5c..46b6da40c 100644 --- a/src/forge/Main/CoderRootFileDetail.js +++ b/src/forge/Main/CoderRootFileDetail.js @@ -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(

diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 17536164d..34553cafa 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -453,7 +453,7 @@ class Detail extends Component{ () + (props) => () } > { - - 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( -
-
-
-
-
-

- { - data ? - 【{ data.issue.issue_classify==='issue'?data.issue.tracker:"合并"}】 - : - "" - } - { data && data.issue.subject } + //

+ //
+ //
+ //
+ //
+ //

+ // { + // data ? + // 【{ data.issue.issue_classify==='issue'?data.issue.tracker:"合并"}】 + // : + // "" + // } + // { data && data.issue.subject } -

-

- {data&&data.issue.issue_status==="关闭"?"关闭中":data&&data.pull_request.status===0?"开启中":"已合并"} - - 由 { data && data.issue.author_name} 于 { data && data.issue.created_at }创建{ data && data.issue.journals_count && data.issue.journals_count > 0 ?` · ${data.issue.journals_count} 条评论`:""} - - - 编辑 - -

-
+ //

+ //

+ // {data&&data.issue.issue_status==="关闭"?"关闭中":data&&data.pull_request.status===0?"开启中":"已合并"} + // + // 由 { data && data.issue.author_name} 于 { data && data.issue.created_at }创建{ data && data.issue.journals_count && data.issue.journals_count > 0 ?` · ${data.issue.journals_count} 条评论`:""} + // + // + // 编辑 + // + //

+ //
-
-
-
    -
  • 0? "active" : ""}>对话内容
  • -
  • 0 ? "active" : ""}>代码提交
  • -
-
-
- title()} - /> - - + //
+ //
+ //
    + //
  • 0? "active" : ""}>对话内容
  • + //
  • 0 ? "active" : ""}>代码提交
  • + //
+ //
+ //
+ +
title()} + /> + + // + // ) } } diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index ebe66b38a..9537a8dd0 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -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{
-

- { - data ? - 【{ data.issue.issue_classify==='issue'?data.issue.tracker:"合并"}】 - : - "" - } - { data && data.issue.subject } - -

+ { + data && +

+ 【{ data.issue && (data.issue.issue_classify==='issue' ? data.issue.tracker : "合并")}】 + { data.issue && data.issue.subject } +

+ }

{data&&data.issue.issue_status==="关闭"?"关闭中":data&&data.pull_request.status===0?"开启中":"已合并"} @@ -522,134 +525,140 @@ class MessageCount extends Component{

  • 0? "active" : ""}>对话内容
  • -
  • 0 ? "active" : ""}>代码提交
  • +
  • 0 ? "active" : ""}>代码提交
-
-
- -
    - {renderList()} -
-
+ { + url.indexOf("Messagecount")>0 ? + +
+
+ +
    + {renderList()} +
+
- { Paginations } + { Paginations } - { - data && data.issue.user_permission ? -
- -
-

该合并请求可以进行自动合并操作

-

- {/* */} - {/* */} - }> - {this.state.mergename} - + { + data && data.issue.user_permission ? +

+ +
+

该合并请求可以进行自动合并操作

+

+ {/* */} + {/* */} + }> + {this.state.mergename} + - {/* */} -

+ {/* */} +

-
- -
- +
+ +
+ +
+ {/*