-
- {
- data && data.issue.user_permission ?
-
-
-
-

-
-
+
+
{
- data && data.issue.issue_status !== "关闭" &&
-
-
该合并请求可以进行自动合并操作
-
-
- }>
- {this.state.mergename}
-
-
-
+ item.content ?
+ this.commentCtx(item.content)
+ :
+
+ {this.renderJournalList(item.journal_details)}
+
}
-
-
-
-
-
-
- this.prmerge()}>合并请求
- 取消
-
+ {
+ item && item.attachments.length > 0 ?
+
+ :
+ ""
+ }
+
+
+
+
-
-
+
+
+
+ )
+ })
+ }
+
+ )
+ }
+ }
+
+ return (
+
+ {visible &&
}
+
+
+ {
+ 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 ? "开启中" : "已合并"}
+
+ 由 {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.pull_request.head} 分支合并到 {data && data.pull_request.base} 分支
+
+
+ {
+ data && data.issue.user_permission ?
+ 编辑
: ''
}
-
-
-
-
-
- { Paginations }
-
-
-
-

-
-
-
-
-
- { quillFlag && 请输入评论内容}
-
-
-
-
-
- 评论
-
-
-
+
+
+ {
+ data && data.attachments.length > 0 ?
+
+ :
+ ""
+ }
+
+
+
+
+ - 0 ? "active" : ""}>对话内容
+ - 0 ? "active" : ""}>代码提交
+
+ {data && data.issue.user_permission &&
+
+ }
- {
- editMerge ?
-
- { editMergeForm() }
-
-
- :
-
-
- 标签
- {
- data && data.issue.issue_tags ? {data.issue.issue_tags[0].name} : "--"
- }
-
-
- 里程碑
- {
- data && data.issue.version ? data.issue.version : "--"
- }
-
-
- 指派给
- {data && data.issue.assign_user_name ? data.issue.assign_user_name : "--"}
-
-
-
- }
-
-
- :
-
- }
-
+
+
+ {
+ (url.indexOf("Messagecount") > 0 || url.indexOf("updatemerge") > 0) ?
+
+
+
+ {
+ data && data.issue.user_permission ?
+
+
+
+

+
+
+ {
+ data && data.issue.issue_status !== "关闭" &&
+
+
该合并请求可以进行自动合并操作
+
+
+ }>
+ {this.state.mergename}
+
+
+
+ }
+
+
+
+
+
+
+ this.prmerge()}>合并请求
+ 取消
+
+
+
+
+
+
+ : ''
+ }
+
+
+
+
+
+ {Paginations}
+
+
+
+

+
+
+
+
+
+ {quillFlag && 请输入评论内容}
+
+
+
+
+
+ 评论
+
+
+
+
+
+ {
+ editMerge ?
+
+ {editMergeForm()}
+
+
+ :
+
+
+ 标签
+ {
+ data && data.issue.issue_tags ? {data.issue.issue_tags[0].name} : "--"
+ }
+
+
+ 里程碑
+ {
+ data && data.issue.version ? data.issue.version : "--"
+ }
+
+
+ 指派给
+ {data && data.issue.assign_user_name ? data.issue.assign_user_name : "--"}
+
+
+
+ }
+
+
+
+ :
+
+ }
+
+
+
+
+
-
-
-
-
)
}
}
diff --git a/src/forge/Merge/UpdateMerge.js b/src/forge/Merge/UpdateMerge.js
index 773912522..ae7dd2410 100644
--- a/src/forge/Merge/UpdateMerge.js
+++ b/src/forge/Merge/UpdateMerge.js
@@ -1,294 +1,272 @@
-import React , {Component} from 'react';
-import {Link} from 'react-router-dom';
-
+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 , Form , Input , Select, Spin } from 'antd'
+import { Modal, Form, Input, Select, Spin } from 'antd'
import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
-
-
import Attachments from '../Upload/attachment'
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){
+class UpdateMerge extends Component {
+ constructor(props) {
super(props);
- this.state={
- data:undefined,
- isShow:false,
- imgsrc:'',
- journalsdata:undefined,
+ 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,
+ 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,
- desc:undefined,
+ desc: undefined,
isSpin: false
}
}
-
- componentDidMount=()=>{
- this.InitData();
+
+ componentDidMount = () => {
this.getDetail();
- //this.getSelectList();
}
- InitData=()=>{
- // this.props.form.setFieldsValue({
- // ...this.state
- // });
- }
-
- getDetail=()=>{
- const { projectsId , mergeId} = this.props.match.params;
+ getDetail = () => {
+ const { projectsId, mergeId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeId}/edit.json`;
- axios.get(url).then((result)=>{
- if(result){
+ 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,
+ 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,
+ 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();
+ // this.getjournalslist();
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
- handleok=() => {
- this.setState({
- isShow:false
- });
- };
- handleCancel=()=>{
- this.setState({
- isShow:false
- });
- }
+ handleok = () => {
+ this.setState({
+ isShow: false
+ });
+ };
+ handleCancel = () => {
+ this.setState({
+ isShow: false
+ });
+ }
- imgshow=()=>{
- this.setState({
- isShow:true
- });
- };
+ imgshow = () => {
+ this.setState({
+ isShow: true
+ });
+ };
- onContentChange=(value)=>{
- this.setState({
- textcount:value
- })
- }
- changmodelname=(e)=>{
- this.setState({
- subject:e.target.value
- })
- }
- stringJson=(value) =>{
- let _value = null;
-
- try {
- _value = JSON.parse(value);
- } catch (e) {
- _value = value;
- }
- return _value
- }
+ onContentChange = (value) => {
+ this.setState({
+ textcount: value
+ })
+ }
+ changmodelname = (e) => {
+ this.setState({
+ subject: e.target.value
+ })
+ }
+ stringJson = (value) => {
+ let _value = null;
- renderSelect=(list)=>{
- if(list && list.length >0){
- return(
- list.map((item,key)=>{
- return(
-
- )
- })
+ try {
+ _value = JSON.parse(value);
+ } catch (e) {
+ _value = value;
+ }
+ return _value
+ }
+
+ renderSelect = (list) => {
+ if (list && list.length > 0) {
+ return (
+ list.map((item, key) => {
+ return (
+
)
+ })
+ )
+ }
+ }
+ // 获取上传后的文件id数组
+ UploadFunc = (fileList) => {
+ this.setState({
+ fileList
+ })
+ }
+ handleSubmit = () => {
+ const { fileList } = this.state;
+ this.props.form.validateFieldsAndScroll((err, values) => {
+ if (!err) {
+ const { projectsId, mergeId } = this.props.match.params;
+ const { data, textcount } = this.state;
+ const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
+
+
+ if (values.issue_tag_ids === '') {
+ values.issue_tag_ids = []
}
- }
- // 获取上传后的文件id数组
- UploadFunc=(fileList)=>{
- this.setState({
- fileList
- })
- }
- handleSubmit=()=>{
- const { fileList } = this.state;
- this.props.form.validateFieldsAndScroll((err, values) => {
- if(!err){
- const { projectsId , mergeId } = this.props.match.params;
- const { data , textcount } = this.state;
- const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
-
-
- if(values.issue_tag_ids===''){
- values.issue_tag_ids = []
- }else{
-
- }
-
- if(values.assigned_to_id===0){
- values.assigned_to_id = ""
- }
- axios.put(url,{
- project_id:projectsId,
- id: data.issue.id,
- attachment_ids:fileList,
- body:textcount,
- ...values
- }).then(result=>{
- if(result){
- this.props.history.push(`/projects/${projectsId}/merge`);
- this.setState({
- textcount:''
- })
- }
- }).catch(error=>{
- console.log(error);
+
+ if (values.assigned_to_id === 0) {
+ values.assigned_to_id = ""
+ }
+ axios.put(url, {
+ project_id: projectsId,
+ id: data.issue.id,
+ attachment_ids: fileList,
+ body: textcount,
+ ...values
+ }).then(result => {
+ if (result) {
+ this.props.history.push(`/projects/${projectsId}/merge`);
+ this.setState({
+ textcount: ''
})
-
}
+ }).catch(error => {
+ console.log(error);
})
+
}
+ })
+ }
- render(){
- const { projectsId , mergeId } = this.props.match.params;
+ 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 , assigned_to_id , issue_chosen , subject, textcount,get_attachments, isSpin } = this.state;
- return(
+ const { issue_tag_ids, fixed_version_id, assigned_to_id, issue_chosen, subject, textcount, get_attachments, isSpin } = this.state;
+ return (
)
}
}
diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js
index da0b804d1..5240d0af8 100644
--- a/src/forge/New/Index.js
+++ b/src/forge/New/Index.js
@@ -1,60 +1,57 @@
-import React , { Component } from 'react';
+import React, { Component } from 'react';
import { Link } from 'react-router-dom';
-import { Input , Form , Select , Checkbox , Button , Divider , Spin , AutoComplete } 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';
+import axios from 'axios';
const Option = Select.Option
-class Index extends Component{
- constructor(props){
+class Index extends Component {
+ constructor(props) {
super(props);
- this.state={
- // authorValue:"0",
- preType:"0",
- // subType:"0",
- languageValue:"0",
- gitignoreType:"0",
- LicensesType:"0",
+ this.state = {
+ preType: "0",
+ languageValue: "0",
+ gitignoreType: "0",
+ LicensesType: "0",
- CategoryList:undefined,
- LanguageList:undefined,
- GitignoreList:undefined,
- LicensesList:undefined,
- isSpin:false,
+ CategoryList: undefined,
+ LanguageList: undefined,
+ GitignoreList: undefined,
+ LicensesList: undefined,
+ isSpin: false,
- project_language_id:undefined,
- project_category_id:undefined,
- license_id:undefined,
- ignore_id:undefined,
+ 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_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
+ project_language_name: undefined,
+ project_category_name: undefined,
+ license_name: undefined,
+ ignore_name: undefined
}
}
- getUserInfo=()=>{
+ getUserInfo = () => {
const url = `/users/me.json`;
- axios.get(url).then(result=>{
- if(result && result.data.login){
+ axios.get(url).then(result => {
+ if (result && result.data.login) {
this.setState({
- current_user:result.data
+ current_user: result.data
})
this.getDetail();
}
- }).catch(error=>{
+ }).catch(error => {
console.log(error)
})
}
- componentDidMount=()=>{
+ componentDidMount = () => {
// this.getUserInfo();
// 获取项目类别
this.getCategory();
@@ -65,60 +62,60 @@ class Index extends Component{
// 获取开源许可证
this.getLicenses();
}
- getCategory=()=>{
- const url = `/project_categories.json`
- axios.get(url).then((result)=>{
- if(result){
- this.setOptionsList(result.data.project_categories,'project_category');
+ getCategory = () => {
+ const url = `/project_categories.json`
+ axios.get(url).then((result) => {
+ if (result) {
+ this.setOptionsList(result.data.project_categories, 'project_category');
this.setState({
- CategoryList:result.data.project_categories
+ CategoryList: result.data.project_categories
})
}
- }).catch((error)=>{})
+ }).catch((error) => { })
}
- getLanguage=()=>{
- const url = `/project_languages.json`
- axios.get(url).then((result)=>{
- if(result){
- this.setOptionsList(result.data.project_languages,'project_language')
+ getLanguage = () => {
+ const url = `/project_languages.json`
+ axios.get(url).then((result) => {
+ if (result) {
+ this.setOptionsList(result.data.project_languages, 'project_language')
this.setState({
- LanguageList:result.data.project_languages
+ LanguageList: result.data.project_languages
})
}
- }).catch((error)=>{})
+ }).catch((error) => { })
}
- getGitignore=()=>{
- const url = `/ignores.json`
- axios.get(url).then((result)=>{
- if(result){
- this.setOptionsList(result.data.ignores,'ignore');
+ getGitignore = () => {
+ const url = `/ignores.json`
+ axios.get(url).then((result) => {
+ if (result) {
+ this.setOptionsList(result.data.ignores, 'ignore');
this.setState({
- GitignoreList:result.data.ignores
+ GitignoreList: result.data.ignores
})
}
- }).catch((error)=>{})
+ }).catch((error) => { })
}
- getLicenses=()=>{
- const url = `/licenses.json`
- axios.get(url).then((result)=>{
- if(result){
- this.setOptionsList(result.data.licenses,'license');
+ getLicenses = () => {
+ const url = `/licenses.json`
+ axios.get(url).then((result) => {
+ if (result) {
+ this.setOptionsList(result.data.licenses, 'license');
this.setState({
- LicensesList:result.data.licenses
+ LicensesList: result.data.licenses
})
}
- }).catch((error)=>{})
+ }).catch((error) => { })
}
// 设置option
- setOptionsList = (data,_head,name) =>{
- if(data && data.length > 0){
+ setOptionsList = (data, _head, name) => {
+ if (data && data.length > 0) {
let _data = data;
- if(name){
- _data = data.filter(item=>item.name.toLowerCase().indexOf(name.toLowerCase())>-1);
+ if (name) {
+ _data = data.filter(item => item.name.toLowerCase().indexOf(name.toLowerCase()) > -1);
}
let list = _data && _data.map((item) => (
));
this.setState({
- [_head+"_list"]:list
+ [_head + "_list"]: list
})
}
}
- subMitFrom = () =>{
+ subMitFrom = () => {
this.setState({
- isSpin:true
+ isSpin: true
})
this.props.form.validateFieldsAndScroll((err, values) => {
- if(!err){
+ if (!err) {
const { current_user } = this.props;
- const { projectsType } =this.props.match.params;
+ 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,{
+ 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){
- if(result.data.id){
+ user_id: current_user.user_id
+ }).then((result) => {
+ if (result) {
+ if (result.data.id) {
this.setState({
- isSpin:false
+ isSpin: false
})
- this.props.showNotification(`${projectsType === "deposit" ? "托管" :"镜像"}项目创建成功!`);
+ this.props.showNotification(`${projectsType === "deposit" ? "托管" : "镜像"}项目创建成功!`);
this.props.history.push(`/projects/${result.data.id}/coders`);
}
}
- }).catch((error)=>{
+ }).catch((error) => {
this.setState({
- isSpin:false
+ isSpin: false
})
console.log(error);
})
- }else{
+ } else {
this.setState({
- isSpin:false
+ isSpin: false
})
}
})
}
- ChangePlatform=(value,e,name,list)=>{
- this.setOptionsList(list,name,value)
+ ChangePlatform = (value, e, name, list) => {
+ this.setOptionsList(list, name, value)
this.setState({
- [name+"_id"]:e.key,
- [name+"_name"]:value,
+ [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){
+ blurCategory = (value, list, name) => {
+ let filter = list && list.filter(item => item.name === value);
+ if (!filter || filter.length === 0) {
this.props.form.setFieldsValue({
- [name]:undefined
+ [name]: undefined
})
this.setState({
- [name+"_name"]:undefined,
- [name+"_id"]:undefined
+ [name + "_name"]: undefined,
+ [name + "_id"]: undefined
})
- this.setOptionsList(list,name);
+ this.setOptionsList(list, name);
}
}
- checkId=(rule, value, callback,list,title)=>{
- let filter = list.filter(item=>item.name === value);
- if(filter && filter.length>0){
+ checkId = (rule, value, callback, list, title) => {
+ let filter = list.filter(item => item.name === value);
+ if (filter && filter.length > 0) {
callback();
- }else{
- callback('请在下拉选项中选择正确的'+title+"!");
+ } else {
+ callback('请在下拉选项中选择正确的' + title + "!");
}
callback();
}
- render(){
+ render() {
const { getFieldDecorator } = this.props.form;
// 项目类型:deposit-托管项目,mirror-镜像项目
- const { projectsType } =this.props.match.params;
+ const { projectsType } = this.props.match.params;
const {
- // authorValue,
preType,
- // subType,
languageValue,
gitignoreType,
LicensesType,
@@ -231,168 +225,165 @@ class Index extends Component{
project_category_list,
license_list,
ignore_list,
- }=this.state;
- console.log("a:",project_category_list);
- return(
+ } = this.state;
+ return (
-
创建{projectsType === "deposit" ? "托管":"镜像"}项目
+
创建{projectsType === "deposit" ? "托管" : "镜像"}项目