顶部count

This commit is contained in:
caishi 2020-07-03 16:32:47 +08:00
parent 7e6c988ef7
commit 2dca31f6c6
10 changed files with 82 additions and 76 deletions

View File

@ -62,11 +62,13 @@ class CoderRootCommit extends Component{
// 切换分支 search:tag为根据标签搜索
changeBranch=(value)=>{
const { page , limit } = this.state;
const { getTopCount } = this.props;
this.setState({
isSpin:true,
branch:value,
})
this.getCommitList(value , page , limit);
getTopCount && getTopCount(value);
}
ChangePage=(page)=>{

View File

@ -10,7 +10,6 @@ import RootTable from './RootTable';
import CoderRootFileDetail from './CoderRootFileDetail';
import { truncateCommitId } from '../common/util';
import RenderHtml from '../../components/render-html';
import Top from './DetailTop';
import axios from "axios";
/**
@ -44,9 +43,6 @@ class CoderRootDirectory extends Component {
zip_url:undefined,
tar_url:undefined,
chooseType:undefined,
tags_count:undefined,
commits_count:undefined,
branches_count:undefined,
md:false
}
@ -125,10 +121,7 @@ class CoderRootDirectory extends Component {
lastCommitAuthor:
last_commit && (last_commit.author || (last_commit.commit && last_commit.commit.author)),
zip_url: result.data.zip_url,
tar_url: result.data.tar_url,
tags_count: result.data.tags_count,
branches_count: result.data.branches_count,
commits_count: result.data.commits_count
tar_url: result.data.tar_url
});
if (entries && entries.length > 0) {
this.renderData(entries);
@ -321,6 +314,9 @@ class CoderRootDirectory extends Component {
isSpin: true,
readOnly:true
});
const { getTopCount } = this.props;
getTopCount && getTopCount(value);
let { search } = this.props.history.location;
if (search && search.indexOf("?url=") > -1) {
let url = search.split("?url=")[1];
@ -456,7 +452,6 @@ class CoderRootDirectory extends Component {
let array = filePath && filePath.split("/");
return (
<Spin spinning={isSpin}>
<Top {...this.props} {...this.state}/>
<div className="main">
<div className="f-wrap-between mb20">
<div className="f-wrap-alignCenter">

View File

@ -1,10 +1,18 @@
import React , { Component } from 'react';
import { Route , Switch } from 'react-router-dom';
import Top from './DetailTop';
import Loadable from 'react-loadable';
import Loading from '../../Loading';
import axios from 'axios';
const FileNew = Loadable({
loader: () => import('../Newfile/Index'),
loading: Loading,
})
const UploadFile = Loadable({
loader: () => import('../Newfile/upload_file'),
loading: Loading,
})
const CoderRootDirectory = Loadable({
loader: () => import('./CoderRootDirectory'),
loading: Loading,
@ -39,56 +47,102 @@ const Diff = Loadable({
})
class CoderRootIndex extends Component{
constructor(props){
super(props);
this.state={
coderCount:undefined
}
}
componentDidMount=()=>{
let { search } = this.props.history.location;
let branchName = undefined;
if (search && search.indexOf("?branch=") > -1) {
branchName = search.split("?branch=")[1];
}
this.getTopCount(branchName);
}
getTopCount=(branch)=>{
const { projectsId } = this.props.match.params;
const url = `/repositories/${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>
<Top {...this.props} {...this.state}/>
<Switch {...this.props}>
{/* 新建文件 */}
<Route path="/projects/:projectsId/coders/:branch/newfile/:path"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/:branch/uploadfile"
render={
(props) => (<UploadFile {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/:branch/newfile"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/commit"
render={
(props) => (<CoderRootCommit {...this.props} {...props} {...this.state} commit_class="main" />)
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
}
></Route>
{/* diff */}
<Route path="/projects/:projectsId/diff/:sha"
render={
(props) => (<Diff {...this.props} {...props} {...this.state}/>)
() => (<Diff {...this.props} {...this.state}/>)
}
></Route>
<Route path="/projects/:projectsId/coders/version/new"
render={
(props) => (<CoderRootVersionNew {...this.props} {...props} {...this.state} />)
() => (<CoderRootVersionNew {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/version/:versionId/update"
render={
(props) => (<CoderRootVersionUpdate {...this.props} {...props} {...this.state} />)
() => (<CoderRootVersionUpdate {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/version"
render={
(props) => (<CoderRootVersion {...this.props} {...props} {...this.state} />)
() => (<CoderRootVersion {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/tag"
render={
(props) => (<CoderRootTag {...this.props} {...props} {...this.state} />)
() => (<CoderRootTag {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders/branch"
render={
(props) => (<CoderRootBranch {...this.props} {...props} {...this.state} />)
() => (<CoderRootBranch {...this.props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/coders"
render={
(props) => (<CoderRootDirectory {...this.props} {...props} {...this.state} />)
() => (<CoderRootDirectory {...this.props} {...this.state} getTopCount={this.getTopCount} />)
}
></Route>
<Route path="/projects/:projectsId"
render={
(props) => (<CoderRootDirectory {...this.props} {...props} {...this.state} />)
() => (<CoderRootDirectory {...this.props} {...this.state} getTopCount={this.getTopCount} />)
}
></Route>
</Switch>

View File

@ -35,7 +35,6 @@ export default ({
<ul className="ul_thead">
<li>
<span className="flex1">标签名</span>
{/* <span>描述</span> */}
<span>提交信息</span>
<span className="ul_tbody_forth">下载</span>
</li>
@ -49,10 +48,8 @@ export default ({
<i className="iconfont icon-biaoqian3 font-16 mr5 color-grey-8"></i>
<span className="font-16">{item.name}</span>
</span>
{/* <span className="font-16 task-hide">坎坎坷坷死二无一额坎坎坷坷死二无一额坎坎坷坷死二无一额</span> */}
<span className="ul_tbody_third">
<span className="commitKey" style={{ "marginLeft": 0 }}>{truncateCommitId(`${item.id}`)}</span>
{/* <span>2020-05-18 16:30</span> */}
</span>
<span className="ul_tbody_forth">
<a href={item.tarball_url} style={{ color: "#4CC1DA" }} className="mr30"><i className="iconfont icon-TAR font-18 mr5"></i>TAR</a>

View File

@ -21,14 +21,6 @@ import img_parised from '../Images/parised.png';
import img_focused from '../Images/focused.png';
import img_fork from '../Images/fork.png';
import img_milepost from '../Images/milepost.png';
const FileNew = Loadable({
loader: () => import('../Newfile/Index'),
loading: Loading,
})
const UploadFile = Loadable({
loader: () => import('../Newfile/upload_file'),
loading: Loading,
})
const Setting = Loadable({
loader: () => import('../Settings/Index'),
loading: Loading,
@ -146,7 +138,7 @@ class Detail extends Component {
branchList: undefined,
project: null,
firstSync:false,
secondSync:false
secondSync:false,
}
}
@ -314,7 +306,6 @@ class Detail extends Component {
const url = `/repositories/${repo_id}/sync_mirror.json`;
axios.post(url).then(result => {
if (result && result.data && result.data.status === 0) {
// this.props.showNotification("镜像同步成功!");
this.getProject(2);
} else {
this.props.showNotification("镜像同步失败!");
@ -345,12 +336,6 @@ class Detail extends Component {
</React.Fragment> : ""
);
const mirror = (
<React.Fragment>
<span>镜像自 </span>
<a href={projectDetail && projectDetail.mirror_url} target="_blank" style={{ color: "#fff" }}>{projectDetail && projectDetail.mirror_url}</a>
</React.Fragment>
)
const common = {
getDetail: this.getDetail
}
@ -477,23 +462,6 @@ class Detail extends Component {
:
<Spin spinning={secondSync} className="spinstyle" tip="正在同步镜像" size="large">
<Switch {...this.props}>
{/* 新建文件 */}
<Route path="/projects/:projectsId/coders/:branch/newfile/:path"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/coders/:branch/uploadfile"
render={
(props) => (<UploadFile {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:projectsId/coders/:branch/newfile"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
{/* 标签列表 */}
<Route path="/projects/:projectsId/orders/tags"
render={

View File

@ -3,34 +3,30 @@ import { Link } from 'react-router-dom';
class DetailTop extends Component {
render() {
const { projectDetail, tags_count, commits_count, branches_count } = this.props;
const { coderCount } = this.props;
const { projectsId } = this.props.match.params;
const { pathname } = this.props.location;
return (
<p className="branch-wrapper">
<Link to={`/projects/${projectsId}/coders/commit`} className={pathname.indexOf("/coders/commit") > 0 ? "active" : ""}>
<i className="iconfont icon-tijiaojilu font-20 mr3 font-bd"></i>
<span>{commits_count}</span>
<span>{(coderCount && coderCount.commits_count) || 0}</span>
</Link>
<Link to={`/projects/${projectsId}/coders/branch`} className={pathname.indexOf("/coders/branch") > 0 ? "active" : ""}>
<i className="iconfont icon-fenzhi1 font-18 mr3"></i>
<span>{branches_count}</span>
<span>{(coderCount && coderCount.branches_count) || 0}</span>
</Link>
<Link to={`/projects/${projectsId}/coders/tag`} className={pathname.indexOf("/coders/tag") > 0 ? "active" : ""}>
<i className="iconfont icon-biaoqian3 font-18 mr3"></i>
<span>{tags_count}</span>
<span>{(coderCount && coderCount.tags_count) || 0}</span>
</Link>
<Link to={`/projects/${projectsId}/coders/version`} className={pathname.indexOf("/coders/version") > 0 ? "active" : ""}>
<i className="iconfont icon-fahangban font-18 mr3"></i>
<span>{projectDetail && projectDetail.version_releasesed_count}</span>
<span>{(coderCount && coderCount.version_releasesed_count) || 0}</span>
</Link>
{/* <Link to={`/projects/${projectsId}/coders/contributor`} className={pathname.indexOf("/coders/contributor") > 0 ? "active" : ""}>
<i className="iconfont icon-gongxianzhe font-18 mr3"></i>
<span>{projectDetail && projectDetail.contributor_users_count}</span>
</Link> */}
<a href="javscript:void(0)" style={{cursor:"default"}}>
<i className="iconfont icon-cangku font-18 mr3"></i>
仓库 <span className="ml3">{projectDetail && projectDetail.size}</span>
仓库 <span className="ml3">{(coderCount && coderCount.size) || 0}</span>
</a>
</p>
)

View File

@ -1,6 +1,5 @@
import React, { Component } from "react";
import Meditor from "./m_editor";
import Top from "../Main/DetailTop";
import "./index.css";
import { Input, Select } from "antd";
@ -94,7 +93,6 @@ class Index extends Component {
];
return (
<React.Fragment>
<Top {...this.props} {...this.state} />
<div className="main">
<p className="pb15 bor-bottom-greyE font-16 color-grey-3 mb20">
新建文件

View File

@ -56,8 +56,8 @@ class UserSubmitComponent extends Component {
this.props.history.push(url);
this.props.showNotification("文件新建成功!");
if(submitType === "1"){
const { getDetail } = this.props;
getDetail && getDetail();
const { getTopCount } = this.props;
getTopCount && getTopCount(values.branchname);
}
}
})

View File

@ -1,8 +1,5 @@
import React, { Component } from "react";
// import Meditor from "./m_editor";
import Top from "../Main/DetailTop";
import "./index.css";
// import { Input, Select } from "antd";
import UserSubmitComponent from "./UserSubmitComponent";
import Upload from "../Upload/read";
import UploadImg from "../Images/upload.png";
@ -34,7 +31,6 @@ class UploadFile extends Component {
return (
<React.Fragment>
<Top {...this.props} {...this.state} />
<div className="main">
<p className="pb15 bor-bottom-greyE font-16 color-grey-3 mb20">
上传文件

View File

@ -1,10 +1,10 @@
import React, { Component } from "react";
import OrderItem from './order_form'
import OrderForm from './order_form'
class New extends Component {
render() {
return (
<OrderItem form_type="new" {...this.props}></OrderItem>
<OrderForm form_type="new" {...this.props}></OrderForm>
)
}