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

This commit is contained in:
谢思 2021-10-13 09:54:04 +08:00
commit 8c7865d2c1
17 changed files with 197 additions and 76 deletions

View File

@ -1949,9 +1949,7 @@ a.decoration {
}
.mr20 {
margin-right: 10px;
margin-left: 10px;
float: left;
margin-right: 20px;
}
.mr25 {
@ -1959,7 +1957,7 @@ a.decoration {
}
.mr30 {
margin-right: 10px;
margin-right: 30px;
}
.mr35 {

View File

@ -53,8 +53,10 @@ function SelectOverlay({ changeBranch , tagflag , branchList , projectsId , owne
setIsSpin(true);
if(e.key === "branch"){
getBranchs(projectsId,owner);
setNav(0);
}else{
getTags(projectsId,owner);
setNav(1);
}
}

View File

@ -22,6 +22,7 @@ import UpdateDescModal from './sub/UpdateDescModal';
import Nodata from '../Nodata';
import Invite from './sub/Invite';
import CheckProfile from '../Component/ProfileModal/Profile';
import RenderHtml from '../../components/render-html';
/**
* projectDetail.type:0是托管项目1是镜像项目2是同步镜像项目(为2时不支持在线创建在线上传在线修改在线删除创建合并请求等功能)
*/
@ -196,7 +197,7 @@ function CoderDepot(props){
let ele = document.getElementById("ptxt");
if(ele){
let h = ele.offsetHeight;
if( h > 18 ) setHideBtn(true);
if( h > 35 ) setHideBtn(true);
}
}
},[projectDetail,lastCommit])
@ -401,7 +402,7 @@ function CoderDepot(props){
getPathUrl={getPathUrl}
/>
:
<div>
<React.Fragment>
<AlignCenter className="mr20">
<Link to={`/${owner}/${projectsId}/branches`} className="iconBtn">
<i className="iconfont icon-master_icon font-16"></i>
@ -416,7 +417,7 @@ function CoderDepot(props){
<span>{projectDetail && projectDetail.tags && projectDetail.tags.total_count}</span>
</Link>
</AlignCenter>
</div>
</React.Fragment>
}
</AlignCenter>
<AlignCenter className="depotBtn">
@ -457,7 +458,7 @@ function CoderDepot(props){
<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)}`}>{lastCommit.message}</Link></pre>
<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> }

View File

@ -6,7 +6,8 @@ import { AlignTop } from '../Component/layout';
import SelectBranch from '../Branch/Select';
import Nodata from '../Nodata';
import User from '../Component/User'
import User from '../Component/User';
import RenderHtml from '../../components/render-html.jsx';
import Tree from './img/tree.png';
import axios from 'axios';
import {Link} from "react-router-dom";
@ -158,7 +159,7 @@ class CoderRootCommit extends Component{
<div className="commitList-item f-wrap-between">
<div>
<AlignTop>
<div className="commitDesc"><Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="font-14 color-grey-3 font-bd">{item.message}</Link></div>
<div className="commitDesc"><Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="font-14 color-grey-3 font-bd"><RenderHtml value={item.message}/></Link></div>
</AlignTop>
<p className="f-wrap-alignCenter mt15 pb5">
<User

View File

@ -27,6 +27,7 @@ class CoderRootFileDetail extends Component {
}
componentDidMount = () => {
window.scrollTo(0, 0);
const { detail , mdFlag } = this.props;
this.setState({
value: detail.content,
@ -214,7 +215,7 @@ class CoderRootFileDetail extends Component {
const Option = Select.Option;
return (
<React.Fragment>
<Anchor className="griditemAnchor" offsetTop={70} targetOffset={160}>
<Anchor className="griditemAnchor" offsetTop={70}>
<div className="griditemCate">
{
md && readOnly &&

View File

@ -3,7 +3,6 @@ import { Route , Switch } from 'react-router-dom';
// import Top from './DetailTop';
import Loadable from 'react-loadable';
import Loading from '../../Loading';
import axios from 'axios';
import './Index.scss';
const FileNew = Loadable({
@ -51,37 +50,37 @@ class CoderRootIndex extends Component{
}
}
componentDidMount=()=>{
this.Init();
}
componentDidUpdate=(prevProps)=>{
const { location } = this.props;
const prevlocation = prevProps && prevProps.location;
if (location !== prevlocation) {
this.Init();
}
}
// componentDidMount=()=>{
// this.Init();
// }
// componentDidUpdate=(prevProps)=>{
// const { location } = this.props;
// const prevlocation = prevProps && prevProps.location;
// if (location !== prevlocation) {
// this.Init();
// }
// }
Init=()=>{
const { branchName } = this.props.match.params;
const { defaultBranch } = this.props;
this.getTopCount(branchName || defaultBranch);
}
// Init=()=>{
// const { branchName } = this.props.match.params;
// const { defaultBranch } = this.props;
// this.getTopCount(branchName || defaultBranch);
// }
// 获取<Top />组件里要显示的数据
getTopCount=(branch)=>{
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/top_counts.json`;
axios.get(url,{params:{
ref:branch
}}).then(result=>{
if(result){
this.setState({
coderCount:result.data
})
}
}).catch(error=>{console.log(error);})
}
// getTopCount=(branch)=>{
// const { projectsId , owner } = this.props.match.params;
// const url = `/${owner}/${projectsId}/top_counts.json`;
// axios.get(url,{params:{
// ref:branch
// }}).then(result=>{
// if(result){
// this.setState({
// coderCount:result.data
// })
// }
// }).catch(error=>{console.log(error);})
// }
render(){
return(
<div className="coderSubPage">
@ -100,12 +99,12 @@ class CoderRootIndex extends Component{
></Route>
<Route path="/:owner/:projectsId/:branch/newfile"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} getTopCount={this.getTopCount} />)
(props) => (<FileNew {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/:owner/:projectsId/commits/branch/:branchName"
render={
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" />)
}
></Route>
<Route path="/:owner/:projectsId/commits/:sha"
@ -115,7 +114,7 @@ class CoderRootIndex extends Component{
></Route>
<Route path="/:owner/:projectsId/commits"
render={
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" />)
}
></Route>
{/* <Route path="/:owner/:projectsId/releases/:versionId/update"

View File

@ -6,6 +6,7 @@ import { getImageUrl } from 'educoder';
import Files from '../Merge/Files';
import Tree from "./img/tree.png";
import User from "../Component/User";
import RenderHtml from "../../components/render-html";
import axios from "axios";
import { Link } from "react-router-dom";
@ -17,6 +18,9 @@ const Infos = styled.div`
border: 1px solid rgba(42, 97, 255, 0.23);
border-radius: 3px 3px 0px 0px;
padding: 10px 20px 10px 16px;
& .markdown-body table{
background: #f1f8ff;
}
& .f-wrap-between{
align-items: center;
}
@ -85,9 +89,9 @@ export default (props) => {
<div className="f-wrap-between">
<div>
{commit && commit.message &&
<pre className="task-hide">{commit.message}</pre>
<RenderHtml className="task-hide" value={commit.message}/>
}
<Link to={`/${owner}/${projectsId}/tree/${truncateCommitId(sha)}`}><i className="iconfont icon-fenzhi2 font-18"></i>{data.branch}</Link>
<Link to={`/${owner}/${projectsId}/tree/${data.branch}`}><i className="iconfont icon-fenzhi2 font-18"></i>{data.branch}</Link>
</div>
<Button type="primary" onClick={()=>{history.push(`/${owner}/${projectsId}/tree/${truncateCommitId(sha)}`)}} className="btnblue" style={{height:"36px"}}>浏览文件</Button>
</div>

View File

@ -195,7 +195,7 @@
width: 40px;
height: 40px;
}
&:nth-child(5){
&:nth-child(5n){
margin-right: 0px;
}
}
@ -224,7 +224,7 @@
height: 8px;
width: 8px;
left: 0px;
top:10px
top:8px;
}
&>span{
padding-left: 15px;
@ -252,7 +252,13 @@
border: 1px solid rgba(42, 97, 255, 0.23);
background-color: #FAFCFF;
.ellipsistxt{
margin-top: 6px;
&:hover .markdown-body{
color: #466AFF;
& a{
color: #466AFF;
}
}
margin-top: 2px;
// cursor: pointer;
#ptxt{
margin-bottom: 0px;
@ -263,6 +269,27 @@
white-space:-pre-wrap; /* Opera 4-6 */
white-space:-o-pre-wrap; /* Opera 7 */
word-wrap:break-word;
.markdown-body{
line-height: 10px;
font-size: 14px;
& p {
margin: 1px 0px 0px !important;
font-size: 14px !important;
}
& ol,ul{
padding-bottom: 3px;
& li{
min-height: 18px;
}
}
& table{
line-height: 1;
background: #FAFCFF;
}
&:first-child {
margin-top: -1px !important;
}
}
}
margin-left: 13px;
line-height:18px;
@ -270,7 +297,7 @@
width: 0;
color: #666;
&.hidetxt{
height: 18px;
height: 24px;
overflow: hidden;
position: relative;
padding-right:8px;

View File

@ -735,6 +735,9 @@ a.color-grey-ccc:hover{
border-radius: 4px;
margin-left: 16px;
align-items: center;
& .markdown-body table{
background: #FAFCFF;
}
&:after,&:before{
content: "";
position: absolute;
@ -760,6 +763,9 @@ a.color-grey-ccc:hover{
&:before{
border-right: 10px solid rgba(42, 97, 255, 0.58);
}
& .markdown-body table{
background: #EEF6FF;
}
}
.treecopy-cont{
padding: 4px 15px;

View File

@ -1,17 +1,19 @@
import React,{ useEffect , useState } from 'react';
import SubMenu from '../sub/SubMenu';
import { Table , Tooltip } from 'antd';
import { Table , Tooltip , Spin } from 'antd';
import axios from 'axios';
import { Link } from 'react-router-dom';
import { truncateCommitId } from '../../common/util';
import { getImageUrl } from 'educoder';
import Nonedata from '../../Nodata';
import './Index.scss';
import Tree from '../img/tree.png'
import moment from 'moment';
function Tags(props) {
const [ source , setSource ] = useState([]);
const [ source , setSource ] = useState(undefined);
const [ isSpin , setIsSpin ] = useState(true);
const { projectsId , owner } = props.match.params;
@ -21,6 +23,7 @@ function Tags(props) {
axios.get(url).then((result) => {
if (result) {
setSource(result.data);
setIsSpin(false);
}
}).catch(error => {})
}
@ -32,8 +35,13 @@ function Tags(props) {
dataIndex:"name",
key:1,
ellipsis:true,
width:"200px",
render:(txt,item)=>{
return <Link className="hover" to={`/${owner}/${projectsId}/tree/${item.name}`} >{item.name}</Link>
return(
<div className="tagBranch">
<Link className="hover tagClass" to={`/${owner}/${projectsId}/tree/${item.name}`}>{item.name}</Link>
</div>
)
}
},
{
@ -43,8 +51,22 @@ function Tags(props) {
ellipsis:true,
render:(txt,item)=>{
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 className="color-grey-3 tagModel">
{
item.tagger &&
<Tooltip placement="top" title={item.tagger.name}>
{
item.tagger.id ?
<Link className="mr3 tagModelImg" to={`/${item.tagger.login}`} >
<img src={getImageUrl(`/${item.tagger && item.tagger.image_url}`)} alt=""/>
</Link>
:
<span className="mr3 tagModelImg" style={{cursor:"default"}}>
<img src={getImageUrl(`/${item.tagger && item.tagger.image_url}`)} alt=""/>
</span>
}
</Tooltip>
}
<span>创建于{txt}</span>
</span>
)
@ -59,7 +81,7 @@ function Tags(props) {
return (
<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.commit && item.commit.sha}`)}`}>{truncateCommitId(item.commit && item.commit.sha)}</Link>
<Link className="hover color-blue" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.id}`)}`}>{truncateCommitId(item.id)}</Link>
</Tooltip>
)
}
@ -79,18 +101,17 @@ function Tags(props) {
key:5,
ellipsis:true,
align:"center",
width:"181px",
width:"204px",
render:(txt,item)=>{
return (
<div>
<React.Fragment>
<a href={`${item.tarball_url}`} download className="btn-83">
<i className="iconfont icon-xiazai-icon font-16 mr5"></i>TAR
</a>
<a href={`${item.zipball_url}`} download className="btn-83">
<i className="iconfont icon-xiazai-icon font-16 mr5"></i>ZIP
</a>
</div>
</React.Fragment>
)
}
}
@ -98,7 +119,19 @@ function Tags(props) {
return(
<div>
<SubMenu tab={"tags"} projectsId={projectsId} owner={owner}/>
<Table className="tagTable" dataSource={source} columns={columns} pagination={false}></Table>
<Spin spinning={isSpin}>
<div className="tagSpin">
{
source && source.length > 0 &&
<Table
className="tagTable"
dataSource={source} columns={columns} pagination={false}></Table>
}
{
source && source.length === 0 && <Nonedata _html={'暂无数据~'}/>
}
</div>
</Spin>
</div>
)
}

View File

@ -4,6 +4,7 @@
tr th{
background-color: #fff;
padding:5px 0px;
width: 172px;
.ant-table-column-title{
font-size: 16px;
font-weight: 500;
@ -12,6 +13,9 @@
}
}
tbody{
.btn-83{
margin:0px 8px;
}
tr{
&:hover td{
background-color: #fff!important;
@ -20,6 +24,10 @@
padding:0px;
height: 69px;
line-height: 69px;
color:#333333;
div{
font-weight: 500;
}
}
&:last-child{
td{
@ -28,4 +36,23 @@
}
}
}
}
.tagSpin{
min-height: 300px;
}
.tagBranch{
padding-right: 15px;
text-overflow: ellipsis;
overflow: hidden;
.tagClass{
color:#333333;
}
}
.tagModel{
font-weight: 400;
.tagModelImg img{
width: 25px;
height: 25px;
border-radius: 50%;
}
}

View File

@ -15,10 +15,9 @@ function version(props) {
const [ releases , setReleases ] = useState(undefined);
const [ isSpin , setIsSpin ] = useState(true);
const { projectsId ,owner } = props.match.params;
const { isManager, isDeveloper, location , user } = props;
const { location } = props;
const type = props.projectDetail && props.projectDetail.type;
const turnFromNew = location && location.query && location.query.turnFromNew;
const current_user_login = user && user.login;
useEffect(()=>{
getIssueList();
},[])
@ -34,7 +33,6 @@ function version(props) {
setReleases(result.data.releases);
setIsSpin(false);
}
}).catch((error) => {
console.log(error);
})
@ -130,6 +128,8 @@ function version(props) {
addFunc={addFunc}
/>
)
} else{
return (<div></div>)
}
}

View File

@ -1,7 +1,7 @@
import React ,{useEffect,useRef,useState } from 'react';
import React ,{useEffect,useState } from 'react';
import { truncateCommitId } from '../common/util';
import { AlignCenter , FlexAJ } from '../Component/layout';
import { Button, Tooltip,Progress, Popover, Anchor } from 'antd';
import { Tooltip,Progress } from 'antd';
import './merge.css';
import './Index.scss';
@ -16,6 +16,10 @@ function Files({ data,history,owner,projectsId , parentsSha }){
}
},[data]);
useEffect(()=>{
document.addEventListener('click',()=>{setIsOpen(false)})
})
function showDown(flag,index,isBin){
if(!isBin){
var lists = files.concat();
@ -48,7 +52,7 @@ function Files({ data,history,owner,projectsId , parentsSha }){
<span className="cursor-pointer" data-clipboard-text={item.name}>{item.name}</span>
</AlignCenter>
<div className="see-file">
<Tooltip placement="top" title={`${item.addition+item.deletion}处更改${item.addition + item.deletion > 0 && ""}${item.addition>0?item.addition+"处添加":""}${item.addition>0 && item.deletion>0 ?"和":""}${item.deletion>0?item.deletion+"处删除":""}`}>
<Tooltip placement="top" title={`${item.addition+item.deletion}处更改${item.addition + item.deletion > 0 ? "":""}${item.addition>0?item.addition+"处添加":""}${item.addition>0 && item.deletion>0 ?"和":""}${item.deletion>0?item.deletion+"处删除":""}`}>
<Progress showInfo = {false} strokeColor = "#2DB44D" size="small" percent={item.addition/(item.addition+item.deletion)*100} />
{item.addition >0 && <span className="color-green ml10">+{item.addition}</span>}
{item.deletion >0 && <span className="color-red ml10">-{item.deletion}</span>}
@ -63,7 +67,7 @@ function Files({ data,history,owner,projectsId , parentsSha }){
)
return(
<div>
<div onClick={(e)=>{e.nativeEvent.stopImmediatePropagation()}}>
<AlignCenter className="color-grey-9" style={{position:'relative'}}>
<div onClick={()=>{setIsOpen(!isOpen)}}>
<i className={`iconfont mr5 ${isOpen? "font-18 icon-sanjiaoxing-down":"font-16 icon-triangle"}`}></i>
@ -96,7 +100,7 @@ function Files({ data,history,owner,projectsId , parentsSha }){
</Tooltip>
</AlignCenter>
<div className="see-file">
<Tooltip placement="top" title={`${item.addition + item.deletion}处更改${item.addition + item.deletion > 0 && ""} ${item.addition > 0 ? item.addition + "处添加" : ""}${item.addition > 0 && item.deletion > 0 ? "和" : ""}${item.deletion > 0 ? item.deletion + "处删除" : ""}`}>
<Tooltip placement="top" title={`${item.addition + item.deletion}处更改${item.addition + item.deletion > 0 ? "":""} ${item.addition > 0 ? item.addition + "处添加" : ""}${item.addition > 0 && item.deletion > 0 ? "和" : ""}${item.deletion > 0 ? item.deletion + "处删除" : ""}`}>
<Progress showInfo = {false} strokeColor = "#2DB44D" size="small" percent={item.addition/(item.addition+item.deletion)*100} />
<span className="ml10">{item.addition+item.deletion}</span>
</Tooltip>

View File

@ -83,8 +83,7 @@ class UserSubmitComponent extends Component {
if (result.data && result.data.name) {
this.props.showNotification("文件新建成功!");
if(submitType === "1"){
const { getTopCount , getDetail } = this.props;
getTopCount && getTopCount(values.branchname);
const { getDetail } = this.props;
getDetail && getDetail();
}
let url = `/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`;

View File

@ -153,15 +153,20 @@ class Setting extends Component {
name: values.project_name,
description: values.project_description,
private: private_check,
identifier:values.project_identifier,
...values,
}).then((result) => {
if (result) {
this.props.showNotification(`仓库信息修改成功!`);
const { getDetail } = this.props;
getDetail && getDetail();
this.setState({
loading:false
})
this.props.showNotification(`仓库信息修改成功!`);
// if(values.project_identifier !== projectsId){
// this.props.history.push(`/${owner}/${values.project_identifier}/settings`);
// }else{
// }
const { getDetail } = this.props;
getDetail && getDetail();
}
}).catch((error) => {
console.log(error);
@ -283,6 +288,18 @@ class Setting extends Component {
)}
</Form.Item>
</div>
{/* <Form.Item label=" (url)">
{getFieldDecorator("project_identifier", {
rules: [
{
required: true,
message: "请输入项目标识",
},
],
})(
<Input placeholder="项目标识请使用与项目相关的英文关键字" maxLength="100" />
)}
</Form.Item> */}
<Form.Item label="项目简介">
{getFieldDecorator("project_description", {
rules: [],

View File

@ -19,7 +19,6 @@ function List(props){
const [ search , setSearch ] = useState(undefined);
const [ page , setPage ] = useState(1);
const [ sortBy , setSortBy ] = useState("updated_on");
const [ sortDirection , setSortDirection ] = useState("asc");
const OIdentifier = props.match.params.OIdentifier;
const organizeDetail = props.organizeDetail;
@ -37,7 +36,7 @@ function List(props){
params:{
search,page,limit,
sort_by:sortBy,
sort_direction:sortDirection
sort_direction:"desc"
}
}).then(result=>{
if(result && result.data){

View File

@ -104,6 +104,9 @@ ul,ol,dl{
white-space: normal;
&:hover{
text-decoration: underline;
& .markdown-body{
color: #466AFF;
}
}
}