处理页面刷新之后创建合并请求报错问题
This commit is contained in:
parent
eff12234fa
commit
4b1bccd1cd
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@
|
||||||
"antd": "^3.26.15",
|
"antd": "^3.26.15",
|
||||||
"array-flatten": "^2.1.2",
|
"array-flatten": "^2.1.2",
|
||||||
"autoprefixer": "7.1.6",
|
"autoprefixer": "7.1.6",
|
||||||
"axios": "^0.18.1",
|
"axios": "^0.24.0",
|
||||||
"babel-eslint": "7.2.3",
|
"babel-eslint": "7.2.3",
|
||||||
"babel-jest": "20.0.3",
|
"babel-jest": "20.0.3",
|
||||||
"babel-loader": "7.1.2",
|
"babel-loader": "7.1.2",
|
||||||
|
@ -24,11 +24,11 @@
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5",
|
||||||
"clipboard": "^2.0.8",
|
"clipboard": "^2.0.8",
|
||||||
"code-prettify": "^0.1.0",
|
"code-prettify": "^0.1.0",
|
||||||
"codemirror": "^5.53.0",
|
"codemirror": "^5.64.0",
|
||||||
"connected-react-router": "4.4.1",
|
"connected-react-router": "4.4.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"css-loader": "^3.5.2",
|
"css-loader": "^3.5.2",
|
||||||
"dompurify": "^2.0.15",
|
"dompurify": "^2.3.3",
|
||||||
"dotenv": "4.0.0",
|
"dotenv": "4.0.0",
|
||||||
"dotenv-expand": "4.2.0",
|
"dotenv-expand": "4.2.0",
|
||||||
"echarts": "^4.9.0",
|
"echarts": "^4.9.0",
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
"js-base64": "^2.5.2",
|
"js-base64": "^2.5.2",
|
||||||
"js2wordcloud": "^1.1.12",
|
"js2wordcloud": "^1.1.12",
|
||||||
"katex": "^0.11.1",
|
"katex": "^0.11.1",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.21",
|
||||||
"loglevel": "^1.6.8",
|
"loglevel": "^1.6.8",
|
||||||
"marked": "^1.0.0",
|
"marked": "^1.0.0",
|
||||||
"material-ui": "^1.0.0-beta.40",
|
"material-ui": "^1.0.0-beta.40",
|
||||||
|
|
|
@ -97,6 +97,11 @@ class CreateMerge extends Component {
|
||||||
// 再调用比较接口
|
// 再调用比较接口
|
||||||
const branchParams = getBranchParams(this.props.location.pathname);
|
const branchParams = getBranchParams(this.props.location.pathname);
|
||||||
this.getMergeInfo(branchParams);
|
this.getMergeInfo(branchParams);
|
||||||
|
//页面初始化时调用selectProjectName,给is_original、fork_project_id、merge_user_login赋值
|
||||||
|
setTimeout(()=>{
|
||||||
|
const init = this.state.projects_names && this.state.projects_names.filter((item)=>item.project_user_login === branchParams.mergeOwner);
|
||||||
|
init && init[0] && this.selectProjectName(init[0].id,false);
|
||||||
|
},500)
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidUpdate = (preProps) => {
|
componentDidUpdate = (preProps) => {
|
||||||
|
@ -175,8 +180,7 @@ class CreateMerge extends Component {
|
||||||
compareProject = (sameProject, branchParams) => {
|
compareProject = (sameProject, branchParams) => {
|
||||||
// const { project } = this.props;
|
// const { project } = this.props;
|
||||||
// const { owner, projectsId } = this.props.match.params;
|
// const { owner, projectsId } = this.props.match.params;
|
||||||
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } =
|
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams;
|
||||||
branchParams;
|
|
||||||
|
|
||||||
let url = `/${mergeOwner}/${projectId}/compare`;
|
let url = `/${mergeOwner}/${projectId}/compare`;
|
||||||
if (sameProject) {
|
if (sameProject) {
|
||||||
|
@ -262,7 +266,7 @@ class CreateMerge extends Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
// 切换仓库响应事件,目前仅目标分支可切换仓库
|
// 切换仓库响应事件,目前仅目标分支可切换仓库
|
||||||
selectProjectName = (value) => {
|
selectProjectName = (value, isChangeProject) => {
|
||||||
const { projects_names, id } = this.state;
|
const { projects_names, id } = this.state;
|
||||||
const { pullOwner, pullBranch } = getBranchParams(
|
const { pullOwner, pullBranch } = getBranchParams(
|
||||||
this.props.location.pathname
|
this.props.location.pathname
|
||||||
|
@ -274,7 +278,8 @@ class CreateMerge extends Component {
|
||||||
// 目标仓库与源仓库不是一个仓库
|
// 目标仓库与源仓库不是一个仓库
|
||||||
let is_fork = parseInt(value, 10) !== parseInt(id, 10);
|
let is_fork = parseInt(value, 10) !== parseInt(id, 10);
|
||||||
this.setState({
|
this.setState({
|
||||||
isSpin: true,
|
// 切换目标仓库时url会发生变化,即有spin效果
|
||||||
|
// isSpin: true,
|
||||||
// merge_head: is_fork,
|
// merge_head: is_fork,
|
||||||
data: {
|
data: {
|
||||||
is_original: is_fork,
|
is_original: is_fork,
|
||||||
|
@ -284,6 +289,8 @@ class CreateMerge extends Component {
|
||||||
: undefined,
|
: undefined,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// 加上是否需要切换url判断
|
||||||
|
if(isChangeProject){
|
||||||
if (login === pullOwner) {
|
if (login === pullOwner) {
|
||||||
// 如果切换后, 仓库与源仓库一致了
|
// 如果切换后, 仓库与源仓库一致了
|
||||||
this.props.history.push(
|
this.props.history.push(
|
||||||
|
@ -294,6 +301,7 @@ class CreateMerge extends Component {
|
||||||
`/${login}/${identifier}/compare/master...${pullOwner}:${pullBranch}`
|
`/${login}/${identifier}/compare/master...${pullOwner}:${pullBranch}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// this.newMergelist(login, identifier);
|
// this.newMergelist(login, identifier);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -387,7 +395,7 @@ class CreateMerge extends Component {
|
||||||
<Select
|
<Select
|
||||||
value={project && project.id}
|
value={project && project.id}
|
||||||
className="hide-1 task-hide flex1"
|
className="hide-1 task-hide flex1"
|
||||||
onSelect={(e) => this.selectProjectName(e)}
|
onSelect={(e) => this.selectProjectName(e, true)}
|
||||||
>
|
>
|
||||||
{this.renderProjectNames(mergeProjects)}
|
{this.renderProjectNames(mergeProjects)}
|
||||||
</Select>
|
</Select>
|
||||||
|
|
Loading…
Reference in New Issue