From da5771874308d5a63cfd06499ab712262ef1d876 Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Mon, 29 Jun 2020 11:34:05 +0800 Subject: [PATCH 1/5] FIX performance for project detail's page --- src/forge/Main/CoderRootDirectory.js | 19 +++++++++++++----- src/forge/Main/CoderRootIndex.js | 7 ++----- src/forge/Main/Detail.js | 29 ++++------------------------ src/forge/Main/DetailTop.js | 8 ++++---- 4 files changed, 24 insertions(+), 39 deletions(-) diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 6137a1da8..5843d043b 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -10,6 +10,7 @@ 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"; /** @@ -42,7 +43,11 @@ class CoderRootDirectory extends Component { readOnly: true, zip_url:undefined, tar_url:undefined, - chooseType:undefined + chooseType:undefined, + tags_count:undefined, + commits_count:undefined, + branches_count:undefined + } } changeAddress = (address) => { @@ -122,6 +127,9 @@ class CoderRootDirectory extends Component { (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 }); if (entries && entries.length > 0) { this.renderData(entries); @@ -440,14 +448,15 @@ class CoderRootDirectory extends Component { let array = filePath && filePath.split("/"); return ( +
- {filePath && ( diff --git a/src/forge/Main/CoderRootIndex.js b/src/forge/Main/CoderRootIndex.js index 09c1b113c..c3a17214f 100644 --- a/src/forge/Main/CoderRootIndex.js +++ b/src/forge/Main/CoderRootIndex.js @@ -3,7 +3,6 @@ import { Route , Switch } from 'react-router-dom'; import Loadable from 'react-loadable'; import Loading from '../../Loading'; -import Top from './DetailTop'; const CoderRootDirectory = Loadable({ @@ -40,11 +39,9 @@ const Diff = Loadable({ }) class CoderRootIndex extends Component{ - render(){ return(
- () } > - + () @@ -99,4 +96,4 @@ class CoderRootIndex extends Component{ ) } } -export default CoderRootIndex; \ No newline at end of file +export default CoderRootIndex; diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 05899dde8..24665045a 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -186,7 +186,7 @@ class Detail extends Component { // 关注和取消关注 focusFunc = (flag) => { const { project_id } = this.state; - + axios({ method: flag? 'delete' : 'post', url: `/watchers/${flag? 'unfollow' : 'follow'}.json`, @@ -262,25 +262,7 @@ class Detail extends Component { console.log(error); }) } - // 获取分支列表 - getBranch = (id) => { - const url = `/projects/${id}/branches.json`; - axios.get(url).then((result) => { - if (result && result.data.length > 0) { - const branchs = []; - result.data.map((item, key) => { - branchs.push({ - index: key, - name: item.name - }) - }) - this.setState({ - branchList: result.data, - branchs, - }) - } - }).catch((error) => { }) - } + // 同步镜像 synchronismMirror=()=>{ @@ -299,7 +281,7 @@ class Detail extends Component { isSpin:false }) } - + }).catch(error=>{ console.log(error); }) @@ -337,7 +319,6 @@ class Detail extends Component { } return (
-
@@ -404,7 +385,6 @@ class Detail extends Component {
  • -1 || urlFlag) ? "active" : ""}> 代码库 - { projectDetail && projectDetail.commits_count ? {projectDetail.commits_count}:""}
  • -1 && !(url.indexOf("Milepost") > 0 || url.indexOf("meilpost") > 0 || url.indexOf("tags") > 0)) ? "active" : ""}> @@ -546,7 +526,7 @@ class Detail extends Component { () + (props) => () } > @@ -604,7 +584,6 @@ class Detail extends Component { } > -
  • ) } diff --git a/src/forge/Main/DetailTop.js b/src/forge/Main/DetailTop.js index 4d4d584f7..9cc225cc3 100644 --- a/src/forge/Main/DetailTop.js +++ b/src/forge/Main/DetailTop.js @@ -3,22 +3,22 @@ import { Link } from 'react-router-dom'; class DetailTop extends Component { render() { - const { projectDetail } = this.props; + const { projectDetail, tags_count, commits_count, branches_count } = this.props; const { projectsId } = this.props.match.params; const { pathname } = this.props.location; return (

    0 ? "active" : ""}> - {projectDetail && projectDetail.commits_count}个提交 + {commits_count}个提交 0 ? "active" : ""}> - {projectDetail && projectDetail.branches_count}个分支 + {branches_count}个分支 0 ? "active" : ""}> - {projectDetail && projectDetail.issue_tags_count}个标签 + {tags_count}个标签 0 ? "active" : ""}> From 81056a261414072716cd14e79d566972b736f780 Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Mon, 29 Jun 2020 14:48:46 +0800 Subject: [PATCH 2/5] ADD get simple project api --- src/forge/Main/Detail.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 24665045a..2dc4ac1a2 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -145,10 +145,12 @@ class Detail extends Component { author: undefined, branchs: undefined, branchList: undefined, + project: null } } componentDidMount = () => { + this.getProject(); this.getDetail(); } @@ -158,10 +160,19 @@ class Detail extends Component { } } + getProject = () => { + const { projectsId } = this.props.match.params; + const url = `/repositories/${projectsId}.json`; + axios.get(url).then((result) => { + this.setState({ + project: result.data + }) + }) + } getDetail = () => { const { projectsId } = this.props.match.params; - const url = `/repositories/${projectsId}.json`; + const url = `/repositories/${projectsId}/simple.json`; axios.get(url).then((result) => { if (result) { this.setState({ @@ -288,7 +299,7 @@ class Detail extends Component { } render() { - const { projectDetail, watchers_count, praises_count, forked_count, isSpin, isManager, watched, praised } = this.state; + const { projectDetail, watchers_count, praises_count, forked_count, isSpin, isManager, watched, praised, project } = this.state; const url = this.props.history.location.pathname; const urlArr = url.split("/"); const urlFlag = (urlArr.length === 3); @@ -323,14 +334,14 @@ class Detail extends Component {

    - {projectDetail && projectDetail.author && - - {projectDetail.author.name} + {project && project.author && + + {project.author.name} } / - {projectDetail && projectDetail.name} + {project && project.name} { projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ? From a031d9a8ccc50f59d1075bb089e2e7ebf958f487 Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Mon, 29 Jun 2020 15:28:24 +0800 Subject: [PATCH 3/5] FIX bug --- src/forge/Main/Detail.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 2dc4ac1a2..a177234ec 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -156,13 +156,14 @@ class Detail extends Component { componentDidUpdate = (prevState) => { if ((prevState.match.params.projectsId !== this.props.match.params.projectsId)) { + this.getProject(); this.getDetail(); } } getProject = () => { const { projectsId } = this.props.match.params; - const url = `/repositories/${projectsId}.json`; + const url = `/projects/${projectsId}/simple.json`; axios.get(url).then((result) => { this.setState({ project: result.data @@ -172,7 +173,7 @@ class Detail extends Component { getDetail = () => { const { projectsId } = this.props.match.params; - const url = `/repositories/${projectsId}/simple.json`; + const url = `/repositories/${projectsId}.json`; axios.get(url).then((result) => { if (result) { this.setState({ @@ -285,6 +286,7 @@ class Detail extends Component { axios.post(url).then(result=>{ if(result && result.data && result.data.status === 0){ this.props.showNotification("镜像同步成功!"); + this.getProject(); this.getDetail(); }else{ this.props.showNotification("镜像同步失败!"); From 10bf79843d182aec02e51a686fe7457bcbd0ce5d Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 29 Jun 2020 16:32:39 +0800 Subject: [PATCH 4/5] bug --- src/forge/Component/Component.scss | 2 +- src/forge/Component/layout.jsx | 34 +++++++++-- src/forge/Merge/NewMerge.js | 4 +- src/forge/Newfile/index.css | 2 +- src/forge/Order/order.js | 52 +++++++++++----- src/forge/Settings/Collaborator.js | 2 +- src/forge/Settings/setting.scss | 7 +++ src/forge/Team/Group/GroupDetailSetting.jsx | 39 +++++++----- src/forge/Team/Group/SettingCommon.jsx | 67 +++++++++++++++++++++ src/forge/Team/Index.scss | 17 ++++++ src/forge/Team/Sub/Detail.jsx | 6 +- 11 files changed, 186 insertions(+), 46 deletions(-) create mode 100644 src/forge/Team/Group/SettingCommon.jsx diff --git a/src/forge/Component/Component.scss b/src/forge/Component/Component.scss index 1040f54d8..b39e0952e 100644 --- a/src/forge/Component/Component.scss +++ b/src/forge/Component/Component.scss @@ -14,7 +14,7 @@ li.ant-menu-item{ align-items: center; padding:20px 34px; background-color: #fff; - margin:18px 0px; + margin-bottom:18px; .img{ margin-right: 20px; width: 190px; diff --git a/src/forge/Component/layout.jsx b/src/forge/Component/layout.jsx index 6d4e23651..64b4b3779 100644 --- a/src/forge/Component/layout.jsx +++ b/src/forge/Component/layout.jsx @@ -48,8 +48,8 @@ export const WhiteBack = styled.div`{ border-radius:5px; }` export const Blueline = styled.a`{ - height:32px; - line-height:30px; + height:30px; + line-height:28px; border-radius:2px; border:1px solid rgba(80,145,255,1); color:rgba(80,145,255,1); @@ -57,8 +57,8 @@ export const Blueline = styled.a`{ display:inline-block; }` export const Redline = styled.a`{ - height:32px; - line-height:32px; + height:30px; + line-height:28px; border-radius:2px; border:1px solid #F73030; color:#F73030; @@ -68,8 +68,8 @@ export const Redline = styled.a`{ text-align:center; }` export const Greenline = styled.a`{ - height:32px; - line-height:32px; + height:30px; + line-height:28px; border-radius:2px; border:1px solid #28BD6C; color:#28BD6C; @@ -78,6 +78,28 @@ export const Greenline = styled.a`{ min-width:80px; text-align:center; }` +export const Greenback = styled.a`{ + height:30px; + line-height:30px; + border-radius:2px; + background-color:#28BD6C; + color:#fff; + padding:0px 12px; + display:inline-block; + min-width:80px; + text-align:center; +}` +export const Redback = styled.a`{ + height:30px; + line-height:30px; + border-radius:2px; + background-color:#F73030; + color:#fff; + padding:0px 12px; + display:inline-block; + min-width:80px; + text-align:center; +}` export const NumUl = styled.ul`{ padding-left: 20px; & > li{ diff --git a/src/forge/Merge/NewMerge.js b/src/forge/Merge/NewMerge.js index 6e8ad7f36..b11a7f022 100644 --- a/src/forge/Merge/NewMerge.js +++ b/src/forge/Merge/NewMerge.js @@ -163,7 +163,7 @@ class NewMerge extends Component {

    {show_message ? ( -
    +
    -
    +
    diff --git a/src/forge/Newfile/index.css b/src/forge/Newfile/index.css index e22f374b9..636da8e2f 100644 --- a/src/forge/Newfile/index.css +++ b/src/forge/Newfile/index.css @@ -5,7 +5,7 @@ .setInputAddon .ant-input-group-addon{ height: 30px; line-height: 30px; - border-left: 1px solid #d9d9d9!important; + border: 1px solid #d9d9d9!important; border-right: none!important; } diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js index 854fa6544..0e7dd9cad 100644 --- a/src/forge/Order/order.js +++ b/src/forge/Order/order.js @@ -55,7 +55,6 @@ class order extends Component { allValue: [], all: false, select_params: { - status_type: "1", //开启中和关闭中,全部,默认为全部 assigned_to_id: undefined, // 负责人 author_id: undefined, // 发布人 issue_tag_id: undefined, // 标签 @@ -77,7 +76,7 @@ class order extends Component { componentDidMount = () => { this.getSelectList(); - this.getIssueList(); + this.getIssueList('1'); }; getSelectList = () => { @@ -101,7 +100,7 @@ class order extends Component { }; // 获取列表数据 - getIssueList = (begin, end) => { + getIssueList = (status_type , begin, end) => { this.setState({ isSpin: true }) @@ -113,7 +112,8 @@ class order extends Component { params: { ...select_params, start_date: begin, - due_date: end + due_date: end, + status_type } }) .then((result) => { @@ -165,7 +165,8 @@ class order extends Component { this.state.select_params.order_name = key_name[0]; this.state.select_params.order_type = e.item.props.value; this.state.select_params.page = 1; - this.getIssueList(); + const { status_type } = this.state; + this.getIssueList(status_type); }; getOption = (e, id, name,toGet) => { @@ -192,7 +193,8 @@ class order extends Component { assigned_to_id }); if(!toGet){ - this.getIssueList(); + const { status_type } = this.state; + this.getIssueList(status_type); } }; @@ -225,8 +227,10 @@ class order extends Component { checkedValue: [], all: false }); + + const { status_type } = this.state; this.state.select_params.page = page; - this.getIssueList(); + this.getIssueList(status_type); }; // 搜索 @@ -235,9 +239,11 @@ class order extends Component { search: value, isSpin: true, }); + const { status_type } = this.state; + this.state.select_params.search = value; this.state.select_params.page = 1; - this.getIssueList(); + this.getIssueList(status_type); }; openorder = (type) => { @@ -254,12 +260,11 @@ class order extends Component { paix: "排序", }); this.state.select_params = { - status_type: type, search: undefined, page: 1, limit: 15, }; - this.getIssueList(); + this.getIssueList(type); }; // 筛选:全部、指派给我、由我创建 @@ -269,7 +274,7 @@ class order extends Component { isSpin: true, }); if (type) { - if (current_user === undefined) { + if (!current_user) { this.setState({ isSpin: false, }); @@ -304,8 +309,9 @@ class order extends Component { this.state.select_params.assigned_to_id = undefined; this.state.select_params.author_id = undefined; } + const { status_type } = this.state; - this.getIssueList(); + this.getIssueList(status_type); }; deletedetail = (id) => { @@ -319,7 +325,9 @@ class order extends Component { }) .then((result) => { if (result) { - this.getIssueList(); + const { status_type } = this.state; + + this.getIssueList(status_type); } }) .catch((error) => { @@ -339,16 +347,18 @@ class order extends Component { // 修改开始时间 changeBeginTime = (data, value) => { + const { status_type } = this.state; this.setState({ begin: value }) - this.getIssueList(value, this.state.end); + this.getIssueList(status_type,value, this.state.end); } changeEndTime = (data, value) => { + const { status_type } = this.state; this.setState({ end: value }) - this.getIssueList(this.state.begin, value); + this.getIssueList(status_type,this.state.begin, value); } // 选择列表里面的checkbox @@ -395,6 +405,11 @@ class order extends Component { updateIssues=()=>{ const {checkedValue , select_params} = this.state; const { projectsId } = this.props.match.params; + + if(!select_params.update_author_id && !select_params.update_fixed_version_id &&!select_params.update_status_id ){ + this.resetSelectParams(); + return; + } this.setState({ isSpin:true }) @@ -415,6 +430,12 @@ class order extends Component { } successFunc=()=>{ + this.resetSelectParams(); + const { status_type } = this.state; + this.getIssueList(status_type); + } + + resetSelectParams=()=>{ let select_params = this.state.select_params; select_params.update_author_id = undefined; select_params.update_fixed_version_id = undefined; @@ -427,7 +448,6 @@ class order extends Component { update_status_ids:"修改状态", select_params }) - this.getIssueList(); } // 批量删除 diff --git a/src/forge/Settings/Collaborator.js b/src/forge/Settings/Collaborator.js index 8e76e7d41..e1bf408e5 100644 --- a/src/forge/Settings/Collaborator.js +++ b/src/forge/Settings/Collaborator.js @@ -468,7 +468,7 @@ class Collaborator extends Component {
    - {listData ? ( + {listData && listData.length>0 ? ( tr > td{ border-bottom: none; + padding:15px 8px 15px 0px; + } + .ant-table-tbody > tr > td:last-child{ + padding-right: 0px; } } diff --git a/src/forge/Team/Group/GroupDetailSetting.jsx b/src/forge/Team/Group/GroupDetailSetting.jsx index 13864a627..2503370ec 100644 --- a/src/forge/Team/Group/GroupDetailSetting.jsx +++ b/src/forge/Team/Group/GroupDetailSetting.jsx @@ -1,32 +1,35 @@ import React , { useState } from 'react'; -import { Box , Long , Short , Gap , Banner , WhiteBack } from '../../Component/layout'; +import { Box , Long , Short , Gap , WhiteBack } from '../../Component/layout'; import Title from '../../Component/Title'; import Setnav from '../../Component/Setnav'; -import styled from 'styled-components'; -const Div = styled.div`{ - padding:18px 30px; -}` +import { Route, Switch } from "react-router-dom"; +import Loadable from "react-loadable"; +import Loading from "../../../Loading"; + +const Common = Loadable({ + loader: () => import("./SettingCommon"), + loading: Loading, +}); export default (props)=>{ const pathname = props.location.pathname; const organizeId = props.match.params.organizeId; + const memberId = props.match.params.memberId; function returnActive (pathname){ let a = 0; - if(pathname === `/organize/${organizeId}/setting/member`){ + if(pathname === `/organize/${organizeId}/member/${memberId}/setting/member`){ a = 1; - }else if(pathname === `/organize/${organizeId}/setting/group`){ + }else if(pathname === `/organize/${organizeId}/member/${memberId}/setting/project`){ a = 2; - }else if(pathname === `/organize/${organizeId}/setting/hooks`){ - a = 3; } return a; } const active = returnActive(pathname); const array = {list:[ - {name:'基本设置',icon:"icon-base",href:`/organize/${organizeId}/setting`}, - {name:'团队成员管理',icon:"icon-zuzhichengyuan",href:`/organize/${organizeId}/setting/member`}, - {name:'团队项目管理',icon:"icon-zuzhixiangmu",href:`/organize/${organizeId}/setting/group`}, + {name:'基本设置',icon:"icon-base",href:`/organize/${organizeId}/member/${memberId}/setting`}, + {name:'团队成员管理',icon:"icon-zuzhichengyuan",href:`/organize/${organizeId}/member/${memberId}/setting/member`}, + {name:'团队项目管理',icon:"icon-zuzhixiangmu",href:`/organize/${organizeId}/member/${memberId}/setting/project`}, ], active } @@ -38,10 +41,14 @@ export default (props)=>{ - 团队项目管理 -
    - -
    + + ( + + )} + > +
    diff --git a/src/forge/Team/Group/SettingCommon.jsx b/src/forge/Team/Group/SettingCommon.jsx new file mode 100644 index 000000000..26de5d743 --- /dev/null +++ b/src/forge/Team/Group/SettingCommon.jsx @@ -0,0 +1,67 @@ +import React , { useState } from 'react'; +import { AutoComplete , Pagination } from 'antd'; +import { Banner , Blueline , FlexAJ , Greenback , Redback } from '../../Component/layout'; +import styled from 'styled-components'; + +const Option = AutoComplete.Option; +const Div = styled.div`{ + padding:18px 30px; +}`; +const LIMIT = 15; +const demoData=[{name:"Python相关",id:1},{name:"Python相关",id:2}]; +export default ()=>{ + const [ searchKey , setSearchKey ] = useState(undefined); + const [ page , setPage ] = useState(1); + const [ total , setTotal ] = useState(0); + + function changeInputUser(){} + function selectInputUser(){} + + // 切换分页 + function ChangePage(page){ + setPage(page); + } + const source = demoData && demoData.map((item,key)=>{ + return( + + ) + }) + return( +
    + 团队项目管理 +
    + +
    + + + 添加项目 +
    + + 添加所有 + 移除所有 + +
    +
    +
    + + caishi/前端v0.1 + + 移除 +
    +
    + { + total > LIMIT ? +
    + +
    :"" + } +
    +
    + ) +} \ No newline at end of file diff --git a/src/forge/Team/Index.scss b/src/forge/Team/Index.scss index 987fc8666..1cfc0132d 100644 --- a/src/forge/Team/Index.scss +++ b/src/forge/Team/Index.scss @@ -38,6 +38,7 @@ .teamDetail{ width: 1200px; margin:0px auto; + padding-top:18px; } .list{ display: flex; @@ -322,3 +323,19 @@ } } +// 组织团队设置 +.actionNav{ + padding:20px 30px; + background-color: #FAFAFA; +} +.GSlist{ + padding-top:15px; + min-height: 400px; + &>div{ + padding:20px 0px; + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid #eee; + } +} diff --git a/src/forge/Team/Sub/Detail.jsx b/src/forge/Team/Sub/Detail.jsx index 4b6d5e69a..113ccd64c 100644 --- a/src/forge/Team/Sub/Detail.jsx +++ b/src/forge/Team/Sub/Detail.jsx @@ -31,19 +31,19 @@ export default ((props)=>{ { + render={() => { return }} > { + render={() => { return }} > { + render={() => { return }} > From ab2787d2bc483b2cfeb7b4c3e7343b2481dc4193 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 29 Jun 2020 17:46:43 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=EF=BC=9A=E7=89=88=E6=9C=AC=E5=BA=93=E5=9C=B0=E5=9D=80=E5=92=8C?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=90=8D=E7=A7=B0=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/New/Index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index c9f616f9d..ca4e970fa 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -216,6 +216,21 @@ class Index extends Component { }) } + ChangeAddr=(e)=>{ + let value = e.target.value; + if(value.indexOf("/") > -1){ + let arr = value.split("/"); + let first = arr[arr.length-1]; + if(first.indexOf(".git") > -1){ + let second = first.split('.')[0]; + if(!second)return; + this.props.form.setFieldsValue({ + repository_name:second + }) + } + } + } + render() { const { getFieldDecorator } = this.props.form; // 项目类型:deposit-托管项目,mirror-镜像项目 @@ -262,7 +277,7 @@ class Index extends Component { required: true, message: '请填写镜像版本库地址' }], })( - + )}

    示例:https://github.com/facebook/reack.git