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

# Conflicts:
#	src/forge/Main/tag/Index.jsx
This commit is contained in:
caishi 2021-09-30 16:00:29 +08:00
commit d51bea4928
9 changed files with 49 additions and 40 deletions

13
package-lock.json generated
View File

@ -7286,7 +7286,8 @@
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -7703,7 +7704,8 @@
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -7759,6 +7761,7 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -7802,12 +7805,14 @@
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"optional": true
},
"yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"optional": true
}
}
},

View File

@ -4,7 +4,6 @@ import './branch.scss';
import { getBranch , getTag } from '../GetData/getData';
import SelectOverlay from './SelectOverlay';
export default (({ projectsId , branch , owner , changeBranch , branchList , tagflag = true })=>{
const [ showValue , setShowValue ] = useState(branch);
@ -26,7 +25,7 @@ export default (({ projectsId , branch , owner , changeBranch , branchList , tag
<div className="branch-tagBox">
{/* {nav === 0 ?"分支":"标签"} */}
<span className="color-grey-9 mr3 ml8"><i className="iconfont icon-fenzhi2 font-18"></i></span>
<span className="ant-dropdown-link task-hide" style={{fontWeight:"500",minWidth:"45px"}}>
<span className="ant-dropdown-link task-hide" style={{fontWeight:"500",minWidth:"45px",maxWidth:"270px"}}>
{showValue}
</span>
<i className="showtag iconfont icon-sanjiaoxing-down font-15 color-grey-9 mr5 ml5 mt1" />

View File

@ -15,9 +15,9 @@ function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}
return(
key === 0 &&<AlignTop className="mt10">
<div>
<p className="font-16 color-grey-6">
<p className="font-16 color-grey-6" style={{display:'flex',alignItems:'center'}}>
{/* 如果是点击最新则发行版列表页只展示最新的一个 */}
<Link to={{pathname:`/${owner}/${projectsId}/releases`,query:{turnFromNew:true}}}>{item.name}</Link>
<Link to={{pathname:`/${owner}/${projectsId}/releases`,query:{turnFromNew:true}}} style={{maxWidth:'200px',overflow: 'hidden',whiteSpace: 'nowrap',textOverflow:'ellipsis'}}>{item.name}</Link>
<span className="font-12 laterest ml5">最新</span>
</p>
<p className="color-grey-3 font-12">{item.created_at}</p>

View File

@ -201,6 +201,7 @@ function CoderDepot(props){
setLastCommit(c && c.commit);
setLastCommitAuthor(c && c.committer);
setMainFlag(false);
setReadme(result.data.readme)
setReadOnly(true);
setReadOnly(!editReadme);
setHide(true);

View File

@ -6,29 +6,21 @@ import { Link } from 'react-router-dom';
import { truncateCommitId } from '../../common/util';
import './Index.scss';
import Tree from '../img/tree.png'
import Pagination from 'rc-pagination';
import moment from 'moment';
const limit = 15;
function Tags(props) {
const [ source , setSource ] = useState([]);
const [ total ,setTotal ] = useState(0);
const [ page , setPage ] = useState(1);
const [ source , setSource ] = useState([]);
const { projectsId , owner } = props.match.params;
useEffect(() => {
if (projectsId) {
const url = `/${owner}/${projectsId}/tags.json`;
axios.get(url,{
// params:{
// limit
// }
}).then((result) => {
axios.get(url).then((result) => {
if (result) {
setSource(result.data);
setTotal(result.data.total_count);
}
}).catch(error => {})
}
@ -53,7 +45,7 @@ function Tags(props) {
return (
<span className="color-grey-3">
<Link className="mr3" style={{fontWeight:"500"}} to={`/${item.commit && item.commit.login}`} >{item.commit && item.commit.name}</Link>
<span>创建于{item.commit && item.commit.time}</span>
<span>创建于{item.commit && item.commit.time_ago}</span>
</span>
)
}
@ -65,7 +57,7 @@ function Tags(props) {
ellipsis:true,
render:(txt,item)=>{
return (
<Tooltip placement="top" title={`最后提交日期:${`dddddd`}`}>
<Tooltip placement="top" title={`最后提交日期:${item.created_at_unix ? moment(item.created_at_unix*1000).format('YYYY-MM-DD'):''}`}>
<img src={Tree} alt="提交ID" width="22px" className="mr4"/>
<Link className="hover color-blue" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.id}`)}`}>{truncateCommitId(item.id)}</Link>
</Tooltip>
@ -91,12 +83,13 @@ function Tags(props) {
render:(txt,item)=>{
return (
<div>
<Link to={`/${owner}/${projectsId}/pulls/new/${item.name}`} className="btn-83">
<a href={`${item.tarball_url}`} download className="btn-83">
<i className="iconfont icon-xiazai-icon font-16 mr5"></i>TAR
</Link>
<Link to={`/${owner}/${projectsId}/pulls/new/${item.name}`} className="btn-83 ml15">
</a>
<a href={`${item.zipball_url}`} download className="btn-83">
<i className="iconfont icon-xiazai-icon font-16 mr5"></i>ZIP
</Link>
</a>
</div>
)
}
@ -106,10 +99,6 @@ function Tags(props) {
<div>
<SubMenu tab={"tags"} projectsId={projectsId} owner={owner}/>
<Table className="tagTable" dataSource={source} columns={columns} pagination={false}></Table>
{
total > limit &&
<Pagination current={page} pageSize={limit} onChange={(p)=>setPage(p)}/>
}
</div>
)
}

View File

@ -63,7 +63,7 @@ function Index(props) {
<div className="treeinfo">
<Link to={`/${owner}/${projectsId}/tree/${turnbar(i.name)}`} className="task-hide">{i.name}</Link>
<div>
<img src={getImageUrl(`${last_commit && last_commit.committer && last_commit.image_url}`)} alt="" />
<img style={{borderRadius:"50%"}} src={getImageUrl(`${last_commit && last_commit.committer && last_commit.committer.image_url}`)} alt=""/>
<span className="mr3 color-grey-3" style={{fontWeight:"500"}}>{last_commit && last_commit.committer && last_commit.committer.name}</span>
<span className="color-grey-3">更新于{last_commit && last_commit.time_from_now}</span>
</div>

View File

@ -8,6 +8,7 @@ import Upload from "../../Upload/Index";
import Attachments from "../../Upload/attachment";
import axios from "axios";
import "./version.scss";
import { trim } from "lodash";
const { Option } = AutoComplete;
@ -137,8 +138,14 @@ export default Form.create()(
<Form.Item>
{getFieldDecorator("tag_name",
{ rules:[
{ required: true, message: "请输入获取或选择一个标签" }
],
{ required: true, message: "请输入获取或选择一个标签" },
{ validator: (rule,val,callback) =>{
if(val.length>30 || val.indexOf(' ')>0 || val.match(/^\s+$/) || trim(val).length!=val.length){
callback('无效的标签名称请参考右侧建议命名标签并确认长度在1~30个字符之间');
}else{
callback();
}
}}],
validateFirst: true
})(
<AutoComplete
@ -166,8 +173,14 @@ export default Form.create()(
<Form.Item className="pt20">
{getFieldDecorator("name",
{ rules:[
{ required: true, message: "请输入发行版的标题" }
],
{ required: true, message: "请输入发行版的标题" },
{ validator: (rule,val,callback) =>{
if(val.length>50){
callback('标题长度在1~50个字符之间');
}else{
callback();
}
}}],
validateFirst: true
})(
<Input placeholder="发行版的标题" />

View File

@ -34,6 +34,7 @@ function version(props) {
setReleases(result.data.releases);
setIsSpin(false);
}
}).catch((error) => {
console.log(error);
})
@ -71,10 +72,10 @@ function version(props) {
</span>
<div className="versionInfo_right">
<div className="versionName">
<Link to={`/${owner}/${projectsId}/tree/${item.tag_name}`} className="task-hide color-blue hover font-18">发布{item.name}</Link>
<Link to={`/${owner}/${projectsId}/tree/${item.tag_name}`} className="task-hide color-blue hover font-18">{item.name}</Link>
<span>
{data && data.user_admin_permission && <Link to={{pathname:`/${owner}/${projectsId}/releases/${item.version_id}/update`,state:{"stable":item.draft==="稳定"}}} className="ml15"><i className="iconfont icon-a-bianji1 font-16 color-grey-6"></i></Link>}
{data && data.user_admin_permission && <i className ="iconfont icon-shanchuicon1 font-16 ml15" onClick={()=>{deleteRelease(item.version_id)}}></i>}
{data && data.user_permission && type !== 2 && <Link to={{pathname:`/${owner}/${projectsId}/releases/${item.version_id}/update`,state:{"stable":item.draft==="稳定"}}} className="ml15"><i className="iconfont icon-a-bianji1 font-16 color-grey-6"></i></Link>}
{data && data.user_permission && type !== 2 && <i className ="iconfont icon-shanchuicon1 font-16 ml15" onClick={()=>{deleteRelease(item.version_id)}}></i>}
</span>
</div>
<span className="color-grey-3 mb15 version-user">
@ -97,7 +98,7 @@ function version(props) {
<p className="versionFile">
{/* 发行版附件下载 */}
{item.attachments && item.attachments.map((item)=>{
return(<Link to={`${item.url}`}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i> {item.title}</Link>)
return(<a href={item.url}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i> {item.title}</a>)
})}
{/* 发行版下载包 */}
<a href={item.tarball_url}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i> {item.tag_name}.TAR.gz</a>
@ -112,7 +113,7 @@ function version(props) {
return (
<React.Fragment>
{
data && data.user_admin_permission &&
data && data.user_permission && type !== 2 &&
<div className="addReleaseBtn">
<Button type={"primary"} onClick={addFunc} className="btnblue" style={{height:"36px"}}>发布新版本</Button>
</div>
@ -125,7 +126,7 @@ function version(props) {
} else if (releases && releases.length === 0) {
return (
<Empty
operation={data && data.user_admin_permission}
operation={data && data.user_permission && type !== 2}
addFunc={addFunc}
/>
)

View File

@ -306,6 +306,7 @@ form{
border-radius: 5px;
font-weight: 500;
color: #333333!important;
margin-right: 15px;
&:hover{
background: #F3F4F6;
color: #333333!important;