Merge pull request '针对educoder项目做限制' (#313) from caishi/forgeplus-react:gitlink_server into gitlink_server

This commit is contained in:
xxq250 2021-12-09 18:23:02 +08:00
commit 2e1cf5ad82
8 changed files with 84 additions and 39 deletions

View File

@ -3945,6 +3945,10 @@ html>body #ajax-indicator {
margin-left: 10px;
color: #2FC25B;
}
.privateTag.red{
color: #FF6832;
border:1px solid #FF6832;
}
.head-nav {
text-align: center;
height: 58px;

View File

@ -23,6 +23,7 @@ import Nodata from '../Nodata';
import Invite from './sub/Invite';
import CheckProfile from '../Component/ProfileModal/Profile';
import RenderHtml from '../../components/render-html';
import { Base64 } from 'js-base64';
/**
* projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不支持在线创建在线上传在线修改在线删除创建合并请求等功能)
*/
@ -279,6 +280,7 @@ function CoderDepot(props){
//
function returnUlr(url){
let enBranch = turnbar(branchName);
setType('dir');
props.history.push(`/${owner}/${projectsId}/tree${enBranch?`/${enBranch}`:""}/${url}`);
}
//
@ -351,7 +353,7 @@ function CoderDepot(props){
const { current_user } = props;
const baseOper = current_user && current_user.login && issuesFlag;
const baseOperate = projectDetail && projectDetail.permission && projectDetail.permission !=="Reporter" && projectDetail.type !== 2 && pullsFlag;
const baseOperate = projectDetail && projectDetail.permission && projectDetail.permission !=="Reporter" && projectDetail.type !== 2 && pullsFlag && props.platform;
const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin));
return(
@ -401,7 +403,7 @@ function CoderDepot(props){
<span>分支<span className="color-grey-6">{branchName || defaultBranch}</span></span>
}
</div>
{
{
treeValuePath && treeValuePath.length > 0 ?
<Path
identifier={projectDetail && projectDetail.identifier}
@ -413,18 +415,35 @@ function CoderDepot(props){
:
<React.Fragment>
<AlignCenter className="mr20">
<Link to={`/${owner}/${projectsId}/branches`} className="iconBtn">
<i className="iconfont icon-master_icon font-16"></i>
<span>分支</span>
<span>{projectDetail && projectDetail.branches_count}</span>
</Link>
{
props.platform ?
<Link to={`/${owner}/${projectsId}/branches`} className="iconBtn">
<i className="iconfont icon-master_icon font-16"></i>
<span>分支</span>
<span>{projectDetail && projectDetail.branches_count}</span>
</Link>
:
<span>
<i className="iconfont icon-master_icon font-16 color-grey-6"></i>
<span className="ml3 color-grey-6">分支</span>
<span className="ml3">{projectDetail && projectDetail.branches_count}</span>
</span>
}
</AlignCenter>
<AlignCenter className="mr20">
{
props.platform ?
<Link to={`/${owner}/${projectsId}/tags`} className="iconBtn">
<i className="iconfont icon-biaoqianicon font-16"></i>
<span>标签</span>
<span>{projectDetail && projectDetail.tags_count}</span>
</Link>
<i className="iconfont icon-biaoqianicon font-16"></i>
<span>标签</span>
<span>{projectDetail && projectDetail.tags_count}</span>
</Link>:
<span>
<i className="iconfont icon-biaoqianicon font-16 color-grey-6"></i>
<span className="ml3 color-grey-6">标签</span>
<span className="ml3">{projectDetail && projectDetail.tags_count}</span>
</span>
}
</AlignCenter>
</React.Fragment>
}
@ -463,12 +482,18 @@ function CoderDepot(props){
(dirInfo && dirInfo.length>0) || fileInfo ?
<div className="listtable">
{
lastCommit &&
((lastCommit && lastCommit.message) || lastCommitAuthor) &&
<div className="listtablehead">
<User url={getImageUrl(`/${lastCommitAuthor && lastCommitAuthor.image_url}`)} name={lastCommitAuthor && lastCommitAuthor.name} id={lastCommitAuthor && lastCommitAuthor.id} login={lastCommitAuthor && lastCommitAuthor.login}/>
<div className={hideBtn && hide ? "ellipsistxt hidetxt" :"ellipsistxt"}>
<pre id="ptxt"><Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(lastCommit.sha)}`}><RenderHtml value={lastCommit.message}/></Link></pre>
</div>
{
lastCommitAuthor &&
<User url={getImageUrl(`/${lastCommitAuthor.image_url}`)} name={lastCommitAuthor.name} id={lastCommitAuthor.id} login={lastCommitAuthor.login}/>
}
{
lastCommit.message &&
<div className={hideBtn && hide ? "ellipsistxt hidetxt" :"ellipsistxt"}>
<pre id="ptxt"><Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(lastCommit.sha)}`}><RenderHtml value={lastCommit.message}/></Link></pre>
</div>
}
{ hideBtn && <span className="ellipsis" onClick={()=>changeHide(hide)}><i className="iconfont icon-shenglvehao"></i></span> }
<span className="ml20 color-grey-6 font-12 mt3">{lastCommit.time_from_now}</span>
@ -490,6 +515,7 @@ function CoderDepot(props){
item={item}
projectsId={projectsId}
goToSubRoot={goToSubRoot}
platform={props.platform}
/>
)
})
@ -569,7 +595,7 @@ function CoderDepot(props){
}
{/* 发布 */}
{
releaseVersions &&
releaseVersions && props.platform &&
<React.Fragment>
<Divider />
<Releases

View File

@ -8,13 +8,18 @@ const typeIco = {
"dir":"icon-wenjianjia4 font-15 color-blue_4C"
}
function CoderDepotCatalogue({item , goToSubRoot , owner , projectsId }){
function CoderDepotCatalogue({item , goToSubRoot , owner , projectsId , platform }){
return(
<li>
<span>
<a onClick={()=>goToSubRoot(item.path,item.type,item.name)} className={item.type === "submodule" && "submoduleStyle"}>
<i className={`iconfont ${typeIco[`${item.type}`]} mr8`}></i>{item.name}
</a>
{
(!platform && item.image_type) ?
<span><i className={`iconfont ${typeIco[`${item.type}`]} mr8`}></i>{item.name}</span>
:
<a onClick={()=>goToSubRoot(item.path,item.type,item.name)} className={item.type === "submodule" && "submoduleStyle"}>
<i className={`iconfont ${typeIco[`${item.type}`]} mr8`}></i>{item.name}
</a>
}
</span>
<span title="init project">
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.commit && item.commit.sha}`)}`} title={item.commit && item.commit.message}>

View File

@ -507,6 +507,7 @@ class Detail extends Component {
<Link to={`/${owner}/${projectsId}`} className="projectN mt6">{projectDetail && projectDetail.name}</Link>
</div>
{projectDetail && projectDetail.private && <span className="privateTag mt6">私有</span>}
{ !platform && <span className="privateTag red mt6">只读</span> }
</AlignTop>
<div className="mt8">
{

View File

@ -246,11 +246,14 @@
display: flex;
justify-content: space-between;
align-items: flex-start;
border-bottom: 1px solid #d9d9d9;
padding:12px 20px 11px;
border-radius: 4px 4px 0px 0px;
border: 1px solid rgba(42, 97, 255, 0.23);
border-bottom: none;
background-color: #FAFCFF;
&+.listtablebody{
border-top-color: rgba(42, 97, 255, 0.23);
}
.ellipsistxt{
&:hover .markdown-body{
color: #466AFF;
@ -331,7 +334,6 @@
.listtablebody{
border-radius:0px 0px 4px 4px ;
border: 1px solid #D0D0D0;
border-top: none;
li.listtablepath{
a{color: #40a9ff;}
p{

View File

@ -67,16 +67,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
</li>:""
}
{
item.menu_name === "versions" &&
<li className={pathname === "wiki" ? "active" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/wiki`, state }}>
<i className={"iconfont icon-a-wikiicon1 color-grey-3 mr5 font-14"}></i>
<span>维基(Wiki)</span>
</Link>
</li>
}
{
item.menu_name === "wiki" && platform ?
item.menu_name === "devops" ?
<li className={pathname==="devops" ? "active" : ""}>
{/* <Link to={{ pathname: `/${owner}/${projectsId}/devops${open_devops ? `/dispose`:""}`, state }}> */}
<Link to={{ pathname: `/${owner}/${projectsId}/devops`, state:{...state,open_devops} }}>
@ -97,7 +88,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
</li>
} */}
{
item.menu_name === "devops" &&
item.menu_name === "versions" &&
<li className={pathname==="milestones" ? "active" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/milestones`, state }}>
<i className={pathname==="milestones" ? "iconfont icon-lichengbeiicon color-grey-3 mr5 font-14":"iconfont icon-lichengbeiicon color-grey-6 font-14 mr5"}></i>
@ -106,6 +97,15 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
</Link>
</li>
}
{
item.menu_name === "wiki" &&
<li className={pathname === "wiki" ? "active" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/wiki`, state }}>
<i className={"iconfont icon-a-wikiicon1 color-grey-3 mr5 font-14"}></i>
<span>维基(Wiki)</span>
</Link>
</li>
}
{
item.menu_name === "activity" &&
<li className={pathname==="activity" ? "active" : ""}>
@ -116,7 +116,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
</li>
}
{
item.menu_name === "settings" &&
item.menu_name === "settings" && platform &&
<li className={pathname === "settings" ? "active" : ""}>
<Link to={`/${owner}/${projectsId}/settings`}>
<i className={url && url.indexOf("/settings") > 0 ? "iconfont icon-cangkushezhiicon color-grey-3 mr5 font-14":"iconfont icon-cangkushezhiicon color-grey-6 font-14 mr5"}></i>

View File

@ -5,11 +5,21 @@ import { Link } from 'react-router-dom';
import { getImageUrl } from 'educoder';
import { Dropdown , Menu , Spin } from 'antd';
import './Index.scss';
import { Base64 } from 'js-base64';
import Tree from '../img/tree.png';
import Axios from 'axios';
function turnbar(str){
// const s = '!@/:"<>|%$¥';
// for(var i=0;i<s.length;i++){
// let s1 = s[i];
// if(str.indexOf(s1) > -1){
// return Base64.encode(str);
// }else{
// continue;
// }
// }
if(str && str.length>0 && str.indexOf("/")>-1){
return str.replaceAll('/','%2F');
}
@ -91,7 +101,7 @@ function Index(props) {
<div className="treeabout">
{
(isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) &&
<Link to={`/${owner}/${projectsId}/compare/master...${i.name}`} className="btn-83">+ 合并请求</Link>
<Link to={`/${owner}/${projectsId}/compare/master...${turnbar(i.name)}`} className="btn-83">+ 合并请求</Link>
}
<Dropdown overlay={menu(i.zip_url,i.tar_url)} trigger={['click']} placement="bottomRight">
<a className="btn-83 ml15">下载<i className="iconfont icon-sanjiaoxing-down font-14"></i></a>

View File

@ -1,6 +1,3 @@
i.iconfont {
cursor: pointer;
}
.overflowHidden1 {
overflow: hidden;