Merge branch 'pre_develop' of https://git.trustie.net/Gitlink/forgeplus-react into feature_notification_v2_noticeSettings

This commit is contained in:
谢思 2021-10-21 09:41:44 +08:00
commit a0081bf3b1
1 changed files with 32 additions and 33 deletions

View File

@ -150,7 +150,7 @@ class CreateMerge extends Component {
}else{
if(pullOwner === mergeOwner){
if (!noMergeBranch) {
this.compareProject(result.data.id, branchParams);
this.compareProject(true, branchParams);
} else {
this.setState({
showMessage: true,
@ -172,53 +172,51 @@ class CreateMerge extends Component {
};
// compare接口获取分支对比信息
compareProject = (baseid, branchParams) => {
compareProject = (sameProject, branchParams) => {
// const { project } = this.props;
// const { owner, projectsId } = this.props.match.params;
const projectObj = this.props.project;
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } =
branchParams;
let url = `/${mergeOwner}/${projectId}/compare`;
if (projectObj) {
if (baseid === projectObj.id) {
url += `/${pullBranch}...${mergeBranch}.json`;
} else {
url += `/${mergeBranch}...${pullOwner}/${projectId}:${pullBranch}.json`;
}
this.setState({ isSpin: false, isCompareSpin: true });
axios
.get(url)
.then((result) => {
if (result) {
if (result.data.status === 0) {
this.setState({
showMessage: false,
});
} else {
this.setState({
showMessage: true,
defaultMessage: result.data.message,
});
}
if (sameProject) {
url += `/${pullBranch}...${mergeBranch}.json`;
} else {
url += `/${mergeBranch}...${pullOwner}/${projectId}:${pullBranch}.json`;
}
this.setState({ isSpin: false, isCompareSpin: true });
axios
.get(url)
.then((result) => {
if (result) {
if (result.data.status === 0) {
this.setState({
comparesData: result.data,
showMessage: false,
});
} else {
this.setState({
showMessage: true,
defaultMessage: result.data.message,
});
}
this.setState({
isFirstLoading: false,
isSpin: false,
isCompareSpin: false,
comparesData: result.data,
});
})
.catch((error) => {
this.setState({ isSpin: false, isCompareSpin: false });
}
this.setState({
isFirstLoading: false,
isSpin: false,
isCompareSpin: false,
});
}
})
.catch((error) => {
this.setState({ isSpin: false, isCompareSpin: false });
});
};
// 根据所有者、仓库名,获取分支列表,目前仅涉及目标仓库分支查询
getBranchList = ({ mergeOwner, projectId, mergeBranch }) => {
getBranchList = (branchParams) => {
const { mergeOwner, projectId, mergeBranch } = branchParams;
this.setState({ isSpin: true });
const url = `/${mergeOwner}/${projectId}/pulls/get_branches.json`;
axios
@ -234,6 +232,7 @@ class CreateMerge extends Component {
defaultMessage: '目标分支不存在',
isCompareSpin: false,
});
!noMergeBranch && this.compareProject(false, branchParams);
}
this.setState({ isSpin: false });
})