forked from Gitlink/forgeplus-react
Merge pull request 'issue-以及分支含特殊字符的处理' (#330) from caishi/forgeplus-react:gitlink_server into gitlink_server
This commit is contained in:
commit
afaef5f0d0
|
@ -1,8 +1,8 @@
|
|||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 2340181 */
|
||||
src: url('iconfont.woff2?t=1639038498486') format('woff2'),
|
||||
url('iconfont.woff?t=1639038498486') format('woff'),
|
||||
url('iconfont.ttf?t=1639038498486') format('truetype');
|
||||
src: url('iconfont.woff2?t=1640585290619') format('woff2'),
|
||||
url('iconfont.woff?t=1640585290619') format('woff'),
|
||||
url('iconfont.ttf?t=1640585290619') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
|
@ -13,6 +13,26 @@
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-shengming:before {
|
||||
content: "\e90b";
|
||||
}
|
||||
|
||||
.icon-chenggong1:before {
|
||||
content: "\e907";
|
||||
}
|
||||
|
||||
.icon-a-bitian2x1:before {
|
||||
content: "\e908";
|
||||
}
|
||||
|
||||
.icon-xiala1:before {
|
||||
content: "\e909";
|
||||
}
|
||||
|
||||
.icon-xiala2:before {
|
||||
content: "\e90a";
|
||||
}
|
||||
|
||||
.icon-jiantou1:before {
|
||||
content: "\e905";
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,41 @@
|
|||
"css_prefix_text": "icon-",
|
||||
"description": "",
|
||||
"glyphs": [
|
||||
{
|
||||
"icon_id": "12505154",
|
||||
"name": "声明",
|
||||
"font_class": "shengming",
|
||||
"unicode": "e90b",
|
||||
"unicode_decimal": 59659
|
||||
},
|
||||
{
|
||||
"icon_id": "26470597",
|
||||
"name": "成功",
|
||||
"font_class": "chenggong1",
|
||||
"unicode": "e907",
|
||||
"unicode_decimal": 59655
|
||||
},
|
||||
{
|
||||
"icon_id": "26470599",
|
||||
"name": "必填@2x",
|
||||
"font_class": "a-bitian2x1",
|
||||
"unicode": "e908",
|
||||
"unicode_decimal": 59656
|
||||
},
|
||||
{
|
||||
"icon_id": "26470600",
|
||||
"name": "下拉",
|
||||
"font_class": "xiala1",
|
||||
"unicode": "e909",
|
||||
"unicode_decimal": 59657
|
||||
},
|
||||
{
|
||||
"icon_id": "26470601",
|
||||
"name": "下拉2",
|
||||
"font_class": "xiala2",
|
||||
"unicode": "e90a",
|
||||
"unicode_decimal": 59658
|
||||
},
|
||||
{
|
||||
"icon_id": "26363219",
|
||||
"name": "箭头",
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -435,7 +435,7 @@ function CoderDepot(props){
|
|||
<div className="addOptionBtn">
|
||||
{
|
||||
baseOperate &&
|
||||
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/compare/master...${branchName || defaultBranch}`)} >+ 合并请求</CheckProfile>
|
||||
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/compare/master...${turnbar(branchName || defaultBranch)}`)} >+ 合并请求</CheckProfile>
|
||||
}
|
||||
<a onClick={createIssue}>+ 疑修</a>
|
||||
{/* {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React , { Component } from 'react';
|
||||
import { Spin , Pagination, Timeline } from 'antd';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import { getImageUrl , returnbar } from 'educoder';
|
||||
import { truncateCommitId ,timeFormat } from '../common/util';
|
||||
import { AlignTop } from '../Component/layout';
|
||||
import SelectBranch from '../Branch/Select';
|
||||
|
@ -15,12 +15,6 @@ import CopyTool from '../Component/CopyTool';
|
|||
|
||||
import './tree/Index.scss'
|
||||
|
||||
function returnbar(str){
|
||||
if(str && str.length>0 && str.indexOf("%2F")>-1){
|
||||
return str.replaceAll('%2F','/');
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
//代码库--提交页面
|
||||
class CoderRootCommit extends Component{
|
||||
|
@ -79,7 +73,7 @@ class CoderRootCommit extends Component{
|
|||
isSpining:true,
|
||||
page:realPage
|
||||
})
|
||||
this.getCommitList( branchName , realPage , limit );
|
||||
this.getCommitList( returnbar(branchName) , realPage , limit );
|
||||
}
|
||||
|
||||
getCommitList=(branch , page , limit)=>{
|
||||
|
|
|
@ -3,6 +3,8 @@ import { Input, Select, Spin, Alert } from 'antd';
|
|||
import axios from 'axios';
|
||||
import MergeForm from './merge_form';
|
||||
import MergeFooter from './merge_footer';
|
||||
import { returnbar , turnbar } from 'educoder';
|
||||
import { Base64 } from 'js-base64';
|
||||
|
||||
import '../Order/order.css';
|
||||
import './merge.css';
|
||||
|
@ -72,8 +74,8 @@ class CreateMerge extends Component {
|
|||
pullBranches: undefined,
|
||||
mergeBranches: undefined,
|
||||
mergeProjects: undefined,
|
||||
merge: mergeBranch || 'master',
|
||||
pull: pullBranch || 'master',
|
||||
merge: returnbar(mergeBranch) || 'master',
|
||||
pull: returnbar(pullBranch) || 'master',
|
||||
id: undefined,
|
||||
// isFork: false,
|
||||
projects_names: undefined,
|
||||
|
@ -127,11 +129,11 @@ class CreateMerge extends Component {
|
|||
// 如果url上的分支不存在,取默认值master
|
||||
const noMergeBranch =
|
||||
(result.data.branches || []).filter(
|
||||
(branch) => branch.name === mergeBranch
|
||||
(branch) => branch.name === returnbar(mergeBranch)
|
||||
).length === 0;
|
||||
const noPullBranch =
|
||||
(result.data.branches || []).filter(
|
||||
(branch) => branch.name === pullBranch
|
||||
(branch) => branch.name === returnbar(pullBranch)
|
||||
).length === 0;
|
||||
this.setState({
|
||||
// isFork: result.data.is_fork,
|
||||
|
@ -141,8 +143,8 @@ class CreateMerge extends Component {
|
|||
mergeBranches: result.data.branches,
|
||||
project_id: result.data.project_id,
|
||||
id: result.data.id,
|
||||
merge: mergeBranch,
|
||||
pull: pullBranch,
|
||||
merge: returnbar(mergeBranch),
|
||||
pull: returnbar(pullBranch),
|
||||
});
|
||||
|
||||
//判断源分支是否存在
|
||||
|
@ -153,7 +155,7 @@ class CreateMerge extends Component {
|
|||
isCompareSpin: false,
|
||||
});
|
||||
}else{
|
||||
if(pullOwner === mergeOwner){
|
||||
if(pullOwner === returnbar(mergeOwner)){
|
||||
if (!noMergeBranch) {
|
||||
this.compareProject(true, branchParams);
|
||||
} else {
|
||||
|
@ -179,13 +181,13 @@ class CreateMerge extends Component {
|
|||
// compare接口,获取分支对比信息
|
||||
compareProject = (sameProject, branchParams) => {
|
||||
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams;
|
||||
|
||||
let url = `/${mergeOwner}/${projectId}/compare`;
|
||||
if (sameProject) {
|
||||
url += `/${pullBranch}...${mergeBranch}.json`;
|
||||
url += `/${Base64.encode(returnbar(pullBranch))}...${Base64.encode(returnbar(mergeBranch))}.json`;
|
||||
} else {
|
||||
url += `/${mergeBranch}...${pullOwner}/${projectId}:${pullBranch}.json`;
|
||||
url += `/${Base64.encode(returnbar(mergeBranch))}...${pullOwner}/${projectId}:${Base64.encode(returnbar(pullBranch))}.json`;
|
||||
}
|
||||
console.log(url);
|
||||
this.setState({ isSpin: false, isCompareSpin: true });
|
||||
axios
|
||||
.get(url)
|
||||
|
@ -255,10 +257,10 @@ class CreateMerge extends Component {
|
|||
let _mergeBranch = type === 'pull' ? mergeBranch : value;
|
||||
if (pullOwner === mergeOwner) {
|
||||
// 如果仓库相同, compare/目标分支...源分支
|
||||
_url += `${_mergeBranch}...${_pullBranch}`;
|
||||
_url += `${turnbar(_mergeBranch)}...${turnbar(_pullBranch)}`;
|
||||
} else {
|
||||
// 如果仓库不同, compare/目标分支...源分支
|
||||
_url += `${_mergeBranch}...${pullOwner}:${_pullBranch}`;
|
||||
_url += `${turnbar(_mergeBranch)}...${pullOwner}:${turnbar(_pullBranch)}`;
|
||||
}
|
||||
this.props.history.push(_url);
|
||||
};
|
||||
|
@ -292,11 +294,11 @@ class CreateMerge extends Component {
|
|||
if (login === pullOwner) {
|
||||
// 如果切换后, 仓库与源仓库一致了
|
||||
this.props.history.push(
|
||||
`/${login}/${identifier}/compare/master...${pullBranch}`
|
||||
`/${login}/${identifier}/compare/master...${turnbar(pullBranch)}`
|
||||
);
|
||||
} else {
|
||||
this.props.history.push(
|
||||
`/${login}/${identifier}/compare/master...${pullOwner}:${pullBranch}`
|
||||
`/${login}/${identifier}/compare/master...${pullOwner}:${turnbar(pullBranch)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,6 +126,30 @@ class UserSubmitComponent extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
checkBranchName=(rule, value, callback)=>{
|
||||
if(!value){
|
||||
callback();
|
||||
}
|
||||
if (value) {
|
||||
const str = '^*/';
|
||||
let reg = /\\/g;
|
||||
if(reg.test(value)){
|
||||
callback(<span>分支名不能包含下列任何字符:^*\/</span>);
|
||||
}else{
|
||||
for(var i=0;i<str.length;i++){
|
||||
let s = str[i];
|
||||
if(value.indexOf(s) > -1){
|
||||
callback(<span>分支名不能包含下列任何字符:^*\/</span>);
|
||||
return;
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { submitType, filename, isSpin } = this.state;
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
|
@ -211,6 +235,9 @@ class UserSubmitComponent extends Component {
|
|||
required: true,
|
||||
message: "请输入分支名称",
|
||||
},
|
||||
{
|
||||
validator:this.checkBranchName
|
||||
}
|
||||
],
|
||||
})(
|
||||
<Input
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { Component } from "react";
|
||||
import React, { Component, useRef } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import axios from "axios";
|
||||
|
@ -173,6 +173,15 @@ class Detail extends Component {
|
|||
return <RenderHtml className="break_word_comments imageLayerParent" value={v} url={this.props.history.location} />;
|
||||
};
|
||||
|
||||
|
||||
bindCommentRef = (commentRef) => {
|
||||
this.childComment = commentRef;
|
||||
}
|
||||
|
||||
refreshFunc=()=> {
|
||||
this.childComment && this.childComment.getjournalslist();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { projectsId, orderId, owner } = this.props.match.params;
|
||||
const { data, isSpins } = this.state;
|
||||
|
@ -292,11 +301,12 @@ class Detail extends Component {
|
|||
order_id={orderId}
|
||||
showNotification={this.props.showNotification}
|
||||
{...this.props}
|
||||
bindCommentRef={this.bindCommentRef}
|
||||
/>
|
||||
</div>
|
||||
<div className="list-left list-left-padding">
|
||||
<div className="list-right-item-padding background-f boder-4">
|
||||
<Claims issue_id={orderId} {...this.props} />
|
||||
<Claims issue_id={orderId} {...this.props} refreshFunc={this.refreshFunc}/>
|
||||
</div>
|
||||
|
||||
<div className="list-right-item-padding background-f boder-4">
|
||||
|
|
|
@ -692,7 +692,7 @@ a.issue-type-button.active:hover {
|
|||
.issue-edit-form-right{margin-bottom: 0 !important;}
|
||||
.plr10{padding: 0 10px;}
|
||||
.issue-form-index .editormd-toolbar{position: absolute !important;}
|
||||
.list-right-item-padding{padding: 20px 35px 10px 35px;}
|
||||
.list-right-item-padding{padding: 20px 35px 10px 35px;margin-bottom: 20px;}
|
||||
.tagColor {
|
||||
display: inline-block;
|
||||
width: 28px;
|
||||
|
|
|
@ -60,13 +60,13 @@
|
|||
flex-wrap: wrap;
|
||||
padding-bottom: 2px;
|
||||
a{
|
||||
margin: 0px 17px 10px 0px;
|
||||
margin: 0px 10px 10px 0px;
|
||||
img{
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
&:nth-child(5n){
|
||||
&:nth-child(4n){
|
||||
margin-right: 0px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ class claims extends React.Component {
|
|||
claimNotePop:false,
|
||||
claimNoteBody:'',
|
||||
});
|
||||
const { refreshFunc } = this.props;
|
||||
refreshFunc && refreshFunc();
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
|
@ -69,6 +71,7 @@ class claims extends React.Component {
|
|||
|
||||
yesClaim = ()=>{
|
||||
const {issue_id,claimNoteBody} = this.state;
|
||||
const { refreshFunc } = this.props;
|
||||
|
||||
axios.post(`/issues/${issue_id}/claims.json`, {
|
||||
claim_note: claimNoteBody
|
||||
|
@ -79,6 +82,7 @@ class claims extends React.Component {
|
|||
currentUserClaimed: result.data.currentUserclaimed,
|
||||
claimNotePop:false,
|
||||
});
|
||||
refreshFunc && refreshFunc();
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
|
@ -99,6 +103,7 @@ class claims extends React.Component {
|
|||
|
||||
updateClaim = (claimId,key)=>{
|
||||
const {issue_id,claimNoteBody,claimNoteBodyChanged} = this.state;
|
||||
const { refreshFunc } = this.props;
|
||||
if(claimNoteBodyChanged){
|
||||
axios.put(`/issues/${issue_id}/claims.json`, {
|
||||
claim_note: claimNoteBody,
|
||||
|
@ -109,6 +114,7 @@ class claims extends React.Component {
|
|||
claimerdata: result.data.claimers,
|
||||
currentUserClaimed: result.data.currentUserclaimed,
|
||||
});
|
||||
refreshFunc && refreshFunc();
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
|
@ -238,12 +244,12 @@ class claims extends React.Component {
|
|||
|
||||
return (
|
||||
<div>
|
||||
{currentUserClaimed==1?(
|
||||
<div><Button onClick={()=>this.delClaim()} > 取消声明 </Button>
|
||||
{currentUserClaimed===1?(
|
||||
<div><Button onClick={()=>this.delClaim()} >取消声明</Button>
|
||||
</div>
|
||||
):(
|
||||
<Popover visible={this.state.claimNotePop} content={renderClaim()} trigger='click' placement="bottom" overlayClassName="menuPanels">
|
||||
<Button onClick={()=> this.addClaim()} type="primary" className="mr15" > 声 明 </Button>
|
||||
<Button onClick={()=> this.addClaim()} type="primary"><i className="iconfont icon-shengming font-14 mr5 color-white"></i>声明</Button>
|
||||
</Popover>
|
||||
)}
|
||||
|
||||
|
@ -253,7 +259,10 @@ class claims extends React.Component {
|
|||
{
|
||||
claimerdata&&claimerdata.length>0?(
|
||||
<div>
|
||||
<span>声明要关注/解决此疑修的用户</span><span className="infoCount">{claimerdata.length}</span>
|
||||
<div className="mt15">
|
||||
<span>声明要关注/解决此疑修的用户</span>
|
||||
<span className="infoCount">{claimerdata.length}</span>
|
||||
</div>
|
||||
<div className="attrPerson" onMouseLeave={()=>this.setVisibleFunc(false)}>
|
||||
{claimerdata.map((item,key)=>{
|
||||
return(
|
||||
|
@ -266,7 +275,10 @@ class claims extends React.Component {
|
|||
})}
|
||||
</div>
|
||||
</div>):(
|
||||
<div><span>声明要关注/解决此疑修的用户</span> <span className="infoCount">0</span></div>
|
||||
<div className='mt15'>
|
||||
<span>声明要关注/解决此疑修的用户</span>
|
||||
<span className="infoCount">0</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
|
|
|
@ -76,9 +76,9 @@ export default Form.create()(
|
|||
<div>
|
||||
<Form.Item label="性别">
|
||||
{getFieldDecorator("gender",{
|
||||
rules:[{required:true,message:"请选择性别"}]
|
||||
rules:[]
|
||||
})(
|
||||
<Radio.Group>
|
||||
<Radio.Group defaultValue={1}>
|
||||
<Radio value={1}>男</Radio>
|
||||
<Radio value={0}>女</Radio>
|
||||
</Radio.Group>
|
||||
|
@ -87,7 +87,7 @@ export default Form.create()(
|
|||
</div>
|
||||
<Form.Item label="单位名称">
|
||||
{getFieldDecorator("custom_department",{
|
||||
rules:[{required:true,message:"请输入单位名称"}]
|
||||
rules:[]
|
||||
})(
|
||||
<Input placeholder="请输入单位名称" maxLength={30} style={{width:"400px"}}/>
|
||||
)}
|
||||
|
|
Loading…
Reference in New Issue