forked from Gitlink/forgeplus-react
Change
This commit is contained in:
commit
91f4327eb4
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}/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 >
|
||||
}
|
||||
|
|
|
@ -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)=>{
|
||||
|
|
|
@ -44,7 +44,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);
|
||||
}
|
||||
|
@ -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}/coders?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>
|
||||
|
|
|
@ -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}>
|
||||
|
|
|
@ -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}/coders`);
|
||||
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}/coders?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}/coders?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}/coders?url=${path}`);
|
||||
if(filename.substring(filename.length - 3) === ".md"){
|
||||
this.setState({
|
||||
md:true
|
||||
|
@ -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}/coders?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}/coders/${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}/coders/${branch}/newfile${urlRoot}`}
|
||||
>
|
||||
<span className="color-blue">新建文件</span>
|
||||
</Link>
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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/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/coders/releases/new"
|
||||
render={
|
||||
() => (<CoderRootVersionNew {...this.props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/coders/version/:versionId/update"
|
||||
<Route path="/projects/:owner/:projectsId/coders/releases/:versionId/update"
|
||||
render={
|
||||
() => (<CoderRootVersionUpdate {...this.props} {...this.state} />)
|
||||
(props) => (<CoderRootVersionUpdate {...this.props} {...this.state} {...props} />)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/coders/version"
|
||||
<Route path="/projects/:owner/:projectsId/coders/releases"
|
||||
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>
|
||||
)
|
||||
}
|
||||
})
|
|
@ -151,14 +151,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 +206,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 +215,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 +248,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 +264,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 +290,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}/coders`);
|
||||
this.props.showNotification(result.data.message);
|
||||
}
|
||||
}).catch(error => {
|
||||
|
@ -303,11 +303,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);
|
||||
|
@ -325,18 +324,19 @@ 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>
|
||||
<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}/coders`} className="color-grey-ccc">{projectDetail.fork_info.fork_form_name}</Link>
|
||||
</React.Fragment> : ""
|
||||
);
|
||||
|
||||
|
@ -356,11 +356,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}/coders`} 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}/coders`}
|
||||
className="ml10" >
|
||||
<i className="iconfont icon-fork font-18 fl mt6" style={{ color: "#8D90E3" }}></i>
|
||||
</Link>
|
||||
|
@ -391,7 +391,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 +400,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>
|
||||
|
@ -419,45 +419,45 @@ 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 }}>
|
||||
<li className={(url.indexOf("/issues") > -1 && !(url.indexOf("Milepost") > 0 || url.indexOf("meilpost") > 0 || url.indexOf("tags") > 0)) ? "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={url.indexOf("pulls") > -1 ? "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 }}>
|
||||
<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 className={url.indexOf("/milestones") > -1 ? "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={url.indexOf("/activity") > -1 ? "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 +474,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/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"
|
||||
<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/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} />)
|
||||
}
|
||||
|
|
|
@ -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}/coders/commits`} className={pathname.indexOf("/coders/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}/coders/branch`} className={pathname.indexOf("/coders/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}/coders/tag`} className={pathname.indexOf("/coders/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}/coders/releases`} className={pathname.indexOf("/coders/releases") > 0 ? "active" : ""}>
|
||||
<i className="iconfont icon-fahangban font-18 mr3"></i>
|
||||
<span>{(coderCount && coderCount.version_releasesed_count) || 0}</span>个发行版
|
||||
</Link>
|
||||
|
|
|
@ -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 ?
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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" }}
|
||||
>
|
||||
|
@ -158,7 +158,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/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
|
||||
>
|
||||
<i className="iconfont icon-huifu1 font-15 mr5 ver-middle"></i>
|
||||
{item.journals_count}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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,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,
|
||||
|
@ -425,7 +423,7 @@ 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">
|
||||
|
|
|
@ -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,
|
||||
|
@ -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}/pulls`
|
||||
: `/projects/${owner}/${projectsId}/pulls/${mergeId}/detail`
|
||||
}
|
||||
>
|
||||
<span className="plr10">取消</span>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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}/coders`);
|
||||
}
|
||||
}
|
||||
}).catch((error) => {
|
||||
|
|
|
@ -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}/coders?branch=${values.branchname}`
|
||||
: `/projects/${owner}/${projectsId}/coders`;
|
||||
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}/coders?branch=${values.branchname}`
|
||||
: `/projects/${owner}/${projectsId}/coders`;
|
||||
|
||||
this.props.history.push(url);
|
||||
this.props.showNotification("修改成功!");
|
||||
|
@ -113,7 +113,7 @@ 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;
|
||||
|
@ -228,7 +228,7 @@ class UserSubmitComponent extends Component {
|
|||
<Button
|
||||
type="primary grey"
|
||||
onClick={() => {
|
||||
this.props.history.push(`/projects/${projectsId}/coders`);
|
||||
this.props.history.push(`/projects/${owner}/${projectsId}/coders`);
|
||||
}}
|
||||
className="mr20"
|
||||
>
|
||||
|
|
|
@ -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: {
|
||||
|
@ -85,7 +85,7 @@ class Detail extends Component {
|
|||
})
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
this.props.history.push(`/projects/${projectsId}/orders`);
|
||||
this.props.history.push(`/projects/${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`
|
||||
);
|
||||
}
|
||||
})
|
||||
|
@ -186,7 +186,7 @@ class Detail extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { projectsId, orderId } = this.props.match.params;
|
||||
const { projectsId, orderId , owner } = 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/${owner}/${projectsId}/issues/${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}/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>
|
||||
|
@ -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}/milestones/${item.id}/edit`} className="color-grey-9">编辑</Link>
|
||||
</div>
|
||||
<div className="grid-item mr15 color-grey-9">
|
||||
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
|
||||
|
|
|
@ -55,8 +55,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 +70,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 +187,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)}>
|
||||
|
@ -203,8 +203,8 @@ class MilepostDetail extends Component {
|
|||
<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>
|
||||
<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>
|
||||
</div>
|
||||
<div className="grid-item mr10">
|
||||
|
@ -219,7 +219,7 @@ class MilepostDetail extends Component {
|
|||
}
|
||||
</span>
|
||||
<span className="font-weight-bold">
|
||||
{data && data.percent.toFixed(2)}%完成
|
||||
{data && data.percent && data.percent.toFixed(2)}%完成
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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}/milestones/${item.id}`} 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}/milestones/${item.id}/edit`} className="color-grey-9">编辑</Link>
|
||||
</div>
|
||||
<div className="grid-item mr15 color-grey-9">
|
||||
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
|
||||
|
|
|
@ -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>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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 (
|
||||
|
@ -54,7 +54,7 @@ class OrderItem extends Component {
|
|||
{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>
|
||||
<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)}>
|
||||
|
|
|
@ -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`);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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}/issues/new`}>
|
||||
+ 创建任务
|
||||
</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,
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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}/members/remove.json`;
|
||||
axios
|
||||
.delete(url, {
|
||||
data: {
|
||||
|
|
|
@ -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} />
|
||||
)}
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
// 翻页
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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}/coders/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}/coders/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}/coders/releases`)
|
||||
}
|
||||
style={{
|
||||
backgroundColor: "rgba(187,187,187,1)",
|
||||
|
|
|
@ -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/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}/coders/releases/new`} className="topWrapper_btn_new">+ 发布新版</Link>
|
||||
: ''
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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="输入名称进行搜索"
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
.markdown-body p {
|
||||
margin: 0 !important
|
||||
}
|
||||
.markdown-body img{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
|
|
Loading…
Reference in New Issue