Merge branch 'newVersion_forge' into dev_devOps

# Conflicts:
#	src/forge/Main/Detail.js
This commit is contained in:
caishi 2020-08-21 10:29:08 +08:00
commit 2f1bac24d5
66 changed files with 1572 additions and 1677 deletions

1219
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"code-prettify": "^0.1.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-react-app": "^3.1.1",
"babel-runtime": "6.26.0",

View File

@ -12,32 +12,25 @@ function ImageLayer2(props) {
setShowImage(false)
setImageSrc('')
}
const onDelegateClick = (event) => {
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片
const fileName = event.target.innerHTML.trim()
if (isImageExtension((imageSrc && imageSrc.trim())) || isImageExtension(fileName) || event.target.tagName == 'IMG' || (imageSrc && imageSrc.indexOf('base64,')) != -1) {
// 非回复里的头像图片; 非emoticons
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) {
setShowImage(true)
setImageSrc(imageSrc)
}
event.stopPropagation()
event.preventDefault && event.preventDefault()
event.originalEvent.preventDefault()
// event.originalEvent.stopPropagation()
// event.originalEvent.cancelBubble = true
return false;
}
}
useEffect(() => {
$(parentSel)
.delegate(childSel, "click", onDelegateClick);
return () => {
$(parentSel).undelegate(childSel, "click", onDelegateClick )
}
$(parentSel).delegate(childSel, "click", (event) => {
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片
const fileName = event.target.innerHTML.trim();
if (isImageExtension((imageSrc && imageSrc.trim())) || isImageExtension(fileName) || event.target.tagName == 'IMG' || (imageSrc && imageSrc.indexOf('base64,')) != -1) {
// 非回复里的头像图片; 非emoticons
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) {
setShowImage(true)
setImageSrc(imageSrc)
}
event.stopPropagation()
event.preventDefault && event.preventDefault()
event.originalEvent.preventDefault()
return false;
}
})
})
return (

View File

@ -1,35 +1,12 @@
import marked from 'marked'
import { escape, rtrim } from 'marked/src/helpers'
import { renderToString } from 'katex'
function unescape(str) {
str = str
.replace(/( |\u00a0| )/g, '')
.replace(/>/g, '>')
.replace(/&lt;/g, '<')
.replace(/\\$/g, '')
.replace(/^\\(?:{)/, '\\\\{')
if (!str.match(/\S/)) {
return '';
}
return str
}
function toKatex(str) {
return renderToString(unescape(str), {
throwOnError: false
})
}
import { escape } from 'marked/src/helpers'
function indentCodeCompensation(raw, text) {
const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
if (matchIndentToCode === null) {
return text;
}
const indentToCode = matchIndentToCode[1];
return text
.split('\n')
.map(node => {
@ -37,23 +14,20 @@ function indentCodeCompensation(raw, text) {
if (matchIndentInNode === null) {
return node;
}
const [indentInNode] = matchIndentInNode;
if (indentInNode.length >= indentToCode.length) {
return node.slice(indentToCode.length);
}
return node;
})
.join('\n');
}
const latexRegex = /\`?\${2}([^\$\n]+?)\${2}\`?/g
//兼容之前的 ##标题式写法
const headingRegex = /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/
let toc = []
let ctx = ["<ul>"]
const renderer = new marked.Renderer()
const headingRegex = /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/
export function cleanToc() {
toc = []
@ -97,52 +71,6 @@ const tokenizer = {
}
}
},
paragraph(src) {
const cap = this.rules.block.paragraph.exec(src)
let text = cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1]
let match = text.match(latexRegex)
if (match) {
text = text.replace(latexRegex, (_, $1) => {
return toKatex($1)
})
}
if (cap) {
return {
type: 'paragraph',
raw: cap[0],
text
};
}
},
code(src, tokens) {
const cap = this.rules.block.code.exec(src)
if (cap) {
const lastToken = tokens[tokens.length - 1];
// An indented code block cannot interrupt a paragraph.
if (lastToken && lastToken.type === 'paragraph') {
return {
raw: cap[0],
text: cap[0].trimRight()
}
}
let text = cap[0].replace(/^ {4}/gm, '')
text = !this.options.pedantic ? rtrim(text, '\n') : text
let match = text.match(latexRegex)
if (match) {
text = text.replace(latexRegex, (_, $1) => {
return toKatex($1)
})
}
return {
type: 'code',
raw: cap[0],
codeBlockStyle: 'indented',
text
}
}
},
fences(src) {
const cap = this.rules.block.fences.exec(src)
if (cap) {
@ -150,7 +78,10 @@ const tokenizer = {
let text = indentCodeCompensation(raw, cap[3] || '')
const lang = cap[2] ? cap[2].trim() : cap[2]
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
text = toKatex(text)
const id = next_id()
const expression = text
text = id
math_expressions[id] = { type: 'block', expression }
}
return {
type: 'code',
@ -162,30 +93,69 @@ const tokenizer = {
}
}
const renderer = {
code(code, infostring, escaped) {
const lang = (infostring || '').match(/\S*/)[0];
if (!lang) {
return '<pre class="prettyprint linenums"><code>'
+ (escaped ? code : escape(code, true))
+ '</code></pre>';
}
const latexRegex = /(?:\${2})([^\n`]+?)(?:\${2})/gi
let katex_count = 0
const next_id = () => `__special_katext_id_${katex_count++}__`
let math_expressions = {}
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
return `<p class='editormd-tex'>${code}</p>`
} else {
return `<pre class="prettyprint linenums"><code class="language-${infostring}">${escaped ? code : escape(code, true)}</code></pre>\n`
}
},
heading(text, level, raw, slugger) {
let anchor = this.options.headerPrefix + raw.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g, '-');
toc.push({
anchor: anchor,
level: level,
text: text
})
return '<h' + level + ' id="' + anchor + '">' + text + '</h' + level + '>'
export function getMathExpressions() {
return math_expressions
}
export function resetMathExpressions() {
katex_count = 0
math_expressions = {}
}
function replace_math_with_ids(text) {
let rs = text.replace(latexRegex, (_match, expression) => {
const id = next_id()
math_expressions[id] = { type: 'inline', expression }
return id
})
return rs
}
const original_listitem = renderer.listitem
renderer.listitem = function (text, task, checked) {
return original_listitem(replace_math_with_ids(text), task, checked)
}
const original_paragraph = renderer.paragraph
renderer.paragraph = function (text) {
return original_paragraph(replace_math_with_ids(text))
}
const original_tablecell = renderer.tablecell
renderer.tablecell = function (content, flags) {
return original_tablecell(replace_math_with_ids(content), flags)
}
renderer.code = function (code, infostring, escaped) {
const lang = (infostring || '').match(/\S*/)[0];
if (!lang) {
return '<pre class="prettyprint linenums"><code>'
+ (escaped ? code : escape(code, true))
+ '</code></pre>';
}
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
return `<p class='editormd-tex'>${code}</p>`
} else {
return `<pre class="prettyprint linenums"><code class="language-${infostring}">${escaped ? code : escape(code, true)}</code></pre>\n`
}
}
renderer.heading = function (text, level, raw) {
let anchor = this.options.headerPrefix + raw.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g, '-');
toc.push({
anchor: anchor,
level: level,
text: text
})
return '<h' + level + ' id="' + anchor + '">' + text + '</h' + level + '>'
}
marked.setOptions({

View File

@ -1,31 +1,46 @@
import React, { useEffect, useRef } from "react";
import React, { useEffect, useRef, useMemo } from "react";
import "katex/dist/katex.min.css";
import { renderToString } from 'katex';
import marked, { getTocContent, cleanToc, getMathExpressions, resetMathExpressions } from "../common/marked";
import 'code-prettify'
import marked, { getTocContent, cleanToc } from "../common/marked";
const preRegex = /<pre[^>]*>/g
let preRegex = /<pre[^>]*>/g;
function _unescape(str) {
let div = document.createElement('div')
div.innerHTML = str
return div.childNodes.length === 0 ? "" : div.childNodes[0].nodeValue;
}
export default ({ value = "", is_md = true, className, style = {} }) => {
let str = String(value);
let html = is_md ? marked(str) : value;
if (str.match(/\[TOC\]/)) {
html = html.replace("<p>[TOC]</p>", getTocContent());
cleanToc();
}
export default ({ value = '', className, style = {} }) => {
let str = String(value)
html = html.replace(/▁/g, "▁▁▁");
// html = html.replace(/\n/g,"<br />");
const el = useRef();
const html = useMemo(() => {
let rs = marked(str)
const math_expressions = getMathExpressions()
if (str.match(/\[TOC\]/)) {
rs = rs.replace("<p>[TOC]</p>", getTocContent())
cleanToc()
}
rs = rs.replace(/(__special_katext_id_\d+__)/g, (_match, capture) => {
const { type, expression } = math_expressions[capture]
return renderToString(_unescape(expression), { displayMode: type === 'block', throwOnError: false, output: 'html' })
})
rs = rs.replace(/▁/g, "▁▁▁")
resetMathExpressions()
return rs
}, [str])
const el = useRef()
function onAncherHandler(e) {
let target = e.target;
if (target.tagName.toUpperCase() === "A") {
let ancher = target.getAttribute("href");
if (ancher.startsWith("#")) {
e.preventDefault();
let viewEl = document.getElementById(ancher.replace("#", ""));
let target = e.target
if (target.tagName.toUpperCase() === 'A') {
let ancher = target.getAttribute('href')
if (ancher.startsWith('#')) {
e.preventDefault()
let viewEl = document.getElementById(ancher.replace('#', ''))
if (viewEl) {
viewEl.parentNode.scrollTop = viewEl.offsetTop;
viewEl.parentNode.scrollTop = viewEl.offsetTop
}
}
}
@ -34,23 +49,18 @@ export default ({ value = "", is_md = true, className, style = {} }) => {
useEffect(() => {
if (el.current && html) {
if (html.match(preRegex)) {
window.PR.prettyPrint();
window.PR.prettyPrint()
}
}
if (el.current) {
el.current.addEventListener("click", onAncherHandler);
el.current.addEventListener('click', onAncherHandler)
return () => {
el.current.removeEventListener("click", onAncherHandler);
};
el.current.removeEventListener('click', onAncherHandler)
resetMathExpressions()
cleanToc()
}
}
}, [html, el.current, onAncherHandler]);
}, [html, el.current, onAncherHandler])
return (
<div
ref={el}
style={style}
className={`${className ? className : ""} markdown-body`}
dangerouslySetInnerHTML={{ __html: html }}
></div>
);
};
return (<div ref={el} style={style} className={`${className ? className : ''} markdown-body`} dangerouslySetInnerHTML={{ __html: html }}></div>)
}

View File

@ -52,8 +52,8 @@ class Activity extends Component{
}
getInfo =(time,type,status,page)=>{
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/project_trends.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/activity.json`;
axios.get(url,{
params:{
time,type,status,page

View File

@ -6,7 +6,7 @@ import { getImageUrl } from 'educoder';
class ActivityItem extends Component {
render() {
const { projectsId } = this.props.match.params;
const { projectsId ,owner } = this.props.match.params;
const { item } = this.props;
return (
<div className="activity_item">
@ -14,24 +14,24 @@ class ActivityItem extends Component {
{/* 如果是版本发布 */}
{item.trend_type === "VersionRelease" ?
<p className="itemLine">
<Link to={`/projects/${projectsId}/version`} className="color-blue font-16">{item.name}</Link>
<Link to={`/projects/${owner}/${projectsId}/version`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
:
// 如果是任务
item.trend_type === "Issue" ?
<p className="itemLine">
<Link to={`/projects/${projectsId}/orders/${item.trend_id}/detail`} className="color-blue font-16">{item.name}</Link>
<Link to={`/projects/${owner}/${projectsId}/issues/${item.trend_id}/detail`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
:
// 如果是合并请求
<p className="itemLine">
<Link to={`/projects/${projectsId}/merge/${item.trend_id}/Messagecount`} className="color-blue font-16">{item.name}</Link>
<Link to={`/projects/${owner}/${projectsId}/pulls/${item.trend_id}/Messagecount`} className="color-blue font-16">{item.name}</Link>
<span className="activity_type">{item.trend_type}</span>
</p >
}
<p className="itemLine mt15">
<p className="itemLine mt10">
<Link to={`/users/${item && item.login}`} className="show-user-link">
<img alt="" src={getImageUrl(`images/${item.user_avatar}`)} className="createImage" />
<span className="mr20">{item.user_name}</span>

View File

@ -66,6 +66,9 @@
display: flex;
align-items: flex-start;
}
.activity_list .activity_item:last-child{
border-bottom: none;
}
.prPercent > p{
position: absolute;
height: 100%;

View File

@ -4,7 +4,7 @@ import './branch.css';
import { getBranch , getTag } from '../GetData/getData';
export default (({ projectsId , repo_id , changeBranch , branch })=>{
export default (({ projectsId , repo_id , changeBranch , branch , owner })=>{
const [ showValue , setShowValue ] = useState(branch);
const [ inputValue , setInputValue] = useState(undefined);
const [ nav , setNav ] = useState(0);
@ -30,18 +30,18 @@ export default (({ projectsId , repo_id , changeBranch , branch })=>{
})
useEffect(()=>{
getBranchs(projectsId);
getBranchs(projectsId,owner);
},[projectsId])
async function getBranchs(id){
let result = await getBranch(id);
async function getBranchs(id,owner){
let result = await getBranch(id,owner);
setData(result);
setDatas(result);
setIsSpin(false);
}
async function getTags(id){
let result = await getTag(id);
async function getTags(id,owner){
let result = await getTag(id,owner);
setData(result);
setDatas(result);
setIsSpin(false);
@ -57,9 +57,9 @@ export default (({ projectsId , repo_id , changeBranch , branch })=>{
setNav(nav);
setIsSpin(true);
if(nav === 0){
getBranchs(projectsId);
getBranchs(projectsId,owner);
}else{
getTags(repo_id);
getTags(projectsId,owner);
}
}
function chooseitem(value){

View File

@ -58,27 +58,27 @@ const LANGUAGE = [
export default (({ language , select_language })=>{
const [ languages , setLanguage ] = useState(undefined);
useEffect(()=>{
const url = '/dev_ops/languages.json';
axios.get(url).then(result=>{
if(result){
setLanguage(result.data);
}
}).catch(error=>{
console.log(error);
})
},[])
// useEffect(()=>{
// const url = '/dev_ops/languages.json';
// axios.get(url).then(result=>{
// if(result){
// setLanguage(result.data);
// }
// }).catch(error=>{
// console.log(error);
// })
// },[])
function changelanguage(value){
let array = value ? languages.filter(item=>item.name === value) :undefined;
select_language(value,array && array[0]);
// let array = value ? languages.filter(item=>item.name === value) :undefined;
select_language(value);
}
return(
<Select showSearch={true} placeholder={"请选择文本语言"} style={{ width: 200 }} value={language} onChange={changelanguage}>
<Option value={undefined}>请选择文本语言</Option>
{languages && languages.map((item, key) => {
return <Option value={item.name}>{item.name}</Option>;
{LANGUAGE && LANGUAGE.map((item, key) => {
return <Option value={item}>{item}</Option>;
})}
</Select>
)

View File

@ -15,6 +15,7 @@ function Dispose(props){
const [ first , setFirst ] = useState(false);
let projectsId = props.match.params.projectsId;
let owner = props.match.params.owner;
useEffect(()=>{
if(projectsId){
@ -71,7 +72,7 @@ function Dispose(props){
}
if(first){
// true
url = `/repositories/${projectsId}/update_file.json`;
url = `/${owner}/${projectsId}/update_file.json`;
axios.put(url,{
...params,
sha:info && info.sha
@ -83,7 +84,7 @@ function Dispose(props){
console.log(error);
})
}else{
url = `/repositories/${projectsId}/create_file.json`;
url = `/${owner}/${projectsId}/create_file.json`;
axios.post(url,params).then(result=>{
if(result){
setVisible(true);
@ -94,7 +95,7 @@ function Dispose(props){
}
}
function suresubmit(){
props.history.push(`/projects/${projectsId}/ops/list`);
props.history.push(`/projects/${owner}/${projectsId}/ops/list`);
}
return(

View File

@ -1,11 +1,11 @@
import axios from 'axios';
//
export const getBranch = async (id)=>{
return (await axios.get(`/projects/${id}/branches.json`)).data;
export const getBranch = async (id,owner)=>{
return (await axios.get(`/${owner}/${id}/branches.json`)).data;
}
//
export const getTag = async (id)=>{
return (await axios.get(`/repositories/${id}/tags.json`)).data;
export const getTag = async (id,owner)=>{
return (await axios.get(`/${owner}/${id}/tags.json`)).data;
}
// hooks-web
export const getHooks = async (id,params)=>{

View File

@ -46,7 +46,7 @@ class Index extends Component {
)}
></Route>
<Route
path="/projects/:projectsId"
path="/projects/:owner/:projectsId"
render={(props) => (
<ProjectDetail {...this.props} {...props} />
)}

View File

@ -10,14 +10,14 @@ export default ((props)=>{
const [ data , setData ] =useState(undefined);
const [ isSpin , setIsSpin ] =useState(true);
const { projectsId } = props.match.params;
const { projectsId , owner } = props.match.params;
useEffect(()=>{
getBranchs(projectsId);
getBranchs(projectsId, owner);
},[projectsId])
async function getBranchs(id){
let result = await getBranch(id);
async function getBranchs(id,owner){
let result = await getBranch(id,owner);
setData(result);
setIsSpin(false);
}
@ -32,7 +32,7 @@ export default ((props)=>{
return(
<li key={key}>
<div>
<Link to={`/projects/${projectsId}/coders?branch=${item.name}`} className="color-blue font-15" style={{"maxWidth":"100px"}}>{item.name}</Link>
<Link to={`/projects/${owner}/${projectsId}?branch=${item.name}`} className="color-blue font-15" style={{"maxWidth":"100px"}}>{item.name}</Link>
<p className="f-wrap-alignCenter mt15">
<span className="mr5 commitKey" style={{marginLeft:0}}>{item.last_commit && truncateCommitId(item.last_commit.sha)}</span>
<span className="color-grey-3 hide-1 messages leftPoint">{item.last_commit && item.last_commit.message}</span>
@ -40,7 +40,7 @@ export default ((props)=>{
</p>
</div>
<span>
<Link to={`/projects/${projectsId}/merge/new`} className="mr20 color-blue mr30">创建合并请求</Link>
<Link to={`/projects/${owner}/${projectsId}/pulls/new`} className="mr20 color-blue mr30">创建合并请求</Link>
<Dropdown overlay={menu(item.zip_url,item.tar_url)} trigger={['click']} placement="bottomRight" className="color-green-file">
<a className="ant-dropdown-link">
<Tooltip title={`下载分支${item.name}`}><Icon type="cloud-download" className="font-18"/></Tooltip>

View File

@ -33,8 +33,8 @@ class CoderRootCommit extends Component{
this.setState({
isSpining:true
})
const { projectsId } = this.props.match.params;
const url = `/repositories/${projectsId}/commits.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/commits.json`;
axios.get(url,{
params:{
sha:branch,
@ -86,7 +86,7 @@ class CoderRootCommit extends Component{
render(){
const { branch , commitDatas , dataCount , limit , page , isSpining } = this.state;
const { branchs , projectDetail, commit_class } = this.props;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
return(
<React.Fragment>
@ -97,6 +97,7 @@ class CoderRootCommit extends Component{
projectsId={projectsId}
branch={branch}
changeBranch={this.changeBranch}
owner={owner}
></SelectBranch>
</div>
<Spin spinning={isSpining}>

View File

@ -91,54 +91,48 @@ class CoderRootDirectory extends Component {
// 页面地址返回到主目录
returnMain = (branch) => {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
this.setState({
readOnly:true
})
this.props.history.push(`/projects/${projectsId}/coders`);
this.props.history.push(`/projects/${owner}/${projectsId}`);
this.getProjectRoot(branch);
};
// 获取根目录
getProjectRoot = (branch) => {
const { projectsId } = this.props.match.params;
const url = `/repositories/${projectsId}/entries.json`;
axios
.get(url, {
params: {
ref: branch,
},
})
.then((result) => {
if (result) {
let last_commit = result.data && result.data.last_commit;
let entries = result.data && result.data.entries;
this.setState({
filePath: undefined,
fileDetail: undefined,
isSpin: false,
branchLastCommit: last_commit && last_commit.commit,
lastCommitAuthor:
last_commit && (last_commit.author || (last_commit.commit && last_commit.commit.author)),
zip_url: result.data.zip_url,
tar_url: result.data.tar_url
});
if (entries && entries.length > 0) {
this.renderData(entries);
}
this.setState({
rootList: entries,
subFileType: true,
});
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/entries.json`;
axios.get(url, { params: { ref: branch } })
.then((result) => {
if (result) {
let last_commit = result.data && result.data.last_commit;
let entries = result.data && result.data.entries;
this.setState({
filePath: undefined,
fileDetail: undefined,
isSpin: false,
branchLastCommit: last_commit && last_commit.commit,
lastCommitAuthor:
last_commit && (last_commit.author || (last_commit.commit && last_commit.commit.author)),
zip_url: result.data.zip_url,
tar_url: result.data.tar_url
});
if (entries && entries.length > 0) {
this.renderData(entries);
}
})
.catch((error) => {});
this.setState({
rootList: entries,
subFileType: true,
});
}
}).catch((error) => {});
};
ChangeFile = (arr, readOnly) => {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
//点击直接跳转页面 加载一次路由
this.props.history.push(`/projects/${projectsId}/coders?url=${arr.path}`);
this.props.history.push(`/projects/${owner}/${projectsId}?url=${arr.path}`);
this.setState({
readOnly: readOnly,
chooseType:"file"
@ -166,10 +160,10 @@ class CoderRootDirectory extends Component {
: type,
});
});
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
//点击直接跳转页面 加载一次路由
this.props.history.push(
`/projects/${projectsId}/coders?url=${str.substr(1)}`
`/projects/${owner}/${projectsId}?url=${str.substr(1)}`
);
} else {
list.push({
@ -186,9 +180,9 @@ class CoderRootDirectory extends Component {
// 获取子目录
getFileDetail = (path, ref) => {
const { projectsId } = this.props.match.params;
const { projectsId ,owner } = this.props.match.params;
const { branch } = this.state;
const url = `/repositories/${projectsId}/sub_entries.json`;
const url = `/${owner}/${projectsId}/sub_entries.json`;
axios.get(url,{
params:{
@ -252,8 +246,8 @@ class CoderRootDirectory extends Component {
this.setState({
chooseType:type
})
const { projectsId } = this.props.match.params;
this.props.history.push(`/projects/${projectsId}/coders?url=${path}`);
const { projectsId, owner } = this.props.match.params;
this.props.history.push(`/projects/${owner}/${projectsId}?url=${path}`);
if(filename.substring(filename.length - 3) === ".md"){
this.setState({
md:true
@ -295,7 +289,7 @@ class CoderRootDirectory extends Component {
<div className="commonBox-info">
{readMeContent[0].content ? (
<RenderHtml
className="break_word_comments"
className="break_word_comments imageLayerParent"
value={readMeContent[0].content}
/>
) : (
@ -335,8 +329,8 @@ class CoderRootDirectory extends Component {
chooseType:"dir",
readOnly:true
})
const { projectsId } = this.props.match.params;
this.props.history.push(`/projects/${projectsId}/coders?url=${url}`);
const { projectsId , owner } = this.props.match.params;
this.props.history.push(`/projects/${owner}/${projectsId}?url=${url}`);
}
onEdit=(readOnly)=>{
@ -407,8 +401,7 @@ class CoderRootDirectory extends Component {
render(){
const { branchLastCommit , lastCommitAuthor , rootList , branch ,filePath , fileDetail , subFileType , readMeContent, isSpin , zip_url , tar_url} = this.state;
const { isManager , isDeveloper , projectDetail } = this.props;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const columns = [
{
dataIndex: 'name',
@ -454,6 +447,7 @@ class CoderRootDirectory extends Component {
projectsId={projectsId}
branch={branch}
changeBranch={this.changeBranch}
owner={owner}
></SelectBranch>
{filePath && (
@ -484,15 +478,13 @@ class CoderRootDirectory extends Component {
{subFileType && (projectDetail && parseInt(projectDetail.type)) !== 2 && (isManager || isDeveloper) && (
<div>
<span>
<Link
to={`/projects/${projectsId}/coders/${branch}/uploadfile${urlRoot}`}
>
<Link to={`/projects/${owner}/${projectsId}/${branch}/uploadfile${urlRoot}`} >
<span className="color-green mr30">上传文件</span>
</Link>
</span>
<span className="mr30">
<Link
to={`/projects/${projectsId}/coders/${branch}/newfile${urlRoot}`}
to={`/projects/${owner}/${projectsId}/${branch}/newfile${urlRoot}`}
>
<span className="color-blue">新建文件</span>
</Link>

View File

@ -122,9 +122,9 @@ class CoderRootFileDetail extends Component {
deleteFile = () => {
const { branch, detail } = this.props;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const url = `/repositories/${projectsId}/delete_file.json`;
const url = `/${owner}/${projectsId}/delete_file.json`;
axios
.delete(url, {
params: {
@ -136,7 +136,7 @@ class CoderRootFileDetail extends Component {
.then((result) => {
if (result) {
this.props.showNotification("删除成功!");
this.props.history.push(`/projects/${projectsId}`);
this.props.history.push(`/projects/${owner}/${projectsId}`);
}
})
.catch((error) => {
@ -246,7 +246,7 @@ class CoderRootFileDetail extends Component {
) : (
md && readOnly ?
<div className="files-md">
<RenderHtml className="file-md" value={description} />
<RenderHtml className="file-md imageLayerParent" value={description} />
</div>
:
<Meditor

View File

@ -64,8 +64,8 @@ class CoderRootIndex extends Component{
}
getTopCount=(branch)=>{
const { projectsId } = this.props.match.params;
const url = `/repositories/${projectsId}/top_counts.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/top_counts.json`;
axios.get(url,{params:{
ref:branch
}}).then(result=>{
@ -82,65 +82,60 @@ class CoderRootIndex extends Component{
<Top {...this.props} {...this.state}/>
<Switch {...this.props}>
{/* 新建文件 */}
<Route path="/projects/:projectsId/coders/:branch/newfile/:path"
<Route path="/projects/:owner/:projectsId/:branch/newfile/:path"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/:branch/uploadfile"
<Route path="/projects/:owner/:projectsId/:branch/uploadfile"
render={
(props) => (<UploadFile {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/:branch/newfile"
<Route path="/projects/:owner/:projectsId/:branch/newfile"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} getTopCount={this.getTopCount} />)
}
></Route>
<Route path="/projects/:projectsId/coders/commit"
<Route path="/projects/:owner/:projectsId/commits"
render={
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
}
></Route>
{/* diff */}
<Route path="/projects/:projectsId/diff/:sha"
<Route path="/projects/:owner/:projectsId/diff/:sha"
render={
() => (<Diff {...this.props} {...this.state}/>)
}
></Route>
<Route path="/projects/:projectsId/coders/version/new"
<Route path="/projects/:owner/:projectsId/releases/:versionId/update"
render={
(props) => (<CoderRootVersionUpdate {...this.props} {...this.state} {...props} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/releases/new"
render={
() => (<CoderRootVersionNew {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/version/:versionId/update"
render={
() => (<CoderRootVersionUpdate {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/version"
<Route path="/projects/:owner/:projectsId/releases"
render={
() => (<CoderRootVersion {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/tag"
<Route path="/projects/:owner/:projectsId/tag"
render={
() => (<CoderRootTag {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/branch"
<Route path="/projects/:owner/:projectsId/branch"
render={
() => (<CoderRootBranch {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders"
render={
() => (<CoderRootDirectory {...this.props} {...this.state} getTopCount={this.getTopCount} />)
}
></Route>
<Route path="/projects/:projectsId"
<Route path="/projects/:owner/:projectsId"
render={
() => (<CoderRootDirectory {...this.props} {...this.state} getTopCount={this.getTopCount} />)
}

View File

@ -5,16 +5,16 @@ import { truncateCommitId } from '../common/util';
import Nodata from '../Nodata';
export default ({
projectDetail
}) => {
export default (( props, { projectDetail }) => {
const [isSpin, setSpin] = useState(true);
const [data, setData] = useState(undefined);
const repo_id = projectDetail && projectDetail.repo_id;
const { projectsId , owner } = props.match.params;
useEffect(() => {
if (repo_id) {
const url = `/repositories/${repo_id}/tags.json`;
if (projectsId) {
const url = `/${owner}/${projectsId}/tags.json`;
axios.get(url).then((result) => {
if (result) {
setSpin(false);
@ -24,7 +24,7 @@ export default ({
console.log(error);
})
}
}, [repo_id]);
}, [owner, projectsId]);
return (
<div className="main">
@ -67,4 +67,4 @@ export default ({
</Spin>
</div>
)
}
})

View File

@ -121,7 +121,23 @@ const DevIndex = Loadable({
/**
* permissionManager:管理员Reporter报告人员(只有读取权限)Developer开发人员除不能设置仓库信息外
*/
function checkPathname(pathname){
let name = "";
if(pathname){
if(pathname.indexOf("/issues")>-1 ||pathname.indexOf("Milepost") > 0){
name = "issues";
}else if(pathname.indexOf("/pulls")>-1){
name="pulls"
}else if(pathname.indexOf("/milestones")>-1){
name="milestones"
}else if(pathname.indexOf("/activity")>-1){
name="activity"
}else if(pathname.indexOf("/setting")>-1){
name="setting"
}
}
return name;
}
class Detail extends Component {
constructor(props) {
super(props);
@ -151,14 +167,16 @@ class Detail extends Component {
}
componentDidUpdate = (prevState) => {
if ((prevState.match.params.projectsId !== this.props.match.params.projectsId)) {
let prevParam = prevState.match.params;
let propsParam = this.props.match.params;
if (prevState && this.props && (prevParam.projectsId !== propsParam.projectsId || prevParam.owner !== propsParam.owner)) {
this.getProject();
}
}
getProject = (num) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/simple.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/simple.json`;
axios.get(url).then((result) => {
if (result && result.data) {
this.setState({
@ -204,7 +222,6 @@ class Detail extends Component {
disconnected: () => { },
received: data => {
console.log(`###### ---received data--- ######`);
console.log(data);
if (data) {
this.getDetail();
cable.subscriptions.consumer.disconnect();
@ -214,8 +231,8 @@ class Detail extends Component {
}
getDetail = () => {
const { projectsId } = this.props.match.params;
const url = `/repositories/${projectsId}.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
@ -247,15 +264,14 @@ class Detail extends Component {
target_type: "project",
id: project_id
}
}).then(result => {
if (result && result.data.status === 0) {
this.setWatchersCount(result.data.watchers_count, result.data.watched);
}
})
.then(result => {
if (result && result.data.status === 0) {
this.setWatchersCount(result.data.watchers_count, result.data.watched);
}
})
.catch(error => {
console.log(error);
});
.catch(error => {
console.log(error);
});
}
// 点赞和取消点赞
@ -264,15 +280,14 @@ class Detail extends Component {
axios({
method: flag ? 'delete' : 'post',
url: `/projects/${project_id}/praise_tread/${flag ? 'unlike' : 'like'}.json`
}).then(result => {
if (result && result.data.status === 0) {
this.setPraisesCount(result.data.praises_count, result.data.praised)
}
})
.then(result => {
if (result && result.data.status === 0) {
this.setPraisesCount(result.data.praises_count, result.data.praised)
}
})
.catch(error => {
console.log(error);
});
.catch(error => {
console.log(error);
});
}
setWatchersCount = (count, is_watched) => {
@ -291,11 +306,12 @@ class Detail extends Component {
// fork项目
forkFunc = () => {
const { project_id } = this.state;
const url = `/projects/${project_id}/forks.json`;
const { current_user } = this.props
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/forks.json`;
axios.post(url).then(result => {
if (result && result.data.status === 0) {
this.props.history.push(`/projects/${result.data.id}/coders`);
this.props.history.push(`/projects/${current_user && current_user.login}/${result.data.identifier}`);
this.props.showNotification(result.data.message);
}
}).catch(error => {
@ -303,11 +319,10 @@ class Detail extends Component {
})
}
// 同步镜像
synchronismMirror = () => {
const { repo_id } = this.state.projectDetail;
const url = `/repositories/${repo_id}/sync_mirror.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/sync_mirror.json`;
axios.post(url).then(result => {
if (result && result.data && result.data.status === 0) {
this.getProject(2);
@ -319,26 +334,31 @@ class Detail extends Component {
})
}
render() {
const { projectDetail, watchers_count, praises_count, forked_count, firstSync , secondSync , isManager, watched, praised, project } = this.state;
const url = this.props.history.location.pathname;
const urlArr = url.split("/");
const urlFlag = (urlArr.length === 3);
let pathname = checkPathname(url);
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { state } = this.props.history.location;
const { current_user } = this.props;
const checkLogin = current_user && current_user.login;
const text = (
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
<React.Fragment>
<span>forked from </span>
<Link to={`/users/${projectDetail.fork_info.fork_project_user_login}`} className="show-user-link color-grey-ccc">{projectDetail.fork_info.fork_project_user_name}</Link>
<span> / </span>
<Link to={`/projects/${projectDetail.forked_from_project_id}/coders`} className="color-grey-ccc">{projectDetail.fork_info.fork_form_name}</Link>
<Link to={`/projects/${projectDetail.fork_info.fork_project_user_login}/${projectDetail.fork_info.fork_project_identifier}`} className="color-grey-ccc">{projectDetail.fork_info.fork_form_name}</Link>
</React.Fragment> : ""
);
const common = {
getDetail: this.getDetail
@ -356,11 +376,11 @@ class Detail extends Component {
}
<span className="ml5 mr5">/</span>
<span className="hide-1 flex-1 df">
<Link to={`/projects/${projectsId}/coders`} className="color-white font-22">{project && project.name}</Link>
<Link to={`/projects/${owner}/${projectsId}`} className="color-white font-22">{project && project.name}</Link>
{
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
<Tooltip placement={'right'} title={text}>
<Link to={`/projects/${projectDetail.forked_from_project_id}/coders`}
<Link to={`/projects/${projectDetail.fork_info.fork_project_user_login}/${projectDetail.fork_info.fork_project_identifier}`}
className="ml10" >
<i className="iconfont icon-fork font-18 fl mt6" style={{ color: "#8D90E3" }}></i>
</Link>
@ -391,7 +411,7 @@ class Detail extends Component {
<img src={watched ? img_focused : img_focus} alt="" width="14px" />
{watched ? '取消关注' : '关注'}
</a>
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${projectsId}/watch_users`, state }}>
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${owner}/${projectsId}/watchers`, state }}>
{watchers_count}
</Link>
</span>
@ -400,14 +420,14 @@ class Detail extends Component {
<img src={praised ? img_parised : img_parise} width="13px" alt="" />
{praised ? '取消点赞' : '点赞'}
</a>
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${projectsId}/praise_users`, state }}>
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${owner}/${projectsId}/stargazers`, state }}>
{praises_count}
</Link>
</span>
<span className="detail_tag_btn">
<a className="detail_tag_btn_name" onClick={this.forkFunc}>
<img src={img_fork} alt="" width="10px" />Fork</a>
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${projectsId}/fork_users`, state }}>
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${owner}/${projectsId}/fork_users`, state }}>
{forked_count}
</Link>
</span>
@ -418,46 +438,46 @@ class Detail extends Component {
firstSync ? "" :
<div className="f-wrap-between pb20">
<ul className="headerMenu-wrapper">
<li className={(url.indexOf("coders") > -1 || urlFlag) ? "active" : ""}>
<Link to={{ pathname: `/projects/${projectsId}/coders`, state }}>
<li className={(pathname==="" || urlFlag) ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}`, state }}>
<img alt="" src={img_1} width="18" />代码库
</Link>
</li>
<li className={(url.indexOf("/orders") > -1 && !(url.indexOf("Milepost") > 0 || url.indexOf("meilpost") > 0 || url.indexOf("tags") > 0)) ? "active" : ""}>
<Link to={{ pathname: `/projects/${projectsId}/orders`, state }}>
<li className={pathname==="issues" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/issues`, state }}>
<img alt="" src={img_2} width="12" />任务
{projectDetail && projectDetail.issues_count ? <span>{projectDetail.issues_count}</span> : ""}
</Link>
</li>
{
projectDetail && parseInt(projectDetail.type) !== 2 &&
<li className={url.indexOf("merge") > -1 ? "active" : ""}>
<Link to={{ pathname: `/projects/${projectsId}/merge`, state }}>
<li className={pathname==="pulls" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/pulls`, state }}>
<img alt="" src={img_3} width="13" />合并请求
{projectDetail && projectDetail.pull_requests_count ? <span>{projectDetail.pull_requests_count}</span> : ""}
</Link>
</li>
}
<li className={url.indexOf("/ops") > -1 ? "active" : ""}>
<Link to={{ pathname: `/projects/${projectsId}/ops`, state }}>
{/* <li className={url.indexOf("/ops") > -1 ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/ops`, state }}>
<i className="iconfont icon-gongzuoliu font-13 mr8"></i>
{projectDetail && projectDetail.ops_count ? <span>{projectDetail.ops_count}</span> : ""}
</Link>
</li>
<li className={(url.indexOf("/Milepost") > -1 || url.indexOf("meilpost") > -1) ? "active" : ""}>
<Link to={{ pathname: `/projects/${projectsId}/orders/Milepost`, state }}>
</li> */}
<li className={pathname==="milestones" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/milestones`, state }}>
<img alt="" src={img_milepost} width="16" />里程碑
{projectDetail && projectDetail.versions_count ? <span>{projectDetail.versions_count}</span> :""}
</Link>
</li>
<li className={url.indexOf("/trends") > -1 ? "active" : ""}>
<Link to={{ pathname: `/projects/${projectsId}/trends`, state }}>
<li className={pathname==="activity" ? "active" : ""}>
<Link to={{ pathname: `/projects/${owner}/${projectsId}/activity`, state }}>
<img alt="" src={img_6} width="16" />动态
</Link>
</li>
{
isManager &&
<li className={url.indexOf("/setting") > 0 ? "active" : ""}><Link to={`/projects/${projectsId}/setting`}><img alt="" src={img_7} width="19" />仓库设置</Link></li>
<li className={url.indexOf("/setting") > 0 ? "active" : ""}><Link to={`/projects/${owner}/${projectsId}/setting`}><img alt="" src={img_7} width="19" />仓库设置</Link></li>
}
</ul>
</div>
@ -474,141 +494,136 @@ class Detail extends Component {
<Spin spinning={secondSync} className="spinstyle" tip="正在同步镜像" size="large">
<Switch {...this.props}>
{/* 工作流 */}
<Route path="/projects/:projectsId/ops"
<Route path="/projects/:owner/:projectsId/ops"
render={
() => (<DevIndex {...this.props} {...this.state} {...common} />)
}
></Route>
{/* 标签列表 */}
<Route path="/projects/:projectsId/orders/tags"
<Route path="/projects/:owner/:projectsId/issues/tags"
render={
(props) => (<TagList {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 仓库设置 */}
<Route path="/projects/:projectsId/setting"
<Route path="/projects/:owner/:projectsId/setting"
render={
(props) => (<Setting {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 任务详情 */}
<Route path="/projects/:projectsId/orders/:orderId/detail"
<Route path="/projects/:owner/:projectsId/issues/:orderId/detail"
render={
(props) => (<OrderDetail {...this.props} {...props} {...this.state} {...common} />)
(props) => (<OrderDetail {...this.props} {...this.state} {...props} {...common} />)
}
></Route>
{/* 里程碑 */}
<Route path="/projects/:projectsId/orders/Milepost"
{/*修改里程碑*/}
<Route path="/projects/:owner/:projectsId/milestones/:meilid/edit"
render={
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} {...common} />)
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 新建里程碑 */}
<Route path="/projects/:projectsId/orders/meilpost"
<Route path="/projects/:owner/:projectsId/milestones/new"
render={
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/*里程碑详情*/}
<Route path="/projects/:projectsId/orders/:meilid/MilepostDetail"
<Route path="/projects/:owner/:projectsId/milestones/:meilid"
render={
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/*修改里程碑*/}
<Route path="/projects/:projectsId/orders/:meilid/meilpost"
{/* 里程碑 */}
<Route path="/projects/:owner/:projectsId/milestones"
render={
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} {...common} />)
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 里程碑页面新建任务 */}
<Route path="/projects/:projectsId/orders/:milepostId/new"
<Route path="/projects/:owner/:projectsId/issues/:milepostId/new"
render={
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 新建任务 */}
<Route path="/projects/:projectsId/orders/new"
<Route path="/projects/:owner/:projectsId/issues/new"
render={
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 修改详情 */}
<Route path="/projects/:projectsId/orders/:orderId/updatedetail"
<Route path="/projects/:owner/:projectsId/issues/:orderId/updatedetail"
render={
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 复制详情 */}
<Route path="/projects/:projectsId/orders/:orderId/copyetail"
<Route path="/projects/:owner/:projectsId/issues/:orderId/copyetail"
render={
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 动态 */}
<Route path="/projects/:projectsId/trends"
<Route path="/projects/:owner/:projectsId/activity"
render={
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 代码Index */}
<Route path="/projects/:projectsId/orders"
<Route path="/projects/:owner/:projectsId/issues"
render={
(props) => (<OrderIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/merge/new"
<Route path="/projects/:owner/:projectsId/pulls/new"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/projects/:projectsId/merge/:mergeId/UpdateMerge"
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/UpdateMerge"
render={
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/merge/:mergeId/Messagecount"
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/Messagecount"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/merge/:mergeId/MergeSubmit"
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/MergeSubmit"
render={
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/merge"
<Route path="/projects/:owner/:projectsId/pulls"
render={
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/coders/filesurl"
<Route path="/projects/:owner/:projectsId/coders/filesurl"
render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/coders"
render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/watch_users"
<Route path="/projects/:owner/:projectsId/watchers"
render={
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/praise_users"
<Route path="/projects/:owner/:projectsId/stargazers"
render={
(props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/fork_users"
<Route path="/projects/:owner/:projectsId/fork_users"
render={
(props) => (<ForkUsers {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId"
<Route path="/projects/:owner/:projectsId"
render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common} />)
}

View File

@ -4,23 +4,23 @@ import { Link } from 'react-router-dom';
class DetailTop extends Component {
render() {
const { coderCount } = this.props;
const { projectsId } = this.props.match.params;
const { projectsId, owner } = this.props.match.params;
const { pathname } = this.props.location;
return (
<p className="branch-wrapper">
<Link to={`/projects/${projectsId}/coders/commit`} className={pathname.indexOf("/coders/commit") > 0 ? "active" : ""}>
<Link to={`/projects/${owner}/${projectsId}/commits`} className={pathname.indexOf("/commits") > 0 ? "active" : ""}>
<i className="iconfont icon-tijiaojilu font-20 mr3 font-bd"></i>
<span>{(coderCount && coderCount.commits_count) || 0}</span>
</Link>
<Link to={`/projects/${projectsId}/coders/branch`} className={pathname.indexOf("/coders/branch") > 0 ? "active" : ""}>
<Link to={`/projects/${owner}/${projectsId}/branch`} className={pathname.indexOf("/branch") > 0 ? "active" : ""}>
<i className="iconfont icon-fenzhi1 font-18 mr3"></i>
<span>{(coderCount && coderCount.branches_count) || 0}</span>
</Link>
<Link to={`/projects/${projectsId}/coders/tag`} className={pathname.indexOf("/coders/tag") > 0 ? "active" : ""}>
<Link to={`/projects/${owner}/${projectsId}/tag`} className={pathname.indexOf("/tag") > 0 ? "active" : ""}>
<i className="iconfont icon-biaoqian3 font-18 mr3"></i>
<span>{(coderCount && coderCount.tags_count) || 0}</span>
</Link>
<Link to={`/projects/${projectsId}/coders/version`} className={pathname.indexOf("/coders/version") > 0 ? "active" : ""}>
<Link to={`/projects/${owner}/${projectsId}/releases`} className={pathname.indexOf("/releases") > 0 ? "active" : ""}>
<i className="iconfont icon-fahangban font-18 mr3"></i>
<span>{(coderCount && coderCount.version_releasesed_count) || 0}</span>
</Link>

View File

@ -2,7 +2,8 @@ import React, { Component } from 'react';
import { Tooltip } from 'antd';
import { getImageUrl } from 'educoder';
import { Link } from 'react-router-dom';
import '../css/index.scss'
import '../css/index.scss';
import Nodata from '../Nodata';
import './list.css';
import img_parise from '../Images/parise.png';
@ -24,7 +25,7 @@ class IndexItem extends Component {
</Link>
<div className="p-r-Infos">
<div className="p-r-name">
<Link to={`/projects/${item.id}/coders`} className="hide-1 color-grey-3 font-18 task-hide " style={{ whiteSpace: "wrap", display: 'flex', width: 400 }}>
<Link to={`/projects/${item.author.login}/${item.identifier}`} className="hide-1 color-grey-3 font-18 task-hide " style={{ whiteSpace: "wrap", display: 'flex', width: 400 }}>
{item.author.name}/{item.name}
{
item.forked_from_project_id ?
@ -62,7 +63,7 @@ class IndexItem extends Component {
</div>
</div>
)
}) : ""
}) : <Nodata _html="暂无数据~"></Nodata>
)
return (
<div className="project-list minH-670">

View File

@ -32,8 +32,8 @@ class MergeDetail extends Component {
}
getDetail = () => {
const { projectsId, mergeid } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeid}.json`;
const { projectsId, mergeid ,owner } = this.props.match.params;
const url = `/projects/${owner}/${projectsId}/pulls/${mergeid}.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
@ -107,8 +107,8 @@ class MergeDetail extends Component {
//关闭任务
closedetail = (id) => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/close_issue.json`;
const { projectsId, orderId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/${orderId}/close_issue.json`;
axios.post(url, {
project_id: projectsId,
id: orderId,
@ -161,7 +161,7 @@ class MergeDetail extends Component {
})
}
render() {
const { projectsId, mergeid } = this.props.match.params;
const { projectsId, mergeid , owner } = this.props.match.params;
const { data, journalsdata, showFiles } = this.state;
const { getFieldDecorator } = this.props.form;
const url = this.props.history.location.pathname;
@ -228,7 +228,7 @@ class MergeDetail extends Component {
<div>
{
data && data.issue.user_permission ?
<Link to={`/projects/${projectsId}/merge/${mergeid}/updatemerge`} className="color-blue fr">编辑</Link>
<Link to={`/projects/${owner}/${projectsId}/pulls/${mergeid}/updatemerge`} className="color-blue fr">编辑</Link>
: ''
}
</div>
@ -248,8 +248,8 @@ class MergeDetail extends Component {
<div className="detailHeader-wrapper">
<div className="normal f-wrap-between">
<ul className="headerMenu-wrapper">
<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("Messagecount") > 0 ? "active" : ""}><Link to={`/projects/${owner}/${projectsId}/pulls/${mergeid}/Messagecount`}>对话内容</Link></li>
<li className={url.indexOf("MergeSubmit") > 0 ? "active" : ""}><Link to={`/projects/${owner}/${projectsId}/pulls/${mergeid}/MergeSubmit`}>代码提交</Link></li>
</ul>
</div>
</div>

View File

@ -43,7 +43,7 @@ class MergeItem extends Component {
render() {
const { issues, project_name, project_author_name } = this.props;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { current_user } = this.props;
const renderList = () => {
if (issues && issues.length > 0) {
@ -53,7 +53,7 @@ class MergeItem extends Component {
<div className="flex-1">
<p className="mb15 df" style={{ alignItems: "center" }}>
<Link
to={`/projects/${projectsId}/merge/${item.pull_request_id}/Messagecount`}
to={`/projects/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
className="hide-1 font-15 color-grey-3 fwb lineh-30 mr10"
style={{ maxWidth: "300px" }}
>
@ -98,9 +98,7 @@ class MergeItem extends Component {
<span className="ml15">
<Tag className="pr-branch-tag">
<Link
to={`/projects/${
item.is_original ? item.fork_project_id : projectsId
}/coders?branch=${item.pull_request_head}`}
to={`/projects/${item.is_original ? item.fork_project_user : owner}/${ item.is_original ? item.fork_project_identifier : projectsId }?branch=${item.pull_request_head}`}
className="maxW200px hide-1 ver-middle"
>
{item.is_original
@ -118,7 +116,7 @@ class MergeItem extends Component {
</span>
<Tag className="pr-branch-tag">
<Link
to={`/projects/${projectsId}/coders?branch=${item.pull_request_base}`}
to={`/projects/${owner}/${projectsId}?branch=${item.pull_request_base}`}
className="maxW200px hide-1 ver-middle"
>
{/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */}
@ -158,7 +156,7 @@ class MergeItem extends Component {
{item.journals_count ? (
<Link
className="mr5 color-grey-8"
to={`/projects/${projectsId}/merge/${item.pull_request_id}/Messagecount`}
to={`/projects/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
>
<i className="iconfont icon-huifu1 font-15 mr5 ver-middle"></i>
{item.journals_count}
@ -179,7 +177,7 @@ class MergeItem extends Component {
>
<div className="grid-item mr15 color-grey-9">
<Link
to={`/projects/${projectsId}/merge/${item.pull_request_id}/updatemerge`}
to={`/projects/${owner}/${projectsId}/merge/${item.pull_request_id}/updatemerge`}
className="color-grey-9"
>
<i className="iconfont icon-bianji3 font-14 mr5"></i>

View File

@ -37,8 +37,8 @@ class MergeSubmit extends Component{
getDetail=()=>{
const { projectsId , mergeId} = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
const { projectsId , mergeId, owner} = this.props.match.params;
const url = `/projects/${owner}/${projectsId}/pull_requests/${mergeId}.json`;
axios.get(url).then((result)=>{
if(result){
this.setState({
@ -53,8 +53,8 @@ class MergeSubmit extends Component{
//获取提交列表
getCommitList=(branch , page , limit)=>{
const { projectsId } = this.props.match.params;
const url = `/repositories/${projectsId}/commits.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/commits.json`;
axios.get(url,{
params:{
sha:branch,

View File

@ -50,8 +50,8 @@ class MessageCount extends Component {
};
getDetail = () => {
const { projectsId, mergeId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
const { projectsId, mergeId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/pulls/${mergeId}.json`;
axios
.get(url)
.then((result) => {
@ -76,8 +76,8 @@ class MessageCount extends Component {
//关闭任务
closedetail = () => {
this.setState({ isSpin: true });
const { projectsId, mergeId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeId}/refuse_merge.json`;
const { projectsId, mergeId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/pulls/${mergeId}/refuse_merge.json`;
axios
.post(url)
.then((result) => {
@ -105,9 +105,9 @@ class MessageCount extends Component {
this.setState({
SpinMerge: true,
});
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { data, title, body, mergekey, pr_status } = this.state;
const url = `/projects/${projectsId}/pull_requests/${data.pull_request.id}/pr_merge.json`;
const url = `/${owner}/${projectsId}/pulls/${data.pull_request.id}/pr_merge.json`;
axios
.post(url, {
project_id: projectsId,
@ -195,11 +195,11 @@ class MessageCount extends Component {
};
commentCtx = (v) => {
return <RenderHtml className="break_word_comments" value={v} />;
return <RenderHtml className="break_word_comments imageLayerParent" value={v} />;
};
render() {
const { projectsId, mergeId } = this.props.match.params;
const { projectsId, mergeId , owner } = this.props.match.params;
const {
data,
@ -258,7 +258,7 @@ class MessageCount extends Component {
<div className="mt15">
<Tag className="pr-branch-tag">
<Link
to={`/projects/${data.pull_request.is_original?data.pull_request.fork_project_id:projectsId}/coders?branch=${data.pull_request.head}`}
to={`/projects/${owner}/${data.pull_request.is_original?data.pull_request.fork_project_id:projectsId}?branch=${data.pull_request.head}`}
className="ver-middle"
>
{data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}:{data.pull_request.head}
@ -273,7 +273,7 @@ class MessageCount extends Component {
</span>
<Tag className="pr-branch-tag">
<Link
to={`/projects/${projectsId}/coders?branch=${data.pull_request.base}`}
to={`/projects/${owner}/${projectsId}?branch=${data.pull_request.base}`}
className="ver-middle"
>
{/* {data.pull_request.is_fork ? data.pull_request.base : `${data.pull_request.pull_request_user}:${data.pull_request.base}`} */}
@ -359,7 +359,7 @@ class MessageCount extends Component {
<Button
type="success"
ghost
href={`/projects/${projectsId}/merge/${mergeId}/UpdateMerge`}
onClick={()=>{this.props.history.push(`/projects/${owner}/${projectsId}/pulls/${mergeId}/UpdateMerge`);}}
>
编辑
</Button>

View File

@ -16,6 +16,7 @@ class NewMerge extends Component {
merge_projects: undefined,
merge: "master",
pull: "master",
id: undefined,
is_fork: false,
projects_names: undefined,
isSpin: false,
@ -36,7 +37,9 @@ class NewMerge extends Component {
//获取新建分枝数据
getmergelist = (projectsId) => {
this.setState({isSpin: true})
const url = `/projects/${projectsId}/pull_requests/new.json`;
const { owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/pulls/new.json`;
axios
.get(url)
.then((result) => {
@ -48,9 +51,10 @@ class NewMerge extends Component {
branches: result.data.branches,
merge_branches: result.data.branches,
project_id: result.data.project_id,
id: result.data.id
});
this.set_default_pull()
this.set_default_merge()
this.set_default_pull(result.data.branches);
this.set_default_merge(result.data.merge_projects);
}
this.setState({isSpin: false})
})
@ -60,45 +64,54 @@ class NewMerge extends Component {
});
};
set_default_pull = () => {
const {branches} = this.state;
let default_pull = branches.filter((e) => e.name === "master")
if (default_pull.length > 0){
this.state.pull = default_pull[0].name
}else{
this.state.pull = "master"
set_default_pull = (branches) => {
if(branches && branches.length>0){
let default_pull = branches.filter((e) => e.name === "master")
if (default_pull.length > 0){
this.setState({
pull:default_pull[0].name
})
}else{
this.setState({
pull:"master"
})
}
}
}
set_default_merge = () => {
const {merge_branches} = this.state;
let default_merge = merge_branches.filter((e) => e.name === "master")
if (default_merge.length > 0){
this.state.merge = default_merge[0].name
}else{
this.state.merge = "master"
set_default_merge = (merge_branches) => {
if(merge_branches && merge_branches.length){
let default_merge = merge_branches.filter((e) => e.name === "master")
if (default_merge.length > 0){
this.setState({
merge:default_merge[0].name
})
}else{
this.setState({
merge:"master"
})
}
this.ischeckmerge();
}
this.ischeckmerge();
}
newMergelist = (projectsId) => {
newMergelist = (login,id) => {
this.setState({isSpin: true})
const url = `/projects/${projectsId}/pull_requests/get_branches.json`;
axios
.get(url)
.then((result) => {
if (result) {
this.setState({
merge_branches: result.data
})
this.set_default_merge()
}
this.setState({isSpin: false})
})
.catch((error) => {
this.setState({isSpin: false})
console.log(error);
});
const url = `/${login}/${id}/pulls/get_branches.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
merge_branches: result.data
})
this.set_default_merge(result.data)
}
this.setState({isSpin: false})
})
.catch((error) => {
this.setState({isSpin: false})
console.log(error);
});
};
selectBrach = (type, value) => {
@ -107,20 +120,24 @@ class NewMerge extends Component {
};
selectProjectName = (value) => {
const { project_id, projects_names } = this.state;
let is_fork_id = parseInt(value) !== parseInt(project_id)
console.log("value",value)
const { project_id, projects_names,id } = this.state;
const { owner } = this.props.match.params;
let arr = projects_names && projects_names.filter(item=>item.id===value);
let identifier = arr && arr[0].project_id;
let login = arr && arr[0].project_user_login;
let is_fork_id = parseInt(value) !== parseInt(id)
this.setState({
isSpin: true,
merge_head: is_fork_id,
data: {
is_original: is_fork_id,
fork_project_id: is_fork_id ? project_id : "",
fork_project_id: is_fork_id ? id : "",
merge_user_login: is_fork_id ? projects_names[0].project_user_login : undefined
}
})
this.props.history.push(`/projects/${value}/merge/new`);
this.newMergelist(value);
this.props.history.push(`/projects/${login}/${identifier}/pulls/new`);
this.newMergelist(login,identifier);
};
@ -128,42 +145,41 @@ class NewMerge extends Component {
ischeckmerge = () => {
this.setState({ isSpin: true });
const { projectsId } = this.props.match.params;
const { pull, merge, project_id, merge_head } = this.state;
const url = `/projects/${projectsId}/pull_requests/check_can_merge.json`;
axios
.post(url, {
head: pull,
base: merge,
is_original: merge_head,
fork_project_id: merge_head ? project_id : undefined
})
.then((result) => {
if (result) {
if (result.data.status === 0) {
this.setState({
isSpin: false,
show_message: false,
});
} else {
this.setState({
isSpin: false,
show_message: true,
default_message: result.data.message,
});
}
const { projectsId , owner } = this.props.match.params;
const { pull, merge, project_id, merge_head, id } = this.state;
const url = `/${owner}/${projectsId}/pulls/check_can_merge.json`;
axios.post(url, {
head: pull,
base: merge,
is_original: merge_head,
fork_project_id: merge_head ? id : undefined
})
.then((result) => {
if (result) {
if (result.data.status === 0) {
this.setState({
isSpin: false,
show_message: false,
});
} else {
this.setState({
isSpin: false,
show_message: true,
default_message: "出现错误了",
default_message: result.data.message,
});
}
})
.catch((error) => {
this.setState({ isSpin: false, show_message: true });
console.log(error);
});
} else {
this.setState({
isSpin: false,
show_message: true,
default_message: "出现错误了",
});
}
})
.catch((error) => {
this.setState({ isSpin: false, show_message: true });
console.log(error);
});
};
render() {
@ -200,7 +216,7 @@ class NewMerge extends Component {
if (list && list.length > 0) {
return list.map((item, key) => {
return (
<Option key={key + 1} value={item.project_id}>
<Option key={key + 1} value={item.id}>
{item.project_name}
</Option>
);
@ -211,7 +227,9 @@ class NewMerge extends Component {
const withHtml = (html) => {
return <div dangerouslySetInnerHTML={{ __html: html }}></div>;
};
let { project } = this.props;
console.log("222 ",project);
console.log("222111 ",projects_names);
return (
<div>
<div className="main">
@ -221,9 +239,10 @@ class NewMerge extends Component {
<div className="color-grey-3 mb10 fwb">源分支:</div>
<Input.Group compact className="display-flex">
<Select
defaultValue={parseInt(projectsId)}
defaultValue={project && project.id}
class=" maxW50 hide-1 task-hide"
disabled
style={{maxWidth:"200px"}}
>
{renderProjectNames(projects_names)}
</Select>
@ -247,9 +266,10 @@ class NewMerge extends Component {
<div className="color-grey-3 mb10 fwb">目标分支:</div>
<Input.Group compact className="display-flex">
<Select
defaultValue={parseInt(projectsId)}
defaultValue={project && project.id}
class=" maxW50 hide-1 task-hide"
onSelect={(e) => this.selectProjectName(e)}
style={{maxWidth:"200px"}}
>
{renderProjectNames(merge_projects)}
</Select>
@ -281,9 +301,6 @@ class NewMerge extends Component {
)}
</Spin>
</div>
{/* <div className=" main">
<MergeFooter footer_type="new" {...this.props}></MergeFooter>
</div> */}
</div>
);
}

View File

@ -24,8 +24,8 @@ class UpdateMerge extends Component {
//获取新建分枝数据
getmergelist = () => {
this.setState({ isSpin: true });
const { projectsId, mergeId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeId}/edit.json`;
const { projectsId, mergeId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/pulls/${mergeId}/edit.json`;
axios
.get(url)
.then((result) => {

View File

@ -66,9 +66,9 @@ class merge extends Component {
};
getSelectList = () => {
const { projectsId } = this.props.match.params;
const { projectsId,owner } = this.props.match.params;
const url = `/projects/${projectsId}/issues/index_chosen.json`;
const url = `/${owner}/${projectsId}/issues/index_chosen.json`;
axios
.get(url)
.then((result) => {
@ -86,25 +86,23 @@ class merge extends Component {
// 获取列表数据
getIssueList = () => {
const { select_params } = this.state;
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests.json`;
axios
.get(url, {
params: select_params,
})
.then((result) => {
if (result) {
this.setState({
data: result.data,
issues: result.data.issues,
search_count: result.data.search_count,
isSpin: false,
});
}
})
.catch((error) => {
console.log(error);
});
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/pulls.json`;
axios.get(url, {
params: select_params,
}).then((result) => {
if (result) {
this.setState({
data: result.data,
issues: result.data.issues,
search_count: result.data.search_count,
isSpin: false,
});
}
})
.catch((error) => {
console.log(error);
});
};
getMenu = (e, id, name) => {
@ -218,16 +216,16 @@ class merge extends Component {
};
islogin() {
const { projectsId } = this.props.match.params;
const { projectsId,owner } = this.props.match.params;
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog();
return;
} else {
this.props.history.push(`/projects/${projectsId}/merge/new`);
this.props.history.push(`/projects/${owner}/${projectsId}/pulls/new`);
}
}
render() {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const {
issue_chosen,
issues,
@ -275,7 +273,7 @@ class merge extends Component {
);
return (
<div className="main">
<div className="topWrapper">
<div className="topWrapper" style={{borderBottom:"1px solid #eee"}}>
<div className="target-detail-search">
<Search
placeholder="输入关键字搜索合并请求"
@ -409,7 +407,7 @@ class merge extends Component {
</div>
{data && data.search_count && data.search_count > 0 ? (
<div style={{minHeight:"400px"}}>
<div style={{minHeight:"470px"}}>
<Spin spinning={isSpin}>
<OrderItem
issues={issues}
@ -425,63 +423,8 @@ class merge extends Component {
</Spin>
</div>
) : (
<NoneData _html="暂时还没有相关数据哦!" projectsId={projectsId} />
<NoneData _html="暂时还没有相关数据哦!" projectsId={projectsId} owner={owner} />
)}
{/* <div className="topWrapper" style={{ borderBottom: "none" }}>
<p className="topWrapper_type_infos">
<li className={status_type === "1" ? "active" : ""} onClick={() => this.openorder("1")}>{data && data.open_count ? data.open_count : 0}个开启中</li>
<li className={status_type === "2" ? "active" : ""} onClick={() => this.openorder("2")}>{data && data.close_count ? data.close_count : 0}个已关闭</li>
</p>
<div className="topWrapper_select">
<div>
<Search
placeholder="搜索"
enterButton
onSearch={this.searchFunc}
style={{ width: 300 }}
/>
</div>
<a className="topWrapper_btn ml10" onClick={() => this.islogin()}>创建合并请求</a>
</div>
</div>
<div className="f-wrap-between pb20" style={{borderBottom:"1px dashed #ddd"}}>
<div></div>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag, '标签', 'issue_tag_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.issue_tag_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_version, '里程碑', 'fixed_version_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.fixed_version_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '指派人', 'assigned_to_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.assigned_to_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={menu} trigger={['click']} placement="bottomCenter">
<span>{this.state.paix}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
</ul>
</div>
{
data && data.search_count && data.search_count > 0 ?
<div>
<Spin spinning={isSpin}>
<OrderItem issues={issues} search_count={search_count} page={select_params.page} limit={select_params.limit} {...this.props} {...this.state}></OrderItem>
{Paginations}
</Spin>
</div>
:
<NoneData _html="暂时还没有相关数据哦!" />
} */}
</div>
);
}

View File

@ -46,10 +46,10 @@ class MergeForm extends Component {
// }
// };
get_default_selects = () => {
const { projectsId } = this.props.match.params;
const { projectsId ,owner } = this.props.match.params;
this.setState({ isSpin: true });
axios
.get(`/projects/${projectsId}/pull_requests/create_merge_infos.json`)
.get(`/${owner}/${projectsId}/pulls/create_merge_infos.json`)
.then((result) => {
if (result) {
this.setState({
@ -137,7 +137,7 @@ class MergeForm extends Component {
});
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId, mergeId } = this.props.match.params;
const { projectsId, mergeId , owner } = this.props.match.params;
const { merge, pull, merge_type, data } = this.props;
if (values.issue_tag_ids && values.issue_tag_ids.length > 0) {
values.issue_tag_ids = [parseInt(values.issue_tag_ids)];
@ -146,66 +146,65 @@ class MergeForm extends Component {
}
const { desc } = this.state;
if (merge_type === "new") {
let url = `/projects/${projectsId}/pull_requests.json`;
axios
.post(url, {
...values,
body: desc,
head: pull,
base: merge,
is_original: data && data.is_original,
fork_project_id: data && data.fork_project_id,
merge_user_login: data && data.merge_user_login
})
.then((result) => {
if (result) {
this.setState({
isSpin: false,
});
this.props.history.push(`/projects/${projectsId}/merge`);
const { getDetail } = this.props;
getDetail && getDetail();
} else {
this.setState({
isSpin: false,
});
}
})
.catch((error) => {
let url = `/${owner}/${projectsId}/pulls.json`;
axios.post(url, {
...values,
body: desc,
head: pull,
base: merge,
is_original: data && data.is_original,
fork_project_id: data && data.fork_project_id,
merge_user_login: data && data.merge_user_login
})
.then((result) => {
if (result) {
this.setState({
isSpin: false,
});
console.log(error);
});
} else {
let url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
axios
.put(url, {
...values,
body: desc,
head: pull,
base: merge,
})
.then((result) => {
if (result) {
this.setState({
isSpin: false,
});
this.props.history.push(
`/projects/${projectsId}/merge/${mergeId}/Messagecount`
);
} else {
this.setState({
isSpin: false,
});
}
})
.catch((error) => {
this.props.history.push(`/projects/${owner}/${projectsId}/pulls`);
const { getDetail } = this.props;
getDetail && getDetail();
} else {
this.setState({
isSpin: false,
});
console.log(error);
}
})
.catch((error) => {
this.setState({
isSpin: false,
});
console.log(error);
});
} else {
let url = `/${owner}/${projectsId}/pulls/${mergeId}.json`;
axios
.put(url, {
...values,
body: desc,
head: pull,
base: merge,
})
.then((result) => {
if (result) {
this.setState({
isSpin: false,
});
this.props.history.push(
`/projects/${owner}/${projectsId}/pulls/${mergeId}/Messagecount`
);
} else {
this.setState({
isSpin: false,
});
}
})
.catch((error) => {
this.setState({
isSpin: false,
});
console.log(error);
});
}
} else {
this.setState({
@ -224,7 +223,7 @@ class MergeForm extends Component {
render() {
const { merge_type, data } = this.props;
const { getFieldDecorator } = this.props.form;
const { projectsId, mergeId } = this.props.match.params;
const { projectsId, mergeId ,owner } = this.props.match.params;
const {
issue_tag_ids,
fixed_version_id,
@ -283,11 +282,9 @@ class MergeForm extends Component {
<Button
type="default"
className="ml30"
href={
merge_type === "new"
? `/projects/${projectsId}/merge`
: `/projects/${projectsId}/merge/${mergeId}/detail`
}
onClick={()=>{
this.props.history.push(merge_type === "new" ? `/projects/${owner}/${projectsId}/pulls` : `/projects/${owner}/${projectsId}/pulls/${mergeId}/detail`)
}}
>
<span className="plr10">取消</span>
</Button>

View File

@ -2,7 +2,7 @@ import React , { Component } from 'react';
import { Link } from "react-router-dom";
class Nodata extends Component{
render(){
const { _html, projectsId } = this.props;
const { _html, projectsId , owner } = this.props;
return(
<div className="none_panels">
<div>
@ -12,7 +12,7 @@ class Nodata extends Component{
<h3>欢迎使用合并请求</h3>
<div className="color-grey-8">
合并请求可以帮助您与他人协作编写代码在使用之前请先创建一个 <Link className="color-blue" to={`/projects/${projectsId}/merge/new`}>合并请求</Link>
合并请求可以帮助您与他人协作编写代码在使用之前请先创建一个 <Link className="color-blue" to={`/projects/${owner}/${projectsId}/pulls/new`}>合并请求</Link>
</div>
</div>
</div>

View File

@ -150,7 +150,7 @@ class Index extends Component {
isSpin: false
})
this.props.showNotification(`${projectsType === "deposit" ? "托管" : "镜像"}项目创建成功!`);
this.props.history.push(`/projects/${result.data.id}/coders`);
this.props.history.push(`/projects/${current_user && current_user.login}/${result.data.identifier}`);
}
}
}).catch((error) => {

View File

@ -32,13 +32,13 @@ class UserSubmitComponent extends Component {
// 提交变更
subMitFrom = () => {
const { filepath, content, editor_type } = this.props;
const { branch, projectsId } = this.props.match.params;
const { branch, projectsId , owner } = this.props.match.params;
const { submitType, filename } = this.state;
this.setState({ isSpin: true });
let path = editor_type === "upload" ? filepath : filepath.substr(1);
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const url = `/repositories/${projectsId}/create_file.json`;
const url = `/${owner}/${projectsId}/create_file.json`;
axios.post(url, {
filepath: filename ? filename : path,
branch: branch,
@ -55,8 +55,8 @@ class UserSubmitComponent extends Component {
getTopCount && getTopCount(values.branchname);
}
let url = values.branchname
? `/projects/${projectsId}/coders?branch=${values.branchname}`
: `/projects/${projectsId}/coders`;
? `/projects/${owner}/${projectsId}?branch=${values.branchname}`
: `/projects/${owner}/${projectsId}`;
this.props.history.push(url);
}
})
@ -74,9 +74,9 @@ class UserSubmitComponent extends Component {
UpdateFile = () => {
this.setState({ isSpin: true });
const { branch, detail, content, filepath } = this.props;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { submitType } = this.state;
const url = `/repositories/${projectsId}/update_file.json`;
const url = `/${owner}/${projectsId}/update_file.json`;
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
axios
@ -92,8 +92,8 @@ class UserSubmitComponent extends Component {
this.setState({ isSpin: false });
if (result.data && result.data.status === 1) {
let url = values.branchname
? `/projects/${projectsId}/coders?branch=${values.branchname}`
: `/projects/${projectsId}/coders`;
? `/projects/${owner}/${projectsId}?branch=${values.branchname}`
: `/projects/${owner}/${projectsId}`;
this.props.history.push(url);
this.props.showNotification("修改成功!");
@ -113,22 +113,16 @@ class UserSubmitComponent extends Component {
const { submitType, filename, isSpin } = this.state;
const { getFieldDecorator } = this.props.form;
const { branch, projectsId } = this.props.match.params;
const { branch, projectsId , owner } = this.props.match.params;
const { current_user, filepath, projectDetail } = this.props;
const { editor_type } = this.props;
return (
<div>
<span className="df mt30" style={{ alignItems: "center" }}>
<Link
to={`/users/${current_user && current_user.login}`}
className="show-user-link"
>
<Link to={`/users/${current_user && current_user.login}`} className="show-user-link" >
<img
src={getImageUrl(
`images/${current_user && current_user.image_url}`
)}
src={getImageUrl(`images/${current_user && current_user.image_url}`)}
alt=""
className="screwImg"
/>
@ -136,7 +130,6 @@ class UserSubmitComponent extends Component {
{current_user && current_user.username}
</span>
</Link>
<span className="color-grey-8">提交变更</span>
</span>
<Spin spinning={isSpin}>
@ -153,10 +146,8 @@ class UserSubmitComponent extends Component {
})(
<div className="setInputAddon">
<Input
addonBefore={`/${
projectDetail && projectDetail.identifier
}/`}
value={filename ? filename : filepath}
addonBefore={`/${ projectDetail && projectDetail.identifier }/`}
value={filename || filepath}
onChange={this.changeFileName}
placeholder="文件路径..."
/>
@ -228,7 +219,7 @@ class UserSubmitComponent extends Component {
<Button
type="primary grey"
onClick={() => {
this.props.history.push(`/projects/${projectsId}/coders`);
this.props.history.push(`/projects/${owner}/${projectsId}`);
}}
className="mr20"
>

View File

@ -27,7 +27,7 @@ class UploadFile extends Component {
const { pathname } = this.props.location;
const { filename, editorValue, attachment_clean } = this.state;
const urlroot = pathname.split("uploadfile/")[1];
const file_path = !urlroot ? `${filename}` : `${urlroot}/${filename}`;
const file_path = !urlroot ? filename : `${urlroot}/${filename}`;
return (
<React.Fragment>

View File

@ -3,7 +3,7 @@ import { Link } from "react-router-dom";
import axios from "axios";
import { getImageUrl } from "educoder";
import { Form , Popconfirm , Tag , Spin } from "antd";
import { Form, Popconfirm, Tag, Spin } from "antd";
import Attachments from "../Upload/attachment";
import RenderHtml from "../../components/render-html";
import Comments from "../comments/comments";
@ -44,15 +44,15 @@ class Detail extends Component {
};
getDetail = () => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
const { projectsId, orderId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/${orderId}.json`;
axios
.get(url)
.then((result) => {
if (result) {
this.setState({
data: result.data,
isSpins:false
isSpins: false
});
}
})
@ -74,8 +74,8 @@ class Detail extends Component {
//删除任务信息
deletedetail = (id) => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
const { projectsId, orderId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/${orderId}.json`;
axios
.delete(url, {
data: {
@ -85,7 +85,7 @@ class Detail extends Component {
})
.then((result) => {
if (result) {
this.props.history.push(`/projects/${projectsId}/orders`);
this.props.history.push(`/projects/${owner}/${projectsId}/issues`);
}
})
.catch((error) => {
@ -95,8 +95,8 @@ class Detail extends Component {
//关闭任务
closedetail = (id) => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/close_issue.json`;
const { projectsId, orderId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/${orderId}/close_issue.json`;
axios
.post(url, {
project_id: projectsId,
@ -122,8 +122,8 @@ class Detail extends Component {
//复制
copydetail = () => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/copy.json`;
const { projectsId, orderId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/${orderId}/copy.json`;
axios
.post(url, {
project_id: projectsId,
@ -132,7 +132,7 @@ class Detail extends Component {
.then((result) => {
if (result) {
this.props.history.push(
`/projects/${projectsId}/orders/${result.data.issue_id}/copyetail`
`/projects/${owner}/${projectsId}/issues/${result.data.issue_id}/copyetail`
);
}
})
@ -182,12 +182,12 @@ class Detail extends Component {
};
commentCtx = (v) => {
return <RenderHtml className="break_word_comments" value={v} />;
return <RenderHtml className="break_word_comments imageLayerParent" value={v} />;
};
render() {
const { projectsId, orderId } = this.props.match.params;
const { data , isSpins } = this.state;
const { projectsId, orderId, owner } = this.props.match.params;
const { data, isSpins } = this.state;
const get_color = (type) => {
if (type === "高") {
return "#e67e22";
@ -269,15 +269,15 @@ class Detail extends Component {
</Popconfirm>
<Link
to={`/projects/${projectsId}/orders/${orderId}/updatedetail`}
to={`/projects/${owner}/${projectsId}/issues/${orderId}/updatedetail`}
className="color-blue fr"
>
编辑
</Link>
</span>
) : (
""
)}
""
)}
</div>
</div>
</div>
@ -286,8 +286,8 @@ class Detail extends Component {
{data && data.description && data.description.length > 0 ? (
this.commentCtx(data.description)
) : (
<span className="color-grey-9 ml3 mr3">没有描述</span>
)}
<span className="color-grey-9 ml3 mr3">暂无描述</span>
)}
</div>
{data && data.attachments && data.attachments.length > 0 ? (
<Attachments
@ -295,8 +295,8 @@ class Detail extends Component {
showNotification={this.props.showNotification}
/>
) : (
""
)}
""
)}
</div>
</div>
@ -307,77 +307,66 @@ class Detail extends Component {
/>
</div>
<div className="list-left list-left-padding">
<div className="list-right-item-padding background-f boder-4">
<p className="grid-item-left pb15">
<span className="issue_detail_info">分支:</span>
<span>{data && data.branch_name ? data.branch_name : "--"}</span>
</p>
{/* <p className="grid-item pb15">
<span className="issue_detail_info">是否上链:</span>
<span>{data && data.issue_type==="2" ? '是' : "--"}</span>
</p>
{
data && data.issue_type==="2" &&
<p className="grid-item pb15">
<span className="issue_detail_info">token值:</span>
<span>{data && data.token ? data.token : "--"}</span>
</p>
} */}
<p className="grid-item-left pb15">
<span className="issue_detail_info">标签:</span>
<span>
{data && data.issue_tags ? (
<span className="grid-item">
<span
className="tagColor"
style={{ background: data.issue_tags[0].color }}
></span>
{data.issue_tags[0].name}
</span>
) : (
"--"
)}
</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">里程碑:</span>
<span className="title_overflow">
{data && data.version ? data.version : "--"}
</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">状态:</span>
<span>
{data && data.issue_status ? data.issue_status : "--"}
</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">分类:</span>
<span>{data && data.tracker ? data.tracker : "--"}</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">负责人:</span>
<span>
{data && data.assign_user_name ? data.assign_user_name : "--"}
</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">开始日期:</span>
<span>{data && data.start_date ? data.start_date : "--"}</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">结束日期:</span>
<span>{data && data.due_date ? data.due_date : "--"}</span>
</p>
<div className="list-right-item-padding background-f boder-4">
<p className="grid-item-left pb15">
<span className="issue_detail_info">分支:</span>
<span>{data && data.branch_name ? data.branch_name : "--"}</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">标签:</span>
<span>
{data && data.issue_tags ? (
<span className="grid-item">
<span
className="tagColor"
style={{ background: data.issue_tags[0].color }}
></span>
{data.issue_tags[0].name}
</span>
) : (
"--"
)}
</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">里程碑:</span>
<span className="title_overflow">
{data && data.version ? data.version : "--"}
</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">状态:</span>
<span>
{data && data.issue_status ? data.issue_status : "--"}
</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">分类:</span>
<span>{data && data.tracker ? data.tracker : "--"}</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">负责人:</span>
<span>
{data && data.assign_user_name ? data.assign_user_name : "--"}
</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">开始日期:</span>
<span>{data && data.start_date ? data.start_date : "--"}</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">结束日期:</span>
<span>{data && data.due_date ? data.due_date : "--"}</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">完成度:</span>
<span>{data && data.done_ratio ? data.done_ratio : "--"}</span>
</p>
<p className="grid-item-left pb15">
<span className="issue_detail_info">完成度:</span>
<span>{data && data.done_ratio ? data.done_ratio : "--"}</span>
</p>
</div>
</div>
</div>
</div>
</Spin>
</Spin>
);
}
}

View File

@ -31,9 +31,9 @@ class Milepost extends Component {
}
getList = (page, status, order_type, order_name) => {
const { projectsId } = this.props.match.params;
const { projectsId ,owner } = this.props.match.params;
const { limit } = this.state;
const url = `/projects/${projectsId}/versions.json`;
const url = `/${owner}/${projectsId}/milestones.json`;
axios.get(url, {
params: {
projectsId, page, limit, status, order_type, order_name
@ -75,8 +75,8 @@ class Milepost extends Component {
}
updatestatusemile = (status, arr) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/versions/${arr.id}/update_status.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/milestones/${arr.id}/update_status.json`;
const { current_user } = this.props;
axios.post(url, {
project_id: projectsId,
@ -98,8 +98,8 @@ class Milepost extends Component {
}
closemile = (arr) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/versions/${arr.id}.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/milestones/${arr.id}.json`;
axios.delete(url, {
data: {
project_id: projectsId,
@ -148,7 +148,7 @@ class Milepost extends Component {
render() {
const { data, limit, page, openselect, closeselect, spinings } = this.state;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const menu = (
<Menu onClick={this.arrayList}>
<Menu.Item key={'created_on'} value="desc">到期日从近到远</Menu.Item>
@ -169,7 +169,7 @@ class Milepost extends Component {
<span>里程碑{data && data.issue_tags_count}已创建</span>
</div>
</div>
<div className="topWrapper">
<div className="topWrapper" style={{borderBottom:"1px solid #eee"}}>
<div className="topWrapper_type_infos">
<li className={openselect ? "active" : ""} onClick={() => this.opneMilelist(1)}>{data && data.open_count}个开启中</li>
<li className={closeselect ? "active" : ""} onClick={() => this.opneMilelist(2)}>{data && data.closed_count}个已关闭</li>
@ -184,7 +184,7 @@ class Milepost extends Component {
</ul>
{
data && data.user_admin_or_member ?
<Link to={`/projects/${projectsId}/orders/meilpost`} className="topWrapper_btn">新的里程碑</Link>
<Link to={`/projects/${owner}/${projectsId}/milestones/new`} className="topWrapper_btn">新的里程碑</Link>
: ''
}
</div>
@ -201,7 +201,7 @@ class Milepost extends Component {
<div className="milepostwidth">
<div className="grid-item width100">
<i className="iconfont icon-lubiaosignpost3 font-12 mr3"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/MilepostDetail`} className="font-16">{item.name}</Link>
<Link to={`/projects/${owner}/${projectsId}/milestones/${item.id}`} className="font-16">{item.name}</Link>
</div>
</div>
</div>
@ -223,15 +223,15 @@ class Milepost extends Component {
{
data && data.user_admin_or_member ?
<div className="milepostleft">
<div className="grid-item mr15 color-grey-9">
<div className="grid-item ml15 color-grey-9">
<i className="iconfont icon-bianji3 font-14 mr5"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/meilpost`} className="color-grey-9">编辑</Link>
<Link to={`/projects/${owner}/${projectsId}/milestones/${item.id}/edit`} className="color-grey-9">编辑</Link>
</div>
<div className="grid-item mr15 color-grey-9">
<div className="grid-item ml15 color-grey-9">
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
<a onClick={() => this.updatestatusemile(this.state.status === "closed" ? "open" : "closed", item)} className="color-grey-9">{this.state.status === "closed" ? "开启" : "关闭"}</a>
</div>
<div className="grid-item mr15 color-grey-9">
<div className="grid-item ml15 color-grey-9">
<i className="iconfont icon-lajitong font-14 mr5" ></i>
<Popconfirm placement="bottom" title={'是否删除里程碑?'} okText="是" cancelText="否" onConfirm={() => this.closemile(item)}>
<a className="color-grey-9">删除</a>

View File

@ -2,6 +2,7 @@ import React, { Component } from "react";
import { Link } from 'react-router-dom';
import { Dropdown, Menu, Icon, Pagination, Spin } from 'antd';
import './order.css';
import { FlexAJ } from '../Component/layout'
import NoneData from '../Nodata';
import OrderItem from './OrderItem';
@ -55,8 +56,8 @@ class MilepostDetail extends Component {
}
getSelectList = () => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/index_chosen.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/index_chosen.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
@ -70,10 +71,10 @@ class MilepostDetail extends Component {
// 获取列表数据
getIssueList = ( page , item , value , update , updateValue , type ) => {
const { projectsId, meilid } = this.props.match.params;
const { projectsId, meilid , owner } = this.props.match.params;
const { limit , order_name , order_type , issue_tag_id , author_id , assigned_to_id , tracker_id , status_id , done_ratio , status_type } = this.state;
const url = `/projects/${projectsId}/versions/${meilid}.json`;
const url = `/${owner}/${projectsId}/milestones/${meilid}.json`;
let params = update ? {
page, limit , order_name:value , order_type:updateValue , issue_tag_id ,
author_id , assigned_to_id , tracker_id , status_id , done_ratio,
@ -187,7 +188,7 @@ class MilepostDetail extends Component {
render() {
const { issue_chosen, issues, limit, page, search_count, data, isSpin , status_type } = this.state;
const { projectsId, meilid } = this.props.match.params;
const { projectsId, meilid ,owner} = this.props.match.params;
const menu = (
<Menu onClick={(e) => this.getOption(e)}>
@ -198,92 +199,94 @@ class MilepostDetail extends Component {
</Menu>
)
return (
<div className="main">
<div className="miledetail mb20">
<div className="topmilepost">
<p className="font-18">{data && data.name}</p>
<div className="milepostdiv">
<Link to={`/projects/${projectsId}/orders/${meilid}/meilpost`} className="topWrapper_btn" style={{ marginRight: 15 }} >编辑里程碑</Link>
<Link to={`/projects/${projectsId}/orders/${meilid}/new`} className="topWrapper_btn">创建任务</Link>
</div>
</div>
<div className="grid-item mr10">
<span className="mr10">
<i className="iconfont icon-rili font-14 mr5">
</i>
{
data && data.effective_date ?
<span >{data && data.effective_date}</span>
:
<span >暂无截止时间</span>
}
<div className="main" style={{padding:"0px"}}>
<div className="miledetail">
<p className="font-20">{data && data.name}</p>
<FlexAJ>
<span className="mt7">
<span className="mr10">
<i className="iconfont icon-rili font-14 mr5">
</i>
{
data && data.effective_date ?
<span >{data && data.effective_date}</span>
:
<span >暂无截止时间</span>
}
</span>
<span className="font-weight-bold">{data && data.percent && data.percent.toFixed(2)}%完成 </span>
</span>
<span className="font-weight-bold">
{data && data.percent.toFixed(2)}%完成
</span>
</div>
<div className="milepostdiv">
<Link to={`/projects/${owner}/${projectsId}/milestones/${meilid}/edit`} className="topWrapper_btn" style={{ marginRight: 15 }} >编辑里程碑</Link>
<Link to={`/projects/${owner}/${projectsId}/issues/${meilid}/new`} className="topWrapper_btn">创建任务</Link>
</div>
</FlexAJ>
</div>
<Spin spinning={isSpin}>
<div className="f-wrap-between pb20 bor-bottom-greyE">
<ul className="topWrapper_type_infos">
<li className={status_type==="1" ? "active" : ""} onClick={() => this.openorder("1")}>{data && data.open_issues_count}个开启中</li>
<li className={status_type==="2" ? "active" : ""} onClick={() => this.openorder("2")}>{data && data.close_issues_count}个已关闭</li>
</ul>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag, '标签', 'issue_tag_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.issue_tag_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '发布人', 'author_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.author_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '负责人', 'assigned_to_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.assigned_to_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.tracker, '类型', 'tracker_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.tracker_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_status, '状态', 'status_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.status_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.done_ratio, '完成度', 'done_ratio')} trigger={['click']} placement="bottomCenter">
<span>{this.state.done_ratios}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={menu} trigger={['click']} placement="bottomCenter">
<span>{this.state.paix}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
</ul>
<div className="pl20 pr20">
<div className="f-wrap-between pt15 pb15 bor-bottom-greyE">
<ul className="topWrapper_type_infos">
<li className={status_type==="1" ? "active" : ""} onClick={() => this.openorder("1")}>{data && data.open_issues_count}个开启中</li>
<li className={status_type==="2" ? "active" : ""} onClick={() => this.openorder("2")}>{data && data.close_issues_count}个已关闭</li>
</ul>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag, '标签', 'issue_tag_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.issue_tag_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '发布人', 'author_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.author_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '负责人', 'assigned_to_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.assigned_to_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.tracker, '类型', 'tracker_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.tracker_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_status, '状态', 'status_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.status_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.done_ratio, '完成度', 'done_ratio')} trigger={['click']} placement="bottomCenter">
<span>{this.state.done_ratios}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={menu} trigger={['click']} placement="bottomCenter">
<span>{this.state.paix}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
</ul>
</div>
<div className="setItemStyle">
{
search_count === 0 ?
<NoneData _html="暂时还没有相关数据哦!" />
:
issues && issues.length>0 && issues.map((item,key)=>{
return(
<OrderItem key={key} mile item={item} search_count={search_count} page={page} limit={limit} {...this.props} {...this.state}></OrderItem>
)
})
}
</div>
{
search_count > limit?
<div className="mt30 mb10 edu-txt-center">
<Pagination simple current={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>:""
}
</div>
{
search_count === 0 ?
<NoneData _html="暂时还没有相关数据哦!" />
:
issues && issues.length>0 && issues.map((item,key)=>{
return(
<OrderItem key={key} mile item={item} search_count={search_count} page={page} limit={limit} {...this.props} {...this.state}></OrderItem>
)
})
}
{
search_count > limit?
<div className="mt30 mb50 edu-txt-center">
<Pagination simple current={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>:""
}
</Spin>
</div>
)

View File

@ -19,7 +19,7 @@ class OrderItem extends Component {
render() {
const { data } = this.props;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
return (
<div>
@ -31,13 +31,12 @@ class OrderItem extends Component {
<div className="milepostwidth">
<div className="grid-item width100">
<i className="iconfont icon-lubiaosignpost3 font-12 mr3"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/MilepostDetail`} className="font-16">{item.name}</Link>
<Link to={`/projects/${owner}/${projectsId}/milestones/${item.id}`} className="font-16">{item.name}</Link>
</div>
</div>
</div>
<div className="milepostdiv" style={{ marginTop: 5 }}>
<div className="milepostrighe">
<div className="grid-item mr10">
<i className="iconfont icon-rili font-14 mr5">
</i>
@ -64,15 +63,15 @@ class OrderItem extends Component {
{
data.user_admin_or_member ?
<div className="milepostleft">
<div className="grid-item mr15 color-grey-9">
<div className="grid-item ml15 color-grey-9">
<i className="iconfont icon-bianji3 font-14 mr5"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/meilpost`} className="color-grey-9">编辑</Link>
<Link to={`/projects/${owner}/${projectsId}/milestones/${item.id}/edit`} className="color-grey-9">编辑</Link>
</div>
<div className="grid-item mr15 color-grey-9">
<div className="grid-item ml15 color-grey-9">
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
<a onClick={() => this.updatestatusemile(this.state.status === "closed" ? "open" : "closed", item)} className="color-grey-9">{this.state.status === "closed" ? "开启" : "关闭"}</a>
</div>
<div className="grid-item mr15 color-grey-9">
<div className="grid-item ml15 color-grey-9">
<i className="iconfont icon-lajitong font-14 mr5" ></i>
<Popconfirm placement="bottom" title={'是否删除里程碑?'} okText="是" cancelText="否" onConfirm={() => this.closemile(item)}>
<a className="color-grey-9">删除</a>

View File

@ -4,11 +4,11 @@ import './order.css'
class Nav extends Component{
render(){
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
return(
<p className="topWrapper_nav">
<NavLink activeClassName="active" className="issue-type-button" to={`/projects/${projectsId}/orders/tags`}>标签</NavLink>
<NavLink activeClassName="active" className="issue-type-button" to={`/projects/${projectsId}/orders/Milepost`}>里程碑</NavLink>
<NavLink activeClassName="active" className="issue-type-button" to={`/projects/${owner}/${projectsId}/issues/tags`}>标签</NavLink>
<NavLink activeClassName="active" className="issue-type-button" to={`/projects/${owner}/${projectsId}/milestones`}>里程碑</NavLink>
</p>
)
}

View File

@ -45,7 +45,7 @@ class OrderItem extends Component {
}
render() {
const { item , checkbox , mile } = this.props;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { current_user } = this.props
return (
@ -53,8 +53,8 @@ class OrderItem extends Component {
<div className="issueItem">
{current_user && current_user.login && checkbox}
<div className="flex-1">
<p className="mb15 df" style={{alignItems:"center"}}>
<Link to={`/projects/${projectsId}/orders/${item.id}/detail`} target="_blank" title={item.name} className="hide-1 font-16 color-grey-3 lineh-30 mr10" style={{maxWidth:"300px"}}>{item.name}</Link>
<p className="mb10 df" style={{alignItems:"center"}}>
<Link to={`/projects/${owner}/${projectsId}/issues/${item.id}/detail`} target="_blank" title={item.name} className="hide-1 font-16 color-grey-3 lineh-30 mr10" style={{maxWidth:"300px"}}>{item.name}</Link>
{TagInfo(item.priority,"mr10")}
</p>
<p className="color-grey-6 font-12">
@ -91,12 +91,12 @@ class OrderItem extends Component {
<li style={{color:`${item.done_ratio === "100%"?"#28BD6C":"#F73030"}`}}>{item.done_ratio || "--"}</li>
<li>
<div className="milepostleft">
<Link to={`/projects/${projectsId}/orders/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
<Link to={`/projects/${owner}/${projectsId}/issues/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
{
current_user && current_user.login ?
<div style={{ display: this.state.orderid === item.id && this.state.isdisplay ? 'flex' : 'none' }}>
<div className="mr8 ml8 color-grey-9">
<Link to={`/projects/${projectsId}/orders/${item.id}/updatedetail`} className="color-grey-9"><i className="iconfont icon-bianji3 font-14 mr5"></i></Link>
<Link to={`/projects/${owner}/${projectsId}/issues/${item.id}/updatedetail`} className="color-grey-9"><i className="iconfont icon-bianji3 font-14 mr5"></i></Link>
</div>
<div className="color-grey-9">
<Popconfirm placement="bottom" title={'您确定要删除吗'} okText="是" cancelText="否" onConfirm={() => this.deletedetail(item.id)}>

View File

@ -80,9 +80,9 @@ class Tags extends Component {
getList = (page, order_name, order_type) => {
const { projectsId } = this.props.match.params;
const { projectsId ,owner } = this.props.match.params;
const { limit } = this.state;
const url = `/projects/${projectsId}/issue_tags.json`;
const url = `/projects/${owner}/${projectsId}/labels.json`;
axios.get(url, {
params: {
page, limit, order_name, order_type
@ -101,8 +101,8 @@ class Tags extends Component {
createtagpost = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issue_tags.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/projects/${owner}/${projectsId}/labels.json`;
axios.post(url, {
...values,
project_id: projectsId,
@ -183,9 +183,9 @@ class Tags extends Component {
this.updatetag();
}
updatetag = () => {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
let id = this.state.id;
const url = `/projects/${projectsId}/issue_tags/${id}.json`;
const url = `/projects/${owner}/${projectsId}/labels/${id}.json`;
let name = this.state.name;
let description = this.state.description;
let modalcolor = this.state.newcolor
@ -208,8 +208,8 @@ class Tags extends Component {
}
deletetag = (id) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issue_tags/${id}.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/projects/${owner}/${projectsId}/labels/${id}.json`;
axios.delete(url, {
data: {
project_id: projectsId,

View File

@ -36,9 +36,9 @@ class UpdateMilepost extends Component {
}
getmeil = () => {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { meilid } = this.props.match.params;
const url = `/projects/${projectsId}/versions/${meilid}/edit.json`;
const url = `/${owner}/${projectsId}/milestones/${meilid}/edit.json`;
axios.get(url, {
params: {
projectsId, meilid
@ -64,9 +64,9 @@ class UpdateMilepost extends Component {
this.setState({ isSpin: true })
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { meilid } = this.props.match.params;
const url = `/projects/${projectsId}/versions/${meilid}.json`;
const url = `/${owner}/${projectsId}/milestones/${meilid}.json`;
let time = this.state.selectedValue && this.state.selectedValue.format("YYYY-MM-DD");
@ -79,7 +79,7 @@ class UpdateMilepost extends Component {
}).then(result => {
if (result) {
this.setState({ isSpin: false })
this.props.history.push(`/projects/${projectsId}/orders/Milepost`);
this.props.history.push(`/projects/${owner}/${projectsId}/milestones`);
}

View File

@ -49,8 +49,8 @@ class NewMilepost extends Component {
this.setState({ isSpin: true })
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/versions.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/milestones.json`;
let time = undefined;
if (this.state.selectedValue === undefined) {
@ -66,7 +66,7 @@ class NewMilepost extends Component {
}).then(result => {
if (result) {
this.setState({ isSpin: false })
this.props.history.push(`/projects/${projectsId}/orders/Milepost`);
this.props.history.push(`/projects/${owner}/${projectsId}/milestones`);
}
}).catch(error => {

View File

@ -19,7 +19,6 @@
}
.topmilepost {
padding: 20px 0;
box-sizing: border-box;
display: flex;
justify-content: space-between;
@ -27,7 +26,7 @@
}
.miledetail {
padding-bottom: 20px;
padding:15px 20px;
box-sizing: border-box;
justify-content: space-between;
border-bottom: 1px solid #eeeeee;
@ -212,12 +211,18 @@
padding: 6px 30px;
cursor: pointer;
}
.setItemStyle{
min-height:440px;
}
.setItemStyle .issueItem{
padding:16px 0px;
}
.issueItem {
display: flex;
flex-wrap: wrap;
align-content: center;
border-bottom: 1px solid #eee;
padding: 16px 0px 16px 20px;
padding: 16px 20px;
}
.issueNo {
padding: 0px 5px;
@ -424,7 +429,7 @@
}
.milepostrighe {
display: flex;
width: 80%;
flex:1;
}
.milepostleft {
display: flex;
@ -640,7 +645,7 @@ a.issue-type-button.active:hover {
.custom-comment-tabs .ant-tabs-top-bar{
border-bottom: none;
padding: 15px 0;
padding-top:15px;
}
.custom-comment-tabs .search-count-button{
line-height: 18px;

View File

@ -84,9 +84,9 @@ class order extends Component {
this.setState({
isSpin: true
})
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const url = `/projects/${projectsId}/issues/index_chosen.json`;
const url = `/${owner}/${projectsId}/issues/index_chosen.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
@ -106,8 +106,8 @@ class order extends Component {
isSpin: true
})
const { select_params } = this.state;
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues.json`;
const { projectsId, owner } = this.props.match.params;
const url = `/${owner }/${projectsId}/issues.json`;
axios
.get(url, {
params: {
@ -316,8 +316,8 @@ class order extends Component {
};
deletedetail = (id) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${id}.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/projects/${owner}/${projectsId}/issues/${id}.json`;
axios.delete(url, {
data: {
project_id: projectsId,
@ -340,10 +340,10 @@ class order extends Component {
this.props.showLoginDialog();
}
renderNew =()=>{
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
if (this.props.checkIfLogin()) {
return(
<Link className="topWrapper_btn ml10" target="_blank" to={`/projects/${projectsId}/orders/new`}>
<Link className="topWrapper_btn ml10" target="_blank" to={`/projects/${owner}/${projectsId}/issues/new`}>
+&nbsp;创建任务
</Link>
)
@ -415,7 +415,7 @@ class order extends Component {
// 批量修改
updateIssues = () => {
const { checkedValue, select_params } = this.state;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
if (!select_params.update_author_id && !select_params.update_fixed_version_id && !select_params.update_status_id) {
this.resetSelectParams();
@ -424,7 +424,7 @@ class order extends Component {
this.setState({
isSpin: true
})
const url = `/projects/${projectsId}/issues/series_update.json`;
const url = `/${owner}/${projectsId}/issues/series_update.json`;
axios.post(url, {
ids: checkedValue,
assigned_to_id: select_params.update_author_id,
@ -470,8 +470,8 @@ class order extends Component {
isSpin: true
})
const { checkedValue } = this.state;
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/clean.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/projects/${owner}/${projectsId}/issues/clean.json`;
axios.post(url, {
ids: checkedValue
}).then(result => {
@ -826,7 +826,7 @@ class order extends Component {
)}
{
search_count > select_params.limit ?
<div className="mt30 mb50 edu-txt-center">
<div className="mt30 mb10 edu-txt-center">
<Pagination
simple
defaultCurrent={select_params.page}

View File

@ -17,11 +17,11 @@ class order_form extends Component {
branch_name: "",
issue_tag_ids: "",
fixed_version_id: "",
tracker_id: "1",
tracker_id: "4",
issue_type: "1",
status_id: "1",
assigned_to_id: "",
priority_id: "1",
priority_id: "2",
done_ratio: "0%",
issue_chosen: undefined,
branches: undefined,
@ -44,14 +44,13 @@ class order_form extends Component {
}
componentDidMount = () => {
this.getSelectList();
};
get_detail = () => {
this.setState({
isSpin:true
})
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/edit.json`;
const { projectsId, orderId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/${orderId}/edit.json`;
axios.get(url).then((result) => {
if (result) {
let data ={
@ -87,16 +86,9 @@ class order_form extends Component {
});
};
getSelectList = () => {
let projectsId = "";
if (this.props.match.params.milepostId) {
projectsId = this.props.match.params.projectsId;
this.props.form.setFieldsValue({
fixed_version_id: this.props.match.params.milepostId,
});
} else {
projectsId = this.props.match.params.projectsId;
}
const url = `/projects/${projectsId}/issues/new.json`;
let {projectsId, owner , milepostId} = this.props.match.params;
const url = `/${owner}/${projectsId}/issues/new.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
@ -104,11 +96,13 @@ class order_form extends Component {
branches: result.data.branches,
isSpin:false
});
if(this.props.form_type !== "new"){
this.get_detail();
}else{
this.props.form.setFieldsValue({
...this.state
...this.state,
fixed_version_id: milepostId || ""
});
}
}
@ -137,7 +131,7 @@ class order_form extends Component {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { form_type } = this.props;
const { projectsId, orderId } = this.props.match.params;
const { projectsId , orderId , owner } = this.props.match.params;
const { fileList } = this.state;
@ -158,7 +152,7 @@ class order_form extends Component {
}
const { description, start_date, due_date, issue_type } = this.state;
if (form_type === "new") {
const url = `/projects/${projectsId}/issues.json`;
const url = `/${owner}/${projectsId}/issues.json`;
axios.post(url, {
...values,
description: description,
@ -169,7 +163,7 @@ class order_form extends Component {
}).then((result) => {
if (result && result.data.id) {
this.props.showNotification("任务创建成功!");
this.props.history.push(`/projects/${projectsId}/orders/${result.data.id}/detail`);
this.props.history.push(`/projects/${owner}/${projectsId}/issues/${result.data.id}/detail`);
this.setState({
description: "",
isSpin: false,
@ -185,7 +179,7 @@ class order_form extends Component {
console.log(error);
});
} else {
const url = `/projects/${projectsId}/issues/${orderId}.json`;
const url = `/${owner}/${projectsId}/issues/${orderId}.json`;
axios.put(url, {
description: description,
attachment_ids: fileList,
@ -195,9 +189,7 @@ class order_form extends Component {
...values,
}).then((result) => {
if (result) {
this.props.history.push(
`/projects/${projectsId}/orders/${orderId}/detail`
);
this.props.history.push(`/projects/${owner}/${projectsId}/issues/${orderId}/detail`);
this.props.showNotification("任务更新成功!");
}
})
@ -299,7 +291,7 @@ class order_form extends Component {
render() {
const { getFieldDecorator } = this.props.form;
const projectsId = this.props.match.params.projectsId;
const { projectsId , owner } = this.props.match.params;
const { orderId } = this.props.match.params;
const { form_type } = this.props;
const {issue_chosen,branches,description,get_attachments,isSpin,start_date,due_date} = this.state;
@ -370,7 +362,7 @@ class order_form extends Component {
type="default"
className="ml30"
onClick={()=>
this.props.history.push(form_type === "new" ? `/projects/${projectsId || orderId}/orders` : `/projects/${projectsId}/orders/${orderId}/detail`)}
this.props.history.push(form_type === "new" ? `/projects/${owner}/${projectsId || orderId}/issues` : `/projects/${owner}/${projectsId}/issues/${orderId}/detail`)}
>
<span className="plr10">取消</span>
</Button>

View File

@ -11,7 +11,7 @@ const Div = styled.div`{
export default ((props)=>{
const [ branch , setBranch ] = useState("master");
const { projectsId } = props.match.params;
const { projectsId , owner } = props.match.params;
const projectDetail = props.projectDetail;
function resetSetting(){
@ -30,6 +30,7 @@ export default ((props)=>{
repo_id={ projectDetail && projectDetail.repo_id}
projectsId={projectsId}
changeBranch={setBranch}
owner={owner}
/>
<a className="color-blue ml20" onClick={resetSetting()}>设为默认分支</a>
</AlignCenter>

View File

@ -86,9 +86,8 @@ class Collaborator extends Component {
// 获取项目协作者
getMember = () => {
const { page, search, role } = this.state;
console.log("search", search);
console.log("role", role);
const url = `/projects/${this.props.project_id}/members.json`;
const {projectsId ,owner} = this.props.match.params;
const url = `/${owner}/${projectsId}/collaborators.json`;
axios
.get(url, {
params: {
@ -171,13 +170,14 @@ class Collaborator extends Component {
// 增加协作者
addCollaborator = () => {
// const { project_id } = this.props;
this.setState({
otherSpin: true,
});
const { user_id } = this.state;
const url = `/projects/${this.props.project_id}/members.json`;
axios
.post(url, {
if(user_id){
this.setState({
otherSpin: true,
});
const {projectsId ,owner} = this.props.match.params;
const url = `/${owner}/${projectsId}/collaborators.json`;
axios.post(url, {
user_id,
})
.then((result) => {
@ -196,6 +196,7 @@ class Collaborator extends Component {
});
console.log(error);
});
}
};
// 修改权限
@ -204,7 +205,9 @@ class Collaborator extends Component {
this.setState({
isSpin: true,
});
const url = `/projects/${this.props.project_id}/members/change_role.json`;
const {projectsId ,owner} = this.props.match.params;
const url = `/${owner}/${projectsId}/collaborators/change_role.json`;
axios
.put(url, {
user_id: id,
@ -230,11 +233,12 @@ class Collaborator extends Component {
// 删除协作者
deleteUser = (id) => {
const { page } = this.state;
const {projectsId ,owner} = this.props.match.params;
this.props.confirm({
content: "确认将此成员从项目中移除?",
onOk: () => {
const { project_id } = this.props;
const url = `/projects/${project_id}/members/remove.json`;
const url = `/${owner}/${projectsId}/collaborators/remove.json`;
axios
.delete(url, {
data: {

View File

@ -38,20 +38,19 @@ const ManageNew = Loadable({
});
class Index extends Component {
render() {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { pathname } = this.props.history.location;
const flag = pathname === `/projects/${projectsId}/setting`;
const flag = pathname === `/projects/${owner}/${projectsId}/setting`;
return (
<Box className="ProjectListIndex">
<Short>
<ul className="list-l-Menu">
<li className={flag ? "active" : ""}>
<p>
<Link to={`/projects/${projectsId}/setting`} className="w-100">
<Link to={`/projects/${owner}/${projectsId}/setting`} className="w-100">
<i className="iconfont icon-huabanfuben font-18 mr10"></i>
</Link>
</Link>
</p>
</li>
<li
@ -60,7 +59,7 @@ class Index extends Component {
}
>
<p>
<Link to={`/projects/${projectsId}/setting/collaborator`} className="w-100">
<Link to={`/projects/${owner}/${projectsId}/setting/collaborator`} className="w-100">
<i className="iconfont icon-chengyuan font-18 mr10"></i>
协作者管理
</Link>
@ -82,7 +81,7 @@ class Index extends Component {
className={pathname.indexOf("setting/tags") > -1 ? "active" : ""}
>
<p>
<Link to={`/projects/${projectsId}/setting/tags`} className="w-100">
<Link to={`/projects/${owner}/${projectsId}/setting/tags`} className="w-100">
<i className="iconfont icon-biaoqian3 font-18 mr10"></i>
项目标签
</Link>
@ -108,45 +107,45 @@ class Index extends Component {
<Switch {...this.props}>
{/* 协作者 */}
<Route
path="/projects/:projectsId/setting/collaborator"
path="/projects/:owner/:projectsId/setting/collaborator"
render={(props) => (
<Collaborator {...this.props} {...props} {...this.state} />
)}
></Route>
{/* 修改仓库信息 */}
<Route
path="/projects/:projectsId/setting/tags"
path="/projects/:owner/:projectsId/setting/tags"
render={(props) => (
<Tags {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:projectsId/setting/branch/new"
path="/projects/:owner/:projectsId/setting/branch/new"
render={(props) => (
<BranchNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:projectsId/setting/branch"
path="/projects/:owner/:projectsId/setting/branch"
render={(props) => (
<Branch {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:projectsId/setting/manage/new"
path="/projects/:owner/:projectsId/setting/manage/new"
render={(props) => (
<ManageNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:projectsId/setting/manage"
path="/projects/:owner/:projectsId/setting/manage"
render={(props) => (
<Manage {...this.props} {...props} {...this.state} />
)}
></Route>
{/* 修改仓库信息 */}
<Route
path="/projects/:projectsId/setting"
path="/projects/:owner/:projectsId/setting"
render={(props) => (
<Setting {...this.props} {...props} {...this.state} />
)}

View File

@ -19,23 +19,17 @@ class Setting extends Component {
}
componentDidUpdate=(prevPros)=>{
console.log("dddd",this.props.checkIfLogin());
if(prevPros && this.props && !this.props.checkIfLogin()){
this.props.history.push("/403")
return
}
}
componentDidMount = () => {
// this.check_is_login()
this.getCategory();
this.getLanguage();
this.getInfo();
};
// check_is_login =() =>{
// if(!this.props.checkIfLogin()){
// this.props.history.push("/403")
// return
// }
// };
getLanguage = () => {
const url = `/project_languages.json`;
axios
@ -52,8 +46,8 @@ class Setting extends Component {
};
getInfo = () => {
const { projectsId } = this.props.match.params;
const url = `/repositories/${projectsId}/edit.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/edit.json`;
axios
.get(url)
.then((result) => {
@ -106,9 +100,10 @@ class Setting extends Component {
resetSetting = () => {
this.props.form.validateFields((err, values) => {
if (!err) {
const { project_id } = this.props;
const { projectsId , owner } = this.props.match.params;
const { private_check } = this.state;
const url = `/projects/${project_id}.json`;
const url = `/${owner}/${projectsId}.json`;
axios
.put(url, {
name: values.project_name,
@ -135,8 +130,8 @@ class Setting extends Component {
this.props.confirm({
content: "删除后无法恢复,是否确认删除本仓库?",
onOk: () => {
const { project_id } = this.props;
const url = `/projects/${project_id}.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}.json`;
axios
.delete(url)
.then((result) => {

View File

@ -56,20 +56,13 @@ class NewTags extends Component {
}
}
componentDidMount = () => {
// this.check_is_login();
this.getList();
};
// check_is_login =() =>{
// if(!this.props.checkIfLogin()){
// this.props.history.push("/403")
// return
// }
// };
getList = (page, order_name, order_type) => {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { limit } = this.state;
const url = `/projects/${projectsId}/issue_tags.json`;
const url = `/${owner}/${projectsId}/labels.json`;
axios
.get(url, {
params: {
@ -94,8 +87,8 @@ class NewTags extends Component {
createtagpost = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issue_tags.json`;
const { projectsId ,owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/labels.json`;
axios
.post(url, {
...values,
@ -178,9 +171,9 @@ class NewTags extends Component {
this.updatetag();
};
updatetag = () => {
const { projectsId } = this.props.match.params;
const { projectsId ,owner } = this.props.match.params;
let id = this.state.id;
const url = `/projects/${projectsId}/issue_tags/${id}.json`;
const url = `/${owner}/${projectsId}/labels/${id}.json`;
let name = this.state.name;
let description = this.state.description;
let modalcolor = this.state.newcolor;
@ -206,8 +199,8 @@ class NewTags extends Component {
};
deletetag = (id) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issue_tags/${id}.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/labels/${id}.json`;
axios
.delete(url, {
data: {

View File

@ -11,6 +11,7 @@ class CommonUsers extends Component {
user_type: this.props.user_type,
type_title: this.props.type_title,
project_id: this.props.project_id,
owner:this.props.owner,
users: null,
count: 0,
limit: 20,
@ -27,28 +28,25 @@ class CommonUsers extends Component {
this.setState({
isSpin: true,
});
const { user_type, project_id } = this.state;
const url = `/projects/${project_id}/${user_type}.json`;
axios
.get(url, {
params: {
page,
limit,
},
})
.then((result) => {
if (result) {
this.setState({
count: result.data.count,
users: result.data.users,
isSpin: false,
});
}
})
.catch((error) => {
console.log(error);
});
const { user_type, project_id ,owner } = this.state;
const url = `/${owner}/${project_id}/${user_type}.json`;
axios.get(url, {
params: {
page,
limit,
},
}).then((result) => {
if (result) {
this.setState({
count: result.data.count,
users: result.data.users,
isSpin: false,
});
}
})
.catch((error) => {
console.log(error);
});
};
// 翻页

View File

@ -25,9 +25,9 @@ class ForkUsers extends Component {
this.setState({
isSpin: true,
});
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const url = `/projects/${projectsId}/fork_users.json`;
const url = `/${owner}/${projectsId}/members.json`;
axios
.get(url, {
params: {
@ -96,7 +96,7 @@ class ForkUsers extends Component {
<div className="ml12">
<div>
<Link
to={`/projects/${item.id}`}
to={`/projects/${item.login}/${item.identifier}`}
className="font-16 text-primary hide-1 task-hide max-w-200"
>
{item.name}

View File

@ -1,28 +1,12 @@
import React, { Component } from "react";
import CommonUsers from "./common_users"
class PraiseUsers extends Component {
constructor(props) {
super(props);
this.state = {
projectId: null
};
}
componentDidMount = () => {
this.get_projectId();
};
get_projectId = () => {
this.setState({
projectId: this.props.match.params.projectsId
})
};
render() {
const { projectId } = this.state;
const { owner , projectsId } = this.props.match.params;
return (
<div >
{projectId && <CommonUsers user_type="praise_users" type_title="点赞列表" project_id={projectId} current_user={this.props.current_user} />}
{projectsId && <CommonUsers user_type="stargazers" type_title="点赞列表" project_id={projectsId} current_user={this.props.current_user} owner={owner} />}
</div>
);
}

View File

@ -1,28 +1,11 @@
import React, { Component } from "react";
import CommonUsers from "./common_users"
class WatchUsers extends Component {
constructor(props) {
super(props);
this.state = {
projectId: null
};
}
componentDidMount = () => {
this.get_projectId();
};
get_projectId = () => {
this.setState({
projectId: this.props.match.params.projectsId
})
};
render() {
const { projectId } = this.state;
const { owner , projectsId } = this.props.match.params;
return (
<div>
{projectId && <CommonUsers user_type="watch_users" type_title="关注列表" project_id={projectId} current_user={this.props.current_user} />}
{projectsId && <CommonUsers user_type="watchers" type_title="关注列表" project_id={projectsId} current_user={this.props.current_user} owner={owner} />}
</div>
);
}

View File

@ -28,13 +28,13 @@ export default Form.create()(
const repo_id = projectDetail && projectDetail.repo_id;
const { projectsId, versionId } = match.params;
const { projectsId, versionId , owner } = match.params;
useEffect(()=>{
getBranchs(projectsId);
getBranchs(projectsId,owner);
},[projectsId])
async function getBranchs(id){
let result = await getBranch(id);
async function getBranchs(id,owner){
let result = await getBranch(id,owner);
setBranchList(result);
}
@ -47,7 +47,7 @@ export default Form.create()(
useEffect(() => {
if (versionId) {
const url = `/projects/${projectsId}/version_releases/${versionId}/edit.json`;
const url = `/${owner}/${projectsId}/releases/${versionId}/edit.json`;
axios.get(url).then(result => {
if (result) {
setFieldsValue(result.data);
@ -59,8 +59,8 @@ export default Form.create()(
}, [versionId]);
useEffect(() => {
if (repo_id) {
const url = `/repositories/${repo_id}/tags.json`;
if (projectsId) {
const url = `/${owner}/${projectsId}/tags.json`;
axios
.get(url,{params:{
limit:1000
@ -75,7 +75,7 @@ export default Form.create()(
console.log(error);
});
}
}, [repo_id]);
}, [projectsId]);
function renderTagList(list) {
if (list) {
@ -93,7 +93,7 @@ export default Form.create()(
validateFields((err, value) => {
if(err)return;
if (versionId) {
let url = `/projects/${projectsId}/version_releases/${versionId}.json`;
let url = `/${owner}/${projectsId}/releases/${versionId}.json`;
axios
.put(url, {
...value,
@ -103,11 +103,11 @@ export default Form.create()(
.then(result => {
if (result) {
showNotification("版本修改成功!");
history.push(`/projects/${projectsId}/coders/version`);
history.push(`/projects/${owner}/${projectsId}/releases`);
}
});
} else {
let url = `/projects/${projectsId}/version_releases.json`;
let url = `/${owner}/${projectsId}/releases.json`;
axios.post(url, {
...value,
body: desc,
@ -116,7 +116,7 @@ export default Form.create()(
.then(result => {
if (result) {
showNotification("版本发布成功!");
history.push(`/projects/${projectsId}/coders/version`);
history.push(`/projects/${owner}/${projectsId}/releases`);
}
});
}
@ -143,7 +143,7 @@ export default Form.create()(
<div className="main df">
<Form className="versionForm">
<div>
<p className="font-16 color-grey-3 mb15">创建发行版</p>
<p className="font-16 color-grey-3 mb15">{versionId?"编辑":"创建"}发行版</p>
<div>
<div className="itemInline">
{helper(
@ -233,7 +233,7 @@ export default Form.create()(
</Button>
<Button
onClick={() =>
history.push(`/projects/${projectsId}/coders/version`)
history.push(`/projects/${owner}/${projectsId}/releases`)
}
style={{
backgroundColor: "rgba(187,187,187,1)",

View File

@ -30,8 +30,8 @@ class version extends Component {
}
// 获取列表数据
getIssueList = () => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/version_releases.json`;
const { projectsId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/releases.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
@ -56,7 +56,7 @@ class version extends Component {
}
renderList = (releases) => {
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
if (releases && releases.length > 0) {
return (
<div>
@ -75,7 +75,7 @@ class version extends Component {
<div className="versionInfo_right">
<span className="versionName">
<span className="task-hide">{item.name}</span>
<Link to={`/projects/${projectsId}/coders/version/${item.version_id}/update`} className="color-blue ml3 font-12">编辑</Link>
<Link to={`/projects/${owner}/${projectsId}/releases/${item.version_id}/update`} className="color-blue ml3 font-12">编辑</Link>
</span>
<span className="color-grey-3">
<i className={`${item.bodyshow ? "iconfont icon-sanjiaoxing-down color-grey-8 mr3 font-14":"iconfont icon-triangle color-grey-8 mr3 font-14"}`} onClick={()=>this.showBody(key,item.bodyshow)}></i>
@ -103,7 +103,7 @@ class version extends Component {
}
render() {
const { projectsId } = this.props.match.params;
const { projectsId ,owner } = this.props.match.params;
const { data , releases } = this.state
return (
@ -112,7 +112,7 @@ class version extends Component {
<span className="font-18 color-grey-3">版本发布</span>
{
data && data.user_permission ?
<Link to={`/projects/${projectsId}/coders/version/new`} className="topWrapper_btn_new">+ 发布新版</Link>
<Link to={`/projects/${owner}/${projectsId}/releases/new`} className="topWrapper_btn_new">+ 发布新版</Link>
: ''
}
</div>

View File

@ -86,7 +86,7 @@ class children_comments extends Component {
};
commentCtx = (v) => {
return <RenderHtml className="break_word_comments" value={v} />;
return <RenderHtml className="break_word_comments imageLayerParent" value={v} />;
};
Paginations =()=> {

View File

@ -51,7 +51,7 @@ class children_journals extends Component {
};
commentCtx = (v) => {
return <RenderHtml className="break_word_comments" value={v} />;
return <RenderHtml className="break_word_comments imageLayerParent" value={v} />;
};
Paginations =()=> {

View File

@ -263,7 +263,7 @@ class comments extends Component {
}
commentCtx = (v) => {
return <RenderHtml className="break_word_comments" value={v} />;
return <RenderHtml className="break_word_comments imageLayerParent" value={v} />;
};
Paginations = ()=>{
const { page, limit, search_count } = this.state;

View File

@ -167,9 +167,9 @@ class Infos extends Component {
</div>
<div className="width100 inline-block mt20">
<Link
to={`/users/${user && user.login}/watch_users`}
className={`with50 text-center pull-left ${route_type === "watch_users" ? "text-primary" : ""}`}
onClick={() =>this.route_link("watch_users")}
to={`/users/${user && user.login}/watchers`}
className={`with50 text-center pull-left ${route_type === "watchers" ? "text-primary" : ""}`}
onClick={() =>this.route_link("watchers")}
>
<div>{current_user && user && user.login === current_user.login ? "我关注的" : "TA关注的"}</div>
<span>{user && user.watching_count}</span>
@ -252,9 +252,9 @@ class Infos extends Component {
<div>
<Switch {...this.props}>
<Route
path="/users/:username/watch_users"
path="/users/:username/watchers"
render={() => {
return <WatchsUser {...this.props} {...this.state} userType="watch_users" />;
return <WatchsUser {...this.props} {...this.state} userType="watchers" />;
}}
></Route>
<Route

View File

@ -28,8 +28,7 @@ class CommonList extends Component {
this.setState({
isSpin: true,
});
axios
.get(url, {
axios.get(url, {
params: {
page,
limit,
@ -88,7 +87,7 @@ class CommonList extends Component {
<Spin spinning={isSpin}>
<div className="pd20 minH-670">
<div className="grid-item pb20 bbt">
<h3>{userType === "watch_users" ? `${title_type}关注的` : `关注${title_type}`}</h3>
<h3>{userType === "watchers" ? `${title_type}关注的` : `关注${title_type}`}</h3>
<div className="text-right">
<Search
placeholder="输入名称进行搜索"

View File

@ -5,7 +5,7 @@ class WatcherUsers extends Component {
const {user, current_user} = this.props
return (
<div className="minH-650">
{user && user.login && <CommonLists userType="watch_users" login={user.login} current_user={current_user} />}
{user && user.login && <CommonLists userType="watchers" login={user.login} current_user={current_user} />}
</div>
);
}

View File

@ -44,6 +44,9 @@
.markdown-body p {
margin: 0 !important
}
.markdown-body img{
cursor: pointer;
}
ol,
ul,

View File

@ -427,10 +427,6 @@ export function commentHOC(WrappedComponent) {
})
}
// ----------------------------------------------------------------------------------------------评论 End
// ----------------------------------------------------------------------------------------------评论 End
componentDidMount() {
$(".commentsDelegateParent")
.delegate(".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img", "click", (event) => {

View File

@ -16,6 +16,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
}
onDelegateClick = (event) => {
console.log("imgclick",event);
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片
const fileName = event.target.innerHTML.trim()
@ -37,8 +38,8 @@ export function ImageLayerOfCommentHOC(options = {}) {
componentDidMount() {
this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef'])
setTimeout(() => {
setTimeout(() => {
$(options.parentSelector || ".commentsDelegateParent")
.delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img", "click", this.onDelegateClick);
}, 1200)