forked from Gitlink/forgeplus-react
Merge pull request '优化' (#290) from durian/forgeplus-react:gitlink_server into gitlink_server
This commit is contained in:
commit
534a6bdeab
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@
|
|||
"antd": "^3.26.15",
|
||||
"array-flatten": "^2.1.2",
|
||||
"autoprefixer": "7.1.6",
|
||||
"axios": "^0.18.1",
|
||||
"axios": "^0.24.0",
|
||||
"babel-eslint": "7.2.3",
|
||||
"babel-jest": "20.0.3",
|
||||
"babel-loader": "7.1.2",
|
||||
|
@ -24,11 +24,11 @@
|
|||
"classnames": "^2.2.5",
|
||||
"clipboard": "^2.0.8",
|
||||
"code-prettify": "^0.1.0",
|
||||
"codemirror": "^5.53.0",
|
||||
"codemirror": "^5.64.0",
|
||||
"connected-react-router": "4.4.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^3.5.2",
|
||||
"dompurify": "^2.0.15",
|
||||
"dompurify": "^2.3.3",
|
||||
"dotenv": "4.0.0",
|
||||
"dotenv-expand": "4.2.0",
|
||||
"echarts": "^4.9.0",
|
||||
|
@ -51,7 +51,7 @@
|
|||
"js-base64": "^2.5.2",
|
||||
"js2wordcloud": "^1.1.12",
|
||||
"katex": "^0.11.1",
|
||||
"lodash": "^4.17.15",
|
||||
"lodash": "^4.17.21",
|
||||
"loglevel": "^1.6.8",
|
||||
"marked": "^1.0.0",
|
||||
"material-ui": "^1.0.0-beta.40",
|
||||
|
|
|
@ -423,6 +423,10 @@ class Detail extends Component {
|
|||
const url = `/${owner}/${projectsId}/forks.json`;
|
||||
axios.post(url).then(result => {
|
||||
if (result && result.data.status === 0) {
|
||||
if(result.data.message === "fork失败,你已拥有了这个项目"){
|
||||
this.props.history.push(`/${current_user && current_user.login}/${projectsId}`);
|
||||
return;
|
||||
}
|
||||
this.props.history.push(`/${current_user && current_user.login}/${result.data.identifier}`);
|
||||
this.props.showNotification(result.data.message);
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class CreateMerge extends Component {
|
|||
// 再获取对应的仓库列表、分支列表
|
||||
// 再调用比较接口
|
||||
const branchParams = getBranchParams(this.props.location.pathname);
|
||||
this.getMergeInfo(branchParams);
|
||||
this.getMergeInfo(branchParams,true);
|
||||
};
|
||||
|
||||
componentDidUpdate = (preProps) => {
|
||||
|
@ -110,15 +110,20 @@ class CreateMerge extends Component {
|
|||
};
|
||||
|
||||
//获取新建合并请求数据
|
||||
getMergeInfo = (branchParams) => {
|
||||
getMergeInfo = (branchParams,init) => {
|
||||
this.setState({ isSpin: true });
|
||||
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } =
|
||||
branchParams;
|
||||
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams;
|
||||
const url = `/${pullOwner}/${projectId}/pulls/new.json`;
|
||||
axios
|
||||
.get(url)
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
if(init){
|
||||
//页面初始化时调用selectProjectName,给is_original、fork_project_id、merge_user_login赋值
|
||||
const initUser = result.data.projects_names && result.data.projects_names.filter((item)=>item.project_user_login === branchParams.mergeOwner);
|
||||
initUser && initUser[0] && this.selectProjectName(initUser[0].id,false,{projects_names: result.data.projects_names,id: result.data.id});
|
||||
}
|
||||
this.setState({isSpin: false});
|
||||
// 如果url上的分支不存在,取默认值master
|
||||
const noMergeBranch =
|
||||
(result.data.branches || []).filter(
|
||||
|
@ -175,8 +180,7 @@ class CreateMerge extends Component {
|
|||
compareProject = (sameProject, branchParams) => {
|
||||
// const { project } = this.props;
|
||||
// const { owner, projectsId } = this.props.match.params;
|
||||
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } =
|
||||
branchParams;
|
||||
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams;
|
||||
|
||||
let url = `/${mergeOwner}/${projectId}/compare`;
|
||||
if (sameProject) {
|
||||
|
@ -262,8 +266,8 @@ class CreateMerge extends Component {
|
|||
};
|
||||
|
||||
// 切换仓库响应事件,目前仅目标分支可切换仓库
|
||||
selectProjectName = (value) => {
|
||||
const { projects_names, id } = this.state;
|
||||
selectProjectName = (value, isChangeProject, initPro) => {
|
||||
const { projects_names, id } = isChangeProject ? this.state : initPro;
|
||||
const { pullOwner, pullBranch } = getBranchParams(
|
||||
this.props.location.pathname
|
||||
);
|
||||
|
@ -274,7 +278,8 @@ class CreateMerge extends Component {
|
|||
// 目标仓库与源仓库不是一个仓库
|
||||
let is_fork = parseInt(value, 10) !== parseInt(id, 10);
|
||||
this.setState({
|
||||
isSpin: true,
|
||||
// 切换目标仓库时url会发生变化,即有spin效果
|
||||
// isSpin: true,
|
||||
// merge_head: is_fork,
|
||||
data: {
|
||||
is_original: is_fork,
|
||||
|
@ -284,15 +289,18 @@ class CreateMerge extends Component {
|
|||
: undefined,
|
||||
},
|
||||
});
|
||||
if (login === pullOwner) {
|
||||
// 如果切换后, 仓库与源仓库一致了
|
||||
this.props.history.push(
|
||||
`/${login}/${identifier}/compare/master...${pullBranch}`
|
||||
);
|
||||
} else {
|
||||
this.props.history.push(
|
||||
`/${login}/${identifier}/compare/master...${pullOwner}:${pullBranch}`
|
||||
);
|
||||
// 加上是否需要切换url判断
|
||||
if(isChangeProject){
|
||||
if (login === pullOwner) {
|
||||
// 如果切换后, 仓库与源仓库一致了
|
||||
this.props.history.push(
|
||||
`/${login}/${identifier}/compare/master...${pullBranch}`
|
||||
);
|
||||
} else {
|
||||
this.props.history.push(
|
||||
`/${login}/${identifier}/compare/master...${pullOwner}:${pullBranch}`
|
||||
);
|
||||
}
|
||||
}
|
||||
// this.newMergelist(login, identifier);
|
||||
};
|
||||
|
@ -354,7 +362,7 @@ class CreateMerge extends Component {
|
|||
<div className="main">
|
||||
<div className="merge-header width100 inline-block">
|
||||
<div className="width40 pull-left">
|
||||
<div className="color-grey-3 mb10 fwb">源分支:</div>
|
||||
<div className="color-grey-3 mb10 fwb">源分支 : </div>
|
||||
<Input.Group compact className="display-flex">
|
||||
<Select
|
||||
value={id}
|
||||
|
@ -382,12 +390,12 @@ class CreateMerge extends Component {
|
|||
</div>
|
||||
<div className="width40 pull-left">
|
||||
<div>
|
||||
<div className="color-grey-3 mb10 fwb">目标分支:</div>
|
||||
<div className="color-grey-3 mb10 fwb">目标分支 : </div>
|
||||
<Input.Group compact className="display-flex">
|
||||
<Select
|
||||
value={project && project.id}
|
||||
className="hide-1 task-hide flex1"
|
||||
onSelect={(e) => this.selectProjectName(e)}
|
||||
onSelect={(e) => this.selectProjectName(e, true)}
|
||||
>
|
||||
{this.renderProjectNames(mergeProjects)}
|
||||
</Select>
|
||||
|
|
|
@ -115,7 +115,7 @@ class MergeItem extends Component {
|
|||
{item.is_original
|
||||
? item.fork_project_user_name
|
||||
: item.author_name}
|
||||
:{item.pull_request_head}
|
||||
: {item.pull_request_head}
|
||||
</Link>
|
||||
</Tag>
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ class MergeItem extends Component {
|
|||
to={`/${owner}/${projectsId}/tree/${turnbar(item.pull_request_base)}`}
|
||||
className="maxW200px task-hide ver-middle" style={{maxWidth:"200px"}}
|
||||
>
|
||||
{project_author_name}:{item.pull_request_base}
|
||||
{project_author_name}: {item.pull_request_base}
|
||||
</Link>
|
||||
</Tag>
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ class MessageCount extends Component {
|
|||
to={`/${owner}/${projectsId}/tree/${data.pull_request.base}`}
|
||||
className="ver-middle task-hide" style={{maxWidth:"200px"}} title={`${data.issue.project_author_name}:${data.pull_request.base}`}
|
||||
>
|
||||
{data.issue.project_author_name}:{data.pull_request.base}
|
||||
{data.issue.project_author_name}: {data.pull_request.base}
|
||||
</Link>
|
||||
</Tag>
|
||||
</div>
|
||||
|
|
|
@ -61,7 +61,7 @@ class UpdateMerge extends Component {
|
|||
<div>
|
||||
<div className="merge-header width100 inline-block">
|
||||
<div className="width45 pull-left">
|
||||
<div className="color-grey-3 mb10 fwb">源分支:</div>
|
||||
<div className="color-grey-3 mb10 fwb">源分支 : </div>
|
||||
|
||||
<Input.Group compact className="display-flex">
|
||||
<Button className="merge-header-button flex1 maxW50 hide-1 task-hide" disabled>
|
||||
|
|
|
@ -102,9 +102,9 @@ class order_form extends Component {
|
|||
|
||||
if(this.props.form_type === "feedback"){
|
||||
let data ={
|
||||
//指派给段甲生,类型:缺陷,优先度:正常,issue状态:新增
|
||||
//指定指派成员,类型:缺陷,优先度:正常,issue状态:新增
|
||||
tracker_id: "1",
|
||||
assigned_to_id: "36480",
|
||||
assigned_to_id: window.location.host === "gitlink.org.cn" ? "86107":"36480",
|
||||
priority_id: "2",
|
||||
status_id: "1",
|
||||
description:"####问题描述\n\n\n####重现问题步骤\n\n\n####截图\n\n\n####建议解决办法\n",
|
||||
|
|
Loading…
Reference in New Issue