This commit is contained in:
caishi 2020-08-13 11:42:44 +08:00
parent 537c9ae40a
commit 6fe871b8cb
14 changed files with 80 additions and 85 deletions

View File

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

View File

@ -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}/merge/new`} className="mr20 color-blue mr30">创建合并请求</Link>
<Dropdown overlay={menu(item.zip_url,item.tar_url)} trigger={['click']} placement="bottomRight" className="color-green-file">
<a className="ant-dropdown-link">
<Tooltip title={`下载分支${item.name}`}><Icon type="cloud-download" className="font-18"/></Tooltip>

View File

@ -33,8 +33,8 @@ class CoderRootCommit extends Component{
this.setState({
isSpining:true
})
const { projectsId } = this.props.match.params;
const url = `/repositories/${projectsId}/commits.json`;
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/commits.json`;
axios.get(url,{
params:{
sha:branch,

View File

@ -91,11 +91,11 @@ 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);
};
@ -130,9 +130,9 @@ class CoderRootDirectory extends Component {
};
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"
@ -160,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({
@ -246,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
@ -329,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)=>{
@ -478,13 +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>

View File

@ -116,7 +116,7 @@ class CoderRootIndex extends Component{
<Route path="/projects/:owner/:projectsId/coders/version/:versionId/update"
render={
() => (<CoderRootVersionUpdate {...this.props} {...this.state} />)
(props) => (<CoderRootVersionUpdate {...this.props} {...this.state} {...props} />)
}
></Route>

View File

@ -496,7 +496,7 @@ class Detail extends Component {
{/* 任务详情 */}
<Route path="/projects/:owner/:projectsId/orders/:orderId/detail"
render={
(props) => (<OrderDetail {...this.props} {...props} {...this.state} {...common} />)
(props) => (<OrderDetail {...this.props} {...this.state} {...props} {...common} />)
}
></Route>
{/* 里程碑 */}

View File

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

View File

@ -32,13 +32,13 @@ class UserSubmitComponent extends Component {
// 提交变更
subMitFrom = () => {
const { filepath, content, editor_type } = this.props;
const { branch, projectsId } = this.props.match.params;
const { branch, projectsId , owner } = this.props.match.params;
const { submitType, filename } = this.state;
this.setState({ isSpin: true });
let path = editor_type === "upload" ? filepath : filepath.substr(1);
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const url = `/repositories/${projectsId}/create_file.json`;
const url = `/${owner}/${projectsId}/create_file.json`;
axios.post(url, {
filepath: filename ? filename : path,
branch: branch,
@ -55,8 +55,8 @@ class UserSubmitComponent extends Component {
getTopCount && getTopCount(values.branchname);
}
let url = values.branchname
? `/projects/${projectsId}/coders?branch=${values.branchname}`
: `/projects/${projectsId}/coders`;
? `/projects/${owner}/${projectsId}/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"
>

View File

@ -186,7 +186,7 @@ class Detail extends Component {
};
render() {
const { projectsId, orderId , onwer } = 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/${onwer}/${projectsId}/orders/${orderId}/updatedetail`}
to={`/projects/${owner}/${projectsId}/orders/${orderId}/updatedetail`}
className="color-blue fr"
>
编辑

View File

@ -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}/orders/${meilid}/meilpost`} className="topWrapper_btn" style={{ marginRight: 15 }} >编辑里程碑</Link>
<Link to={`/projects/${owner}/${projectsId}/orders/${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>

View File

@ -45,7 +45,7 @@ class OrderItem extends Component {
}
render() {
const { item , checkbox , mile } = this.props;
const { projectsId } = this.props.match.params;
const { projectsId , owner } = this.props.match.params;
const { current_user } = this.props
return (
@ -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}/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>
{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}/orders/${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}/orders/${item.id}/updatedetail`} className="color-grey-9"><i className="iconfont icon-bianji3 font-14 mr5"></i></Link>
</div>
<div className="color-grey-9">
<Popconfirm placement="bottom" title={'您确定要删除吗'} okText="是" cancelText="否" onConfirm={() => this.deletedetail(item.id)}>

View File

@ -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}/orders/Milepost`);
}

View File

@ -44,7 +44,6 @@ class order_form extends Component {
}
componentDidMount = () => {
this.getSelectList();
};
get_detail = () => {
this.setState({
@ -87,13 +86,8 @@ class order_form extends Component {
});
};
getSelectList = () => {
let {projectsId, owner} = this.props.match.params;
let {projectsId, owner , milepostId} = this.props.match.params;
if (this.props.match.params.milepostId) {
this.props.form.setFieldsValue({
fixed_version_id: this.props.match.params.milepostId,
});
}
const url = `/${owner}/${projectsId}/issues/new.json`;
axios.get(url).then((result) => {
if (result) {
@ -102,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 || ""
});
}
}

View File

@ -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/version`);
}
});
} 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/version`);
}
});
}
@ -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/version`)
}
style={{
backgroundColor: "rgba(187,187,187,1)",