diff --git a/.idea/workspace.xml b/.idea/workspace.xml index aba950566..e81ee7eb6 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -10,116 +10,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -131,36 +26,36 @@ - Educoder - title - textcount - forks - commentCtx - 上传文件 - subFileType - .ide - .idea - deleteUser - axios.delete - style= - width75f - max-width - 请输入合并 - journal-list-item - issue-tag-show - 创建 - .map((item,key)=>{ .map((item,key) 评论成 - 该合并请求可以进行自动合并操作 没有 创建工单 可读权限 sub_entries - 可读 - icon-bianji - readOnly isRe + icon-bianji + 可读 + journals_count > + readOnly + Fork + forked + .OptionsUl + tyle= + overflo + <span className="span_title">里程碑</span> + <span className="span_title">里程碑 + 分支合并到 + Input + 新建标签 + orderid + deletedetail + onMouseMove + commitKey + TextArea + body + 该合并请求可以进行自动合并操作 + title + changbodypr $PROJECT_DIR$ @@ -176,10 +71,8 @@ + - @@ -239,19 +139,13 @@ - - - - - - - - + diff --git a/src/forge/Branch/branch.css b/src/forge/Branch/branch.css index a8c1deeec..5f9ae58f6 100644 --- a/src/forge/Branch/branch.css +++ b/src/forge/Branch/branch.css @@ -17,20 +17,22 @@ box-shadow: 0px 0px 1px 1px rgba(134, 134, 134, 0.1); border-radius: 3px; background: #fff; - max-height: 200px; + max-height: 300px; } .OptionsUl{ max-height: 200px; overflow-y: auto; + margin-top: 10px; } .OptionsUl li{ - height: 22px; - line-height: 22px; - cursor: pointer;; + height: 30px; + /*line-height: 22px;*/ + cursor: pointer; } .OptionsUl li a{ display: block; - padding-left: 2px; + padding: 4px; + /*padding-left: 2px;*/ } .OptionsInput{ height: 32px; diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 21186ff9e..a431ecdf7 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -48,6 +48,7 @@ class CoderRootDirectory extends Component{ } componentDidMount=()=>{ + let { search } = this.props.history.location; let branchName = undefined; if(search && search.indexOf("branch")>-1){ @@ -63,7 +64,6 @@ class CoderRootDirectory extends Component{ // 获取根目录 getProjectRoot=(branch)=>{ const { projectsId } = this.props.match.params; - console.log(this.props); const url = `/repositories/${projectsId}/entries.json`; axios.get((url),{ params:{ @@ -89,6 +89,7 @@ class CoderRootDirectory extends Component{ ChangeFile=(arr,index)=>{ this.renderUrl(arr.name,arr.path,arr.type); + //点击直接跳转页面 加载一次路由 this.getFileDetail(arr); this.setState({ subFileType:arr.type @@ -125,8 +126,6 @@ class CoderRootDirectory extends Component{ getFileDetail=(arr)=>{ const { projectsId } = this.props.match.params; const { branch } = this.state; - - const url =`/repositories/${projectsId}/sub_entries.json`; axios.get(url,{ @@ -142,6 +141,10 @@ class CoderRootDirectory extends Component{ rootList:undefined }) }else{ + if(arr.type===""){ + this.props.showNotification('该文件夹下已无文件') + return + } this.setState({ fileDetail:undefined }) diff --git a/src/forge/Main/CoderRootDirectorytext.js b/src/forge/Main/CoderRootDirectorytext.js new file mode 100644 index 000000000..0eb58b8f9 --- /dev/null +++ b/src/forge/Main/CoderRootDirectorytext.js @@ -0,0 +1,333 @@ +import React , { Component } from 'react'; +import {Menu, Spin} from 'antd'; +import { getImageUrl , markdownToHTML } from 'educoder'; +import { Router , Route , Link } from 'react-router-dom'; +import Top from './DetailTop'; + +import './list.css'; + +import SelectBranch from '../Branch/SelectBranch'; +import CloneAddress from '../Branch/CloneAddress'; +import RootTable from './RootTable'; +import CoderRootFileDetail from './CoderRootFileDetail'; +import NullData from './NullData'; + +import axios from 'axios'; +/** + * address:http和SSH,http_url(对应git地址) + * branch:当前分支 + * filePath:点击目录时当前目录的路径 + * subfileType:保存当前点击目录的文件类型(显示目录列表时才显示新建文件,如果点击的是文件就不显示新建文件按钮) + * readMeContent:根目录下面的readme文件内容 + */ +class CoderRootDirectorytext extends Component{ + constructor(props){ + super(props); + this.state={ + address:"http", + branch:"master", + filePath:[], + http_url:undefined, + subFileType:"", + readMeContent:undefined, + + isSpin:true, + + branchList:undefined, + fileDetail:undefined, + branchLastCommit:undefined, + + rootData:undefined + } + } + changeAddress=(address)=>{ + this.setState({ + address + }) + } + + componentDidMount=()=>{ + + let { search } = this.props.history.location; + let branchName = undefined; + if(search && search.indexOf("branch")>-1){ + branchName = search.split("=")[1]; + this.setState({ + branch:branchName + }) + } + const { branch } = this.state; + this.getProjectRoot(branchName || branch); + } + + // 获取根目录 + getProjectRoot=(branch)=>{ + const { projectsId } = this.props.match.params; + const url = `/repositories/${projectsId}/entries.json`; + axios.get((url),{ + params:{ + branch + } + }).then((result)=>{ + if(result){ + if(result && result.data && result.data.length > 0){ + this.setState({ + filePath:[], + fileDetail:undefined, + isSpin: false + }) + this.renderData(result.data); + } + this.setState({ + rootData:result.data + }) + } + + }).catch((error)=>{}) + } + + ChangeFile=(arr,index)=>{ + this.renderUrl(arr.name,arr.path,arr.type); + //点击直接跳转页面 加载一次路由 + this.getFileDetail(arr); + this.setState({ + subFileType:arr.type + }) + } + + renderUrl=(name,path,type)=>{ + let list =[]; + const { filePath } = this.state; + if(path.indexOf("/")){ + const array = path.split("/"); + let str = ""; + array.map((i,k)=>{ + str += '/'+i; + return list.push({ + index:k, + name:i, + path:str.substr(1), + type:(filePath && filePath.length>0) ? (filePath[k] ? filePath[k].type : type) : type + }) + }) + }else{ + list.push({ + index:0, + name,path,type + }) + } + this.setState({ + filePath:list + }) + } + + // 获取子目录 + getFileDetail=(arr)=>{ + const { projectsId } = this.props.match.params; + const { branch } = this.state; + const url =`/repositories/${projectsId}/sub_entries.json`; + + axios.get(url,{ + params:{ + filepath:arr.path, + ref:branch + } + }).then((result)=>{ + if(result && result.data && result.data.length > 0){ + if(arr.type==="file"){ + this.setState({ + fileDetail:result.data[0], + rootList:undefined + }) + }else{ + if(arr.type===""){ + this.props.showNotification('该文件夹下已无文件') + return + } + this.setState({ + fileDetail:undefined + }) + this.renderData(result.data) + } + } + }).catch((error)=>{ + console.log(error); + }) + } + + renderData=(data)=>{ + const rootList = []; + const readMeContent = []; + data && data.map((item,key)=>{ + rootList.push({ + key, + ...item + }) + if(item.name === 'README.md'){ + readMeContent.push({...item}) + } + }) + this.setState({ + rootList:rootList, + readMeContent + }) + } + + // readme文件内容 + renderReadMeContent=(readMeContent)=>{ + const { fileDetail } = this.state; + if(fileDetail){return;} + if(readMeContent && readMeContent.length > 0){ + return( +
+
{readMeContent[0].name}
+
+ { + readMeContent[0].content ? +
+ : + 暂无~ + } +
+
+ ) + } + } + + // 选择分支 + changeBranch=(value)=>{ + const { branchList } = this.props; + + let branchLastCommit = branchList && branchList.length >0 && branchList.filter(item=>item.name === value)[0]; + this.setState({ + branch:branchLastCommit && branchLastCommit.name, + branchLastCommit, + http_url:branchLastCommit && branchLastCommit.http_url, + isSpin: true + }) + this.getProjectRoot(branchLastCommit.name); + + } + render(){ + const { rootList , branch ,filePath , fileDetail , subFileType , readMeContent, isSpin , rootData } = this.state; + const { branchLastCommit , http_url , isManager , isDeveloper } = this.props; + const { projectsId } = this.props.match.params; + + const columns = [ + { + dataIndex: 'name', + width:"100%", + render: (text,item) => ( + this.ChangeFile(item)}> + {text} + + ), + } + ]; + const title = () =>{ + if(branchLastCommit && branchLastCommit.last_commit){ + return( +
+ { + branchLastCommit.author ? + + + {branchLastCommit.author.login} + + :"" + } + {branchLastCommit.last_commit.id} + {branchLastCommit.last_commit.message} + {branchLastCommit.last_commit.time_from_now} +
+ ) + }else{ + return undefined; + } + } + + const downloadUrl = ()=>{ + if(branchLastCommit && branchLastCommit.zip_url){ + return( + + ZIP + TAR.GZ + + ) + } + } + + const urlRoot = filePath && filePath.length > 0 ? `/${filePath[filePath.length - 1].path}` : ""; + return( + + { + rootData && + + { + rootData.length > 0 ? +
+ +
+
+ + { + filePath && filePath.length > 0 && + + this.getProjectRoot(branch)} className="color-blue">{projectsId} + { + filePath.map((item,key)=>{ + return( + + { + key === filePath.length-1 ? + {item.name} + : + this.ChangeFile(item,key)} className="color-blue subFileName" key={key}>{item.name} + } + + ) + }) + } + + + } + +
+
+ { + subFileType !== "file" && (isManager || isDeveloper) && +

+ 新建文件 + {/* 上传文件 */} +

+ } + { + filePath && filePath.length === 0 && + } +
+
+ + {/* 文件夹-子目录列表 */} + { + rootList && title()}> + } + + { + fileDetail && + + } + + {/* readme.txt */} + { this.renderReadMeContent(readMeContent) } + +
+ : + + } +
+ } +
+ ) + } +} +export default CoderRootDirectorytext; diff --git a/src/forge/Main/CoderRootIndex.js b/src/forge/Main/CoderRootIndex.js index 25a17b462..5ffb3cff0 100644 --- a/src/forge/Main/CoderRootIndex.js +++ b/src/forge/Main/CoderRootIndex.js @@ -21,6 +21,7 @@ const CoderRootBranch = Loadable({ loader: () => import('./CoderRootBranch'), loading: Loading, }) + class CoderRootIndex extends Component{ render(){ diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 2bace9299..b33fb1ed1 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -251,9 +251,19 @@ class Detail extends Component{ isSpin:false }) } else { - this.props.showNotification(`服务器开小差了`); + if(result.data.status !== 401){ + this.props.showNotification(result.data.message); + }else{ + this.setState({ + isSpin:false + }) + this.props.showNotification(`服务器开小差了`); + } } }).catch(error=>{ + this.setState({ + isSpin:false + }) console.log(error); }) } diff --git a/src/forge/Merge/MergeDetail.js b/src/forge/Merge/MergeDetail.js index 47d853fd7..3312ba8f1 100644 --- a/src/forge/Merge/MergeDetail.js +++ b/src/forge/Merge/MergeDetail.js @@ -255,12 +255,18 @@ class MergeDetail extends Component{

{ data && data.issue.description}

-

+

{data&&data.issue_status==="关闭"?"关闭中!":"开启中!"}
- 由 { 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.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} 分支 +

- +
@@ -313,9 +319,9 @@ class MergeDetail extends Component{ 指派给 {data && data.issue.assign_user_name}

-

+

里程碑 - {data&&data.issue.version===null?"未添加里程碑":data&&data.issue.version.length===0?data.issue.version:'未添加里程碑'} + {data&&data.issue.version===null?"未添加里程碑":data&&data.issue.version.length===0?data.issue.version:'未添加里程碑'}

diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index ea55f1bf4..553a4a6d7 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -1,7 +1,29 @@ import React , { Component } from 'react'; import { Link } from 'react-router-dom'; +import {Popconfirm} from "antd"; class MergeItem extends Component{ + constructor(props){ + super(props); + this.state={ + //显示 隐藏 + isdisplay:false, + orderid:'', + } + } + + onMouseMove=(type)=>{ + this.setState({ + isdisplay:true, + orderid:type + }) + } + + onMouseOut=()=>{ + this.setState({ + isdisplay:false + }) + } set_issue_tags =(issue_tags)=>{ if(issue_tags && issue_tags.length > 0){ @@ -41,12 +63,23 @@ class MergeItem extends Component{ }

-
    +
      this.onMouseMove(item.id)} onMouseOut={()=>this.onMouseOut()}>
    • {this.set_issue_tags(item.issue_tags)}
    • {/*
    • {item.issue_type || "--"}
    • */}
    • {item.version || "--"}
    • {item.assign_user_name || "--"}
    • -
    • { item.journals_count ? {item.journals_count} : "" }
    • +
    • +
      +

      + { item.journals_count ? {item.journals_count} : "" } +

      +
      +
      + +
      +
      +
      +
    ) diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 9537a8dd0..60743728f 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -11,7 +11,7 @@ import './merge.css'; import QuillForEditor from '../quillForEditor'; import MergeSubmit from './MergeSubmit'; -// const TextArea = Input.TextArea; +const TextArea = Input.TextArea; const options = [ ['bold', 'italic', 'underline'], @@ -20,6 +20,7 @@ const options = [ ['link', 'image'], ['formula'] ]; + class MessageCount extends Component{ constructor(props){ super(props); @@ -182,7 +183,7 @@ class MessageCount extends Component{ project_id:projectsId, id:data.pull_request.id, do:mergekey, - body:JSON.stringify(body), + body:body, title:title, }).then(result=>{ if(result){ @@ -250,9 +251,9 @@ class MessageCount extends Component{ }) } - changbodypr=(value)=>{ + changbodypr=(e)=>{ this.setState({ - body:value + body:e.target.value }) } editdetail=(count,status)=>{ @@ -502,9 +503,13 @@ class MessageCount extends Component{ }

    {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 ? @@ -562,21 +567,21 @@ class MessageCount extends Component{

    -
    - -
    - {/*