为2时不支持在线创建、在线上传、在线修改、在线删除、创建合并请求等功能

This commit is contained in:
caishi 2021-04-08 14:21:35 +08:00
parent 961587921a
commit 43223c7787
4 changed files with 40 additions and 30 deletions

View File

@ -21,7 +21,7 @@ import UpdateDescModal from './sub/UpdateDescModal';
import Nodata from '../Nodata'; import Nodata from '../Nodata';
/** /**
* projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不能上传新建文件下载zip等) * projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不支持在线创建在线上传在线修改在线删除创建合并请求等功能)
*/ */
function CoderDepot(props){ function CoderDepot(props){
const [ projectDetail , setProjectDetail ]= useState(undefined); const [ projectDetail , setProjectDetail ]= useState(undefined);
@ -288,7 +288,10 @@ function CoderDepot(props){
</AlignCenter> </AlignCenter>
<AlignCenter> <AlignCenter>
<div className="mr20 addOptionBtn"> <div className="mr20 addOptionBtn">
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</a> {
projectDetail.type !== 2 &&
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</a>
}
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/issues/new`)} >+ 任务</a> <a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/issues/new`)} >+ 任务</a>
</div> </div>
{ type === "dir" && projectDetail.type !== 2 && { type === "dir" && projectDetail.type !== 2 &&
@ -296,12 +299,10 @@ function CoderDepot(props){
<Button type="default">文件 <i className="iconfont icon-sanjiaoxing-down ml3 font-14 color-grey-9"></i></Button> <Button type="default">文件 <i className="iconfont icon-sanjiaoxing-down ml3 font-14 color-grey-9"></i></Button>
</Dropdown> </Dropdown>
} }
{
projectDetail.type !== 2 && <Dropdown overlay={downloadMenu} placement="bottomRight">
<Dropdown overlay={downloadMenu} placement="bottomRight"> <Button type={'primary'}>下载 <i className="iconfont icon-sanjiaoxing-down ml3 font-14 color-white"></i></Button>
<Button type={'primary'}>下载 <i className="iconfont icon-sanjiaoxing-down ml3 font-14 color-white"></i></Button> </Dropdown>
</Dropdown>
}
</AlignCenter> </AlignCenter>
</FlexAJ> </FlexAJ>
{ {
@ -350,6 +351,7 @@ function CoderDepot(props){
readOnly={readOnly} readOnly={readOnly}
onEdit={onEdit} onEdit={onEdit}
currentBranch={branchName || (projectDetail && projectDetail.default_branch)} currentBranch={branchName || (projectDetail && projectDetail.default_branch)}
type={projectDetail.type}
></CoderRootFileDetail> ></CoderRootFileDetail>
} }
</ul> </ul>
@ -360,7 +362,7 @@ function CoderDepot(props){
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :"" (dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :""
} }
{/* readme文件显示(显示文件详情时不显示readme文件) */} {/* readme文件显示(显示文件详情时不显示readme文件) */}
{ dirInfo && (projectDetail && projectDetail.readme) ? <ReadMe ChangeFile={ChangeFile} readme={projectDetail && projectDetail.readme} operate={props && (props.isManager || props.isDeveloper)} history={props.history} /> :"" } { dirInfo && (projectDetail && projectDetail.readme) ? <ReadMe ChangeFile={ChangeFile} readme={projectDetail && projectDetail.readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
</div> </div>
</LongWidth> </LongWidth>
{ {

View File

@ -166,7 +166,8 @@ class CoderRootFileDetail extends Component {
isDeveloper, isDeveloper,
md, md,
currentBranch, currentBranch,
platform platform,
type
} = this.props; } = this.props;
const { language, languages, description } = this.state; const { language, languages, description } = this.state;
let flag = current_user && current_user.login && (isManager || isDeveloper); let flag = current_user && current_user.login && (isManager || isDeveloper);
@ -185,17 +186,18 @@ class CoderRootFileDetail extends Component {
{readOnly ? ( {readOnly ? (
<span> <span>
{ {
detail.direct_download ? !detail.direct_download?
""
:
<span> <span>
<a onClick={() => this.DownLoadFile(detail.download_url)} className="ml20"> <a onClick={() => this.DownLoadFile(detail.download_url)} className="ml20">
<i className="iconfont icon-xiazai1 font-15 color-grey-6"></i> <i className="iconfont icon-xiazai1 font-15 color-grey-6"></i>
</a> </a>
<a onClick={() => this.EditFile(false)} className="ml20"> {
<i className="iconfont icon-bianji1 font-15 color-grey-6"></i> type !==2 &&
</a> <a onClick={() => this.EditFile(false)} className="ml20">
</span> <i className="iconfont icon-bianji1 font-15 color-grey-6"></i>
</a>
}
</span>:""
} }
</span> </span>
) : ( ) : (
@ -226,18 +228,21 @@ class CoderRootFileDetail extends Component {
</button> </button>
</React.Fragment> </React.Fragment>
)} )}
{
type !==2 &&
<Popconfirm
title="确认删除这个文件?"
className="ml20"
okText="确定"
cancelText="取消"
onConfirm={this.deleteFile}
>
<a>
<i className="iconfont icon-shanchu font-15 color-grey-6"></i>
</a>
</Popconfirm>
}
<Popconfirm
title="确认删除这个文件?"
className="ml20"
okText="确定"
cancelText="取消"
onConfirm={this.deleteFile}
>
<a>
<i className="iconfont icon-shanchu font-15 color-grey-6"></i>
</a>
</Popconfirm>
</div> </div>
)} )}
</p> </p>

View File

@ -95,6 +95,9 @@
& > a:first-child{ & > a:first-child{
border-right: 1px solid #d9d9d9; border-right: 1px solid #d9d9d9;
} }
& > a:last-child{
border-right: none;
}
} }
.infoCount{ .infoCount{
display: inline-block; display: inline-block;

View File

@ -13,7 +13,7 @@ const menu = [
{name:"易修 (Issue)",index:"issues"}, {name:"易修 (Issue)",index:"issues"},
{name:"合并请求",index:"pulls"}, {name:"合并请求",index:"pulls"},
{name:"工作流(beta版)",index:"devops"}, {name:"工作流(beta版)",index:"devops"},
// {name:"资源库",index:"resources"}, {name:"资源库",index:"resources"},
{name:"里程碑",index:"versions"}, {name:"里程碑",index:"versions"},
{name:"动态",index:"activity"}, {name:"动态",index:"activity"},
] ]