发行版
This commit is contained in:
parent
73ca563a0f
commit
aaf6bcb320
|
@ -17,7 +17,8 @@ function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}
|
|||
key === 0 &&<AlignTop className="mt10">
|
||||
<div>
|
||||
<p className="font-16 color-grey-6">
|
||||
<Link to={`/${owner}/${projectsId}/releases`}>{item.name}</Link>
|
||||
{/* 如果是点击最新则发行版列表页只展示最新的一个 */}
|
||||
<Link to={{pathname:`/${owner}/${projectsId}/releases`,query:{turnFromNew:true}}}>{item.name}</Link>
|
||||
<span className="font-12 laterest ml5">最新</span>
|
||||
</p>
|
||||
<p className="color-grey-3 font-12">{item.created_at}</p>
|
||||
|
|
|
@ -215,7 +215,7 @@ export default Form.create()(
|
|||
{versionId ? "保存" : "创建"}发行版
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() =>history.push(`/${owner}/${projectsId}/releases`)}
|
||||
onClick={() =>history.push(`/${owner}/${projectsId}/releases`)} className="btngrey"
|
||||
// style={{backgroundColor: "rgba(187,187,187,1)",color: "#fff"}}
|
||||
>取消</Button>
|
||||
</p>
|
||||
|
@ -223,7 +223,7 @@ export default Form.create()(
|
|||
<div className="versionTips">
|
||||
<div className="infosTip">
|
||||
<p className="font-16 mb14 weight">标签命名建议</p>
|
||||
<p className="mb20">
|
||||
<p className="mb15">
|
||||
通常的做法是在版本名称前加上字母 v 前缀, v1.0 或者 v2.3.4。
|
||||
</p>
|
||||
<p>
|
||||
|
|
|
@ -2,19 +2,25 @@ import React, { useEffect , useState } from "react";
|
|||
import { Link } from 'react-router-dom';
|
||||
import { Spin , Button } from 'antd';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import {truncateCommitId} from '../../common/util';
|
||||
import Empty from './Empty';
|
||||
import './version.scss';
|
||||
import axios from 'axios';
|
||||
import Tree from '../img/tree.png';
|
||||
import RenderHtml from '../../../components/render-html';
|
||||
import { result } from "lodash";
|
||||
|
||||
function version(props) {
|
||||
console.log(props);
|
||||
const [ data , setData ] = useState(undefined);
|
||||
const [ releases , setReleases ] = useState(undefined);
|
||||
const [ isSpin , setIsSpin ] = useState(true);
|
||||
const { projectsId ,owner } = props.match.params;
|
||||
const { isManager , isDeveloper } = props;
|
||||
const { isManager, isDeveloper, location , user } = props;
|
||||
const type = props.projectDetail && props.projectDetail.type;
|
||||
|
||||
const turnFromNew = location && location.query && location.query.turnFromNew;
|
||||
const current_user_login = user && user.login;
|
||||
owner && console.log(owner);
|
||||
useEffect(()=>{
|
||||
getIssueList();
|
||||
},[])
|
||||
|
@ -24,6 +30,9 @@ function version(props) {
|
|||
axios.get(url).then((result) => {
|
||||
if (result) {
|
||||
setData(result.data);
|
||||
const { releases = [] } = result.data;
|
||||
//默认第一个展开(body参数)
|
||||
releases.length && (releases[0].bodyshow = true);
|
||||
setReleases(result.data.releases);
|
||||
setIsSpin(false);
|
||||
}
|
||||
|
@ -31,7 +40,6 @@ function version(props) {
|
|||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
// 显示版本描述
|
||||
function showBody(key,flag){
|
||||
var lists = releases.concat();
|
||||
|
@ -39,7 +47,67 @@ function version(props) {
|
|||
lists.splice();
|
||||
setReleases(lists);
|
||||
}
|
||||
|
||||
//删除
|
||||
function deleteRelease(releaseId) {
|
||||
console.log(releaseId);
|
||||
if(releaseId){
|
||||
axios.delete(`/${owner}/${projectsId}/releases/${releaseId}.json`).then((result)=>{
|
||||
if(result){
|
||||
getIssueList();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function release(item,key){
|
||||
return (
|
||||
<div className="versionInfo" key={key}>
|
||||
<span className="versionInfo_left">
|
||||
<span className={`${item.draft === "稳定" ?"versionTag green":"versionTag orange"}`}>{item.draft}</span>
|
||||
<span className="color-grey-3 mt15 font-12">
|
||||
<i className="iconfont icon-biaoqianicon mr3 font-14"></i>
|
||||
{item.tag_name}{item.draft === "预发行" ?"(standalone)":""}
|
||||
</span>
|
||||
<span className="color-grey-3 font-12">
|
||||
<img src={Tree} width="16px" color="#333333" className="mr3"/>
|
||||
{truncateCommitId(item.sha)}
|
||||
</span>
|
||||
</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}{item.draft === "预发行" ?"(standalone)版本":""}</Link>
|
||||
<span>
|
||||
{
|
||||
(isManager || isDeveloper) && type !==2 &&
|
||||
<Link to={`/${owner}/${projectsId}/releases/${item.version_id}/update`} className="ml15"><i className="iconfont icon-a-bianji1 font-16 color-grey-6"></i></Link>
|
||||
}
|
||||
{current_user_login == owner && <i className ="iconfont icon-shanchuicon1 font-16 ml15" onClick={()=>{deleteRelease(item.version_id)}}></i>}
|
||||
</span>
|
||||
</div>
|
||||
<span className="color-grey-3 mb15">
|
||||
<i className={`${item.bodyshow ? "iconfont icon-sanjiaoxing-down color-grey-8 mr3 font-14":"iconfont icon-triangle color-grey-8 mr3 font-14"}`} onClick={()=>showBody(key,item.bodyshow)}></i>
|
||||
<img src={getImageUrl(item.image_url)} alt="" className="sendAuthorImg"/>
|
||||
<span className="weight500">{item.user_name}</span>
|
||||
<span className="ml5">发布于{item.created_at}</span>
|
||||
</span>
|
||||
{
|
||||
item.bodyshow &&
|
||||
<div className="body-show">
|
||||
<RenderHtml className="break_word_comments imageLayerParent" value={item.body} url={props.history.location}/>
|
||||
</div>
|
||||
}
|
||||
<RenderHtml />
|
||||
<p className="versionFile">
|
||||
<a href={item.tarball_url}><i className="iconfont icon-tar font-14 mr10 color-grey-3"></i>{item.tag_name}.TAR.gz</a>
|
||||
<a href={item.zipball_url}><i className="iconfont icon-icon font-14 mr10 color-grey-3"></i>{item.tag_name}.ZIP</a>
|
||||
</p>
|
||||
{/* 发行版附件下载 */}
|
||||
{item.attachments && item.attachments.map((item)=>{
|
||||
return(<a href={`/${owner}/${projectsId}${item.url}`}>{item.title}</a>)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
function renderList(releases){
|
||||
if (releases && releases.length > 0) {
|
||||
return (
|
||||
|
@ -51,47 +119,7 @@ function version(props) {
|
|||
</div>
|
||||
}
|
||||
<div>
|
||||
{
|
||||
releases.map((item, key) => {
|
||||
return (
|
||||
<div className="versionInfo" key={key}>
|
||||
<span className="versionInfo_left">
|
||||
<span className={`${item.draft === "稳定" ?"versionTag green":"versionTag orange"}`}>{item.draft}</span>
|
||||
<span className="color-grey-3 mt15">
|
||||
<i className="iconfont icon-biaoqianicon mr3 font-14"></i>
|
||||
{item.tag_name}{item.draft === "预发行" ?"(standalone)":""}
|
||||
</span>
|
||||
</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}{item.draft === "预发行" ?"(standalone)版本":""}</Link>
|
||||
{
|
||||
(isManager || isDeveloper) && type !==2 &&
|
||||
<Link to={`/${owner}/${projectsId}/releases/${item.version_id}/update`} className="ml15"><i className="iconfont icon-a-bianji1 font-16 color-grey-6"></i></Link>
|
||||
}
|
||||
</div>
|
||||
<span className="color-grey-3 mb15">
|
||||
<i className={`${item.bodyshow ? "iconfont icon-sanjiaoxing-down color-grey-8 mr3 font-14":"iconfont icon-triangle color-grey-8 mr3 font-14"}`} onClick={()=>showBody(key,item.bodyshow)}></i>
|
||||
<img src={getImageUrl(item.image_url)} alt="" className="sendAuthorImg"/>
|
||||
<span className="weight500">{item.user_name}</span>
|
||||
<span className="ml5">发布于{item.created_at}</span>
|
||||
</span>
|
||||
{
|
||||
item.bodyshow &&
|
||||
<div className="padding10">
|
||||
<RenderHtml className="break_word_comments imageLayerParent" value={item.body} url={props.history.location}/>
|
||||
</div>
|
||||
}
|
||||
<RenderHtml />
|
||||
<p className="versionFile">
|
||||
<a href={item.tarball_url}><i className="iconfont icon-tar font-14 mr10 color-grey-3"></i>{item.tag_name}.TAR.gz</a>
|
||||
<a href={item.zipball_url}><i className="iconfont icon-icon font-14 mr10 color-grey-3"></i>{item.tag_name}.ZIP</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
{!turnFromNew ? releases.map((item, key) => release(item,key)) : release(releases[0],0)}
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
border-radius: 50%;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.body-show{
|
||||
padding: 5px 10px 10px 10px;
|
||||
}
|
||||
}
|
||||
.versionTag{
|
||||
display: inline;
|
||||
|
|
|
@ -88,7 +88,7 @@ function Files({data,history,owner,projectsId}){
|
|||
<a id= {`value${key}`} className="anchorPoint"></a>
|
||||
<FlexAJ className="filesInfo">
|
||||
<AlignCenter>
|
||||
{!item.isBin ? <i className={!item.flag?"iconfont icon-sanjiaoxing-down color-grey-9 mt4":"iconfont icon-triangle font-15 color-grey-9 mt4"} onClick={()=>showDown(item.flag,key,item.isBin)}></i>:""}
|
||||
{!item.isBin ? <i className={!item.flag?"iconfont icon-sanjiaoxing-down color-grey-9 mt4":"iconfont icon-triangle font-15 color-grey-9"} onClick={()=>showDown(item.flag,key,item.isBin)}></i>:""}
|
||||
<span className="cursor-pointer" data-clipboard-text={item.name} onClick={()=>showDown(item.flag,key,item.isBin)}>{item.name}</span>
|
||||
<Tooltip
|
||||
title={copyfileTipTitle}
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
.fileList{
|
||||
.sc-bxivhb{
|
||||
width: 55rem;
|
||||
overflow: hidden;
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
.see-file{
|
||||
width: 14rem;
|
||||
|
|
|
@ -333,4 +333,13 @@ button.ant-btn-primary.btnblue{
|
|||
background-color:rgba(70, 106, 255, 0.85);
|
||||
border-color:rgba(70, 106, 255, 0.85);
|
||||
}
|
||||
}
|
||||
button.btngrey{
|
||||
background-color:#FFFFFF;
|
||||
border-color:#D0D0D0;
|
||||
color: #666666;
|
||||
&:hover,&:focus{
|
||||
border-color:rgba(153, 153, 153, 0.5);
|
||||
color: #666666;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue