forked from Gitlink/forgeplus-react
route
This commit is contained in:
parent
cefd974498
commit
537c9ae40a
File diff suppressed because it is too large
Load Diff
|
@ -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",
|
||||
|
|
|
@ -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(/</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({
|
||||
|
|
|
@ -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>)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,20 +14,20 @@ 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}/orders/${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}/merge/${item.trend_id}/Messagecount`} className="color-blue font-16">{item.name}</Link>
|
||||
<span className="activity_type">{item.trend_type}</span>
|
||||
</p >
|
||||
}
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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)=>{
|
||||
|
|
|
@ -46,7 +46,7 @@ class Index extends Component {
|
|||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/projects/:projectsId"
|
||||
path="/projects/:owner/:projectsId"
|
||||
render={(props) => (
|
||||
<ProjectDetail {...this.props} {...props} />
|
||||
)}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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}>
|
||||
|
|
|
@ -101,38 +101,32 @@ class CoderRootDirectory extends Component {
|
|||
|
||||
// 获取根目录
|
||||
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) => {
|
||||
|
@ -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:{
|
||||
|
@ -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,9 +478,7 @@ 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/${projectsId}/coders/${branch}/uploadfile${urlRoot}`} >
|
||||
<span className="color-green mr30">上传文件</span>
|
||||
</Link>
|
||||
</span>
|
||||
|
|
|
@ -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,65 @@ 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/coders/:branch/newfile/:path"
|
||||
render={
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/coders/:branch/uploadfile"
|
||||
<Route path="/projects/:owner/:projectsId/coders/:branch/uploadfile"
|
||||
render={
|
||||
(props) => (<UploadFile {...this.props} {...props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/coders/:branch/newfile"
|
||||
<Route path="/projects/:owner/:projectsId/coders/: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/coders/commit"
|
||||
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/coders/version/new"
|
||||
render={
|
||||
() => (<CoderRootVersionNew {...this.props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/coders/version/:versionId/update"
|
||||
<Route path="/projects/:owner/:projectsId/coders/version/:versionId/update"
|
||||
render={
|
||||
() => (<CoderRootVersionUpdate {...this.props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/coders/version"
|
||||
<Route path="/projects/:owner/:projectsId/coders/version"
|
||||
render={
|
||||
() => (<CoderRootVersion {...this.props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/coders/tag"
|
||||
<Route path="/projects/:owner/:projectsId/coders/tag"
|
||||
render={
|
||||
() => (<CoderRootTag {...this.props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/coders/branch"
|
||||
<Route path="/projects/:owner/:projectsId/coders/branch"
|
||||
render={
|
||||
() => (<CoderRootBranch {...this.props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/coders"
|
||||
<Route path="/projects/:owner/: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} />)
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
)
|
||||
}
|
||||
})
|
|
@ -157,8 +157,8 @@ class Detail extends Component {
|
|||
}
|
||||
|
||||
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({
|
||||
|
@ -214,8 +214,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({
|
||||
|
@ -261,6 +261,7 @@ class Detail extends Component {
|
|||
// 点赞和取消点赞
|
||||
pariseFunc = (flag) => {
|
||||
const { project_id } = this.state;
|
||||
|
||||
axios({
|
||||
method: flag ? 'delete' : 'post',
|
||||
url: `/projects/${project_id}/praise_tread/${flag ? 'unlike' : 'like'}.json`
|
||||
|
@ -291,11 +292,11 @@ class Detail extends Component {
|
|||
|
||||
// fork项目
|
||||
forkFunc = () => {
|
||||
const { project_id } = this.state;
|
||||
const url = `/projects/${project_id}/forks.json`;
|
||||
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/${owner}/${result.data.identifier}/coders`);
|
||||
this.props.showNotification(result.data.message);
|
||||
}
|
||||
}).catch(error => {
|
||||
|
@ -306,8 +307,8 @@ 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);
|
||||
|
@ -325,11 +326,12 @@ class Detail extends Component {
|
|||
const urlArr = url.split("/");
|
||||
const urlFlag = (urlArr.length === 3);
|
||||
|
||||
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>
|
||||
|
@ -356,7 +358,7 @@ 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}/coders`} className="color-white font-22">{project && project.name}</Link>
|
||||
{
|
||||
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
|
||||
<Tooltip placement={'right'} title={text}>
|
||||
|
@ -391,7 +393,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}/watch_users`, state }}>
|
||||
{watchers_count}
|
||||
</Link>
|
||||
</span>
|
||||
|
@ -400,14 +402,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}/praise_users`, 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>
|
||||
|
@ -419,12 +421,12 @@ class Detail extends Component {
|
|||
<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 }}>
|
||||
<Link to={{ pathname: `/projects/${owner}/${projectsId}/coders`, 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 }}>
|
||||
<Link to={{ pathname: `/projects/${owner}/${projectsId}/orders`, state }}>
|
||||
<img alt="" src={img_2} width="12" />任务
|
||||
{projectDetail && projectDetail.issues_count ? <span>{projectDetail.issues_count}</span> : ""}
|
||||
</Link>
|
||||
|
@ -432,32 +434,32 @@ class Detail extends Component {
|
|||
{
|
||||
projectDetail && parseInt(projectDetail.type) !== 2 &&
|
||||
<li className={url.indexOf("merge") > -1 ? "active" : ""}>
|
||||
<Link to={{ pathname: `/projects/${projectsId}/merge`, state }}>
|
||||
<Link to={{ pathname: `/projects/${owner}/${projectsId}/merge`, 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 }}>
|
||||
<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 }}>
|
||||
<Link to={{ pathname: `/projects/${owner}/${projectsId}/orders/Milepost`, 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 }}>
|
||||
<Link to={{ pathname: `/projects/${owner}/${projectsId}/trends`, 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 +476,141 @@ 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/orders/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/orders/:orderId/detail"
|
||||
render={
|
||||
(props) => (<OrderDetail {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/* 里程碑 */}
|
||||
<Route path="/projects/:projectsId/orders/Milepost"
|
||||
<Route path="/projects/:owner/:projectsId/orders/Milepost"
|
||||
render={
|
||||
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/* 新建里程碑 */}
|
||||
<Route path="/projects/:projectsId/orders/meilpost"
|
||||
<Route path="/projects/:owner/:projectsId/orders/meilpost"
|
||||
render={
|
||||
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/*里程碑详情*/}
|
||||
<Route path="/projects/:projectsId/orders/:meilid/MilepostDetail"
|
||||
<Route path="/projects/:owner/:projectsId/orders/:meilid/MilepostDetail"
|
||||
render={
|
||||
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/*修改里程碑*/}
|
||||
<Route path="/projects/:projectsId/orders/:meilid/meilpost"
|
||||
<Route path="/projects/:owner/:projectsId/orders/:meilid/meilpost"
|
||||
render={
|
||||
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/* 里程碑页面新建任务 */}
|
||||
<Route path="/projects/:projectsId/orders/:milepostId/new"
|
||||
<Route path="/projects/:owner/:projectsId/orders/:milepostId/new"
|
||||
render={
|
||||
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/* 新建任务 */}
|
||||
<Route path="/projects/:projectsId/orders/new"
|
||||
<Route path="/projects/:owner/:projectsId/orders/new"
|
||||
render={
|
||||
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/* 修改详情 */}
|
||||
<Route path="/projects/:projectsId/orders/:orderId/updatedetail"
|
||||
<Route path="/projects/:owner/:projectsId/orders/:orderId/updatedetail"
|
||||
render={
|
||||
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/* 复制详情 */}
|
||||
<Route path="/projects/:projectsId/orders/:orderId/copyetail"
|
||||
<Route path="/projects/:owner/:projectsId/orders/:orderId/copyetail"
|
||||
render={
|
||||
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/* 动态 */}
|
||||
<Route path="/projects/:projectsId/trends"
|
||||
<Route path="/projects/:owner/:projectsId/trends"
|
||||
render={
|
||||
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
{/* 代码Index */}
|
||||
<Route path="/projects/:projectsId/orders"
|
||||
<Route path="/projects/:owner/:projectsId/orders"
|
||||
render={
|
||||
(props) => (<OrderIndex {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/merge/new"
|
||||
<Route path="/projects/:owner/:projectsId/merge/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/merge/:mergeId/UpdateMerge"
|
||||
render={
|
||||
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/merge/:mergeId/Messagecount"
|
||||
<Route path="/projects/:owner/:projectsId/merge/:mergeId/Messagecount"
|
||||
render={
|
||||
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/merge/:mergeId/MergeSubmit"
|
||||
<Route path="/projects/:owner/:projectsId/merge/:mergeId/MergeSubmit"
|
||||
render={
|
||||
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/merge"
|
||||
<Route path="/projects/:owner/:projectsId/merge"
|
||||
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"
|
||||
<Route path="/projects/:owner/:projectsId/coders"
|
||||
render={
|
||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/watch_users"
|
||||
<Route path="/projects/:owner/:projectsId/watch_users"
|
||||
render={
|
||||
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/praise_users"
|
||||
<Route path="/projects/:owner/:projectsId/praise_users"
|
||||
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} />)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,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}/coders`} 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 ?
|
||||
|
|
|
@ -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}/merge/${item.pull_request_id}/Messagecount`}
|
||||
className="hide-1 font-15 color-grey-3 fwb lineh-30 mr10"
|
||||
style={{ maxWidth: "300px" }}
|
||||
>
|
||||
|
|
|
@ -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,
|
||||
|
@ -199,7 +199,7 @@ class MessageCount extends Component {
|
|||
};
|
||||
|
||||
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}/coders?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}/coders?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`}
|
||||
href={`/projects/${owner}/${projectsId}/merge/${mergeId}/UpdateMerge`}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
|
|
|
@ -36,7 +36,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) => {
|
||||
|
@ -83,7 +85,9 @@ class NewMerge extends Component {
|
|||
|
||||
newMergelist = (projectsId) => {
|
||||
this.setState({isSpin: true})
|
||||
const url = `/projects/${projectsId}/pull_requests/get_branches.json`;
|
||||
const { owner } = this.props.match.params;
|
||||
|
||||
const url = `/${owner}/${projectsId}/pulls/get_branches.json`;
|
||||
axios
|
||||
.get(url)
|
||||
.then((result) => {
|
||||
|
@ -128,42 +132,41 @@ class NewMerge extends Component {
|
|||
|
||||
ischeckmerge = () => {
|
||||
this.setState({ isSpin: true });
|
||||
const { projectsId } = this.props.match.params;
|
||||
const { projectsId , owner } = 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 url = `/${owner}/${projectsId}/pulls/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: "出现错误了",
|
||||
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() {
|
||||
|
@ -211,7 +214,7 @@ class NewMerge extends Component {
|
|||
const withHtml = (html) => {
|
||||
return <div dangerouslySetInnerHTML={{ __html: html }}></div>;
|
||||
};
|
||||
|
||||
let { project } = this.props;
|
||||
return (
|
||||
<div>
|
||||
<div className="main">
|
||||
|
@ -221,7 +224,7 @@ class NewMerge extends Component {
|
|||
<div className="color-grey-3 mb10 fwb">源分支:</div>
|
||||
<Input.Group compact className="display-flex">
|
||||
<Select
|
||||
defaultValue={parseInt(projectsId)}
|
||||
defaultValue={parseInt(project && project.id)}
|
||||
class=" maxW50 hide-1 task-hide"
|
||||
disabled
|
||||
>
|
||||
|
@ -247,7 +250,7 @@ class NewMerge extends Component {
|
|||
<div className="color-grey-3 mb10 fwb">目标分支:</div>
|
||||
<Input.Group compact className="display-flex">
|
||||
<Select
|
||||
defaultValue={parseInt(projectsId)}
|
||||
defaultValue={parseInt(project && project.id)}
|
||||
class=" maxW50 hide-1 task-hide"
|
||||
onSelect={(e) => this.selectProjectName(e)}
|
||||
>
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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,12 +216,12 @@ 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}/merge/new`);
|
||||
}
|
||||
}
|
||||
render() {
|
||||
|
|
|
@ -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}/merge`);
|
||||
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}/merge/${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,
|
||||
|
@ -285,8 +284,8 @@ class MergeForm extends Component {
|
|||
className="ml30"
|
||||
href={
|
||||
merge_type === "new"
|
||||
? `/projects/${projectsId}/merge`
|
||||
: `/projects/${projectsId}/merge/${mergeId}/detail`
|
||||
? `/projects/${owner}/${projectsId}/merge`
|
||||
: `/projects/${owner}/${projectsId}/merge/${mergeId}/detail`
|
||||
}
|
||||
>
|
||||
<span className="plr10">取消</span>
|
||||
|
|
|
@ -44,8 +44,8 @@ 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) => {
|
||||
|
@ -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: {
|
||||
|
@ -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}/orders/${result.data.issue_id}/copyetail`
|
||||
);
|
||||
}
|
||||
})
|
||||
|
@ -186,7 +186,7 @@ class Detail extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { projectsId, orderId } = this.props.match.params;
|
||||
const { projectsId, orderId , onwer } = this.props.match.params;
|
||||
const { data , isSpins } = this.state;
|
||||
const get_color = (type) => {
|
||||
if (type === "高") {
|
||||
|
@ -269,7 +269,7 @@ class Detail extends Component {
|
|||
</Popconfirm>
|
||||
|
||||
<Link
|
||||
to={`/projects/${projectsId}/orders/${orderId}/updatedetail`}
|
||||
to={`/projects/${onwer}/${projectsId}/orders/${orderId}/updatedetail`}
|
||||
className="color-blue fr"
|
||||
>
|
||||
编辑
|
||||
|
|
|
@ -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>
|
||||
|
@ -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}/orders/meilpost`} 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}/orders/${item.id}/MilepostDetail`} className="font-16">{item.name}</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -225,7 +225,7 @@ class Milepost extends Component {
|
|||
<div className="milepostleft">
|
||||
<div className="grid-item mr15 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}/orders/${item.id}/meilpost`} className="color-grey-9">编辑</Link>
|
||||
</div>
|
||||
<div className="grid-item mr15 color-grey-9">
|
||||
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
|
||||
|
|
|
@ -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,7 +31,7 @@ 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}/orders/${item.id}/MilepostDetail`} className="font-16">{item.name}</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -66,7 +66,7 @@ class OrderItem extends Component {
|
|||
<div className="milepostleft">
|
||||
<div className="grid-item mr15 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}/orders/${item.id}/meilpost`} className="color-grey-9">编辑</Link>
|
||||
</div>
|
||||
<div className="grid-item mr15 color-grey-9">
|
||||
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
|
||||
|
|
|
@ -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}/orders/Milepost`);
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
|
|
|
@ -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: {
|
||||
|
@ -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}/orders/new`}>
|
||||
+ 创建任务
|
||||
</Link>
|
||||
)
|
||||
|
|
|
@ -50,8 +50,8 @@ class order_form extends Component {
|
|||
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 +87,14 @@ class order_form extends Component {
|
|||
});
|
||||
};
|
||||
getSelectList = () => {
|
||||
let projectsId = "";
|
||||
let {projectsId, owner} = this.props.match.params;
|
||||
|
||||
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`;
|
||||
const url = `/${owner}/${projectsId}/issues/new.json`;
|
||||
axios.get(url).then((result) => {
|
||||
if (result) {
|
||||
this.setState({
|
||||
|
@ -137,7 +135,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 +156,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 +167,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}/orders/${result.data.id}/detail`);
|
||||
this.setState({
|
||||
description: "",
|
||||
isSpin: false,
|
||||
|
@ -185,7 +183,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 +193,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}/orders/${orderId}/detail`);
|
||||
this.props.showNotification("任务更新成功!");
|
||||
}
|
||||
})
|
||||
|
@ -299,7 +295,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 +366,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}/orders` : `/projects/${owner}/${projectsId}/orders/${orderId}/detail`)}
|
||||
>
|
||||
<span className="plr10">取消</span>
|
||||
</Button>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -38,7 +38,7 @@ 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`;
|
||||
|
@ -48,7 +48,7 @@ class Index extends Component {
|
|||
<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>
|
||||
|
@ -60,7 +60,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 +82,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 +108,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} />
|
||||
)}
|
||||
|
|
|
@ -52,8 +52,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 +106,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 +136,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) => {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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}/coders/version/${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}/coders/version/new`} className="topWrapper_btn_new">+ 发布新版</Link>
|
||||
: ''
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
.markdown-body p {
|
||||
margin: 0 !important
|
||||
}
|
||||
.markdown-body img{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
|
|
Loading…
Reference in New Issue