Merge pull request '修改新建合并请求页面目标分支存在但显示不存在bug以及提交详情页面的浏览文件按钮上移样式问题' (#177) from durian/forgeplus-react:router_v2_issue into pre_develop_dev

This commit is contained in:
jasder 2021-10-15 15:28:11 +08:00
commit 4b2651339b
2 changed files with 22 additions and 15 deletions

View File

@ -21,8 +21,8 @@ const Infos = styled.div`
& .markdown-body table{ & .markdown-body table{
background: #f1f8ff; background: #f1f8ff;
} }
& .f-wrap-between{ & .btnblue{
align-items: center; margin-top: 12px;
} }
& .task-hide{ & .task-hide{
width: 65rem; width: 65rem;

View File

@ -96,7 +96,6 @@ class CreateMerge extends Component {
// 再获取对应的仓库列表、分支列表 // 再获取对应的仓库列表、分支列表
// 再调用比较接口 // 再调用比较接口
const branchParams = getBranchParams(this.props.location.pathname); const branchParams = getBranchParams(this.props.location.pathname);
console.log('componentDidMount branchParams', branchParams);
this.getMergeInfo(branchParams); this.getMergeInfo(branchParams);
}; };
@ -106,7 +105,6 @@ class CreateMerge extends Component {
const newPathname = this.props.location.pathname; const newPathname = this.props.location.pathname;
if (oldPathname !== newPathname) { if (oldPathname !== newPathname) {
const branchParams = getBranchParams(newPathname); const branchParams = getBranchParams(newPathname);
console.log('componentDidUpdate branchParams', branchParams);
this.getMergeInfo(branchParams); this.getMergeInfo(branchParams);
} }
}; };
@ -142,22 +140,29 @@ class CreateMerge extends Component {
pull: pullBranch, pull: pullBranch,
}); });
if (!noMergeBranch && !noPullBranch) { //判断源分支是否存在
this.compareProject(result.data.id, branchParams); if(noPullBranch){
} else {
const _message = [];
noMergeBranch && _message.push('目标分支不存在');
noPullBranch && _message.push('源分支不存在');
this.setState({ this.setState({
showMessage: true, showMessage: true,
defaultMessage: _message.join(' , '), defaultMessage:'源分支不存在',
isCompareSpin: false,
});
}else{
if(pullOwner === mergeOwner){
if (!noMergeBranch) {
this.compareProject(result.data.id, branchParams);
} else {
this.setState({
showMessage: true,
defaultMessage:'目标分支不存在',
isCompareSpin: false, isCompareSpin: false,
}); });
} }
} }else{
if (pullOwner !== mergeOwner) {
this.getBranchList(branchParams); this.getBranchList(branchParams);
} }
}
}
this.setState({ isSpin: false }); this.setState({ isSpin: false });
}) })
.catch((error) => { .catch((error) => {
@ -225,7 +230,9 @@ class CreateMerge extends Component {
.length === 0; .length === 0;
this.setState({ this.setState({
mergeBranches: result.data, mergeBranches: result.data,
merge: noMergeBranch ? 'master' : mergeBranch, showMessage: noMergeBranch,
defaultMessage: '目标分支不存在',
isCompareSpin: false,
}); });
} }
this.setState({ isSpin: false }); this.setState({ isSpin: false });