From dc089c83545783a900a566cac9c0469d24e0a2ad Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 5 Jan 2024 15:02:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=B7=B2=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/tree/Index.jsx | 69 +++++++++++++++++++++------------- src/forge/Main/tree/Index.scss | 8 ++-- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/forge/Main/tree/Index.jsx b/src/forge/Main/tree/Index.jsx index ae3117a86..0faf9fd36 100644 --- a/src/forge/Main/tree/Index.jsx +++ b/src/forge/Main/tree/Index.jsx @@ -3,7 +3,7 @@ import CopyTool from '../../Component/CopyTool'; import { truncateCommitId } from '../../common/util'; import { Link } from 'react-router-dom'; import { getImageUrl , turnbar } from 'educoder'; -import { Button, Dropdown , Input, Menu , message, Modal, Select, Spin, Table, Tooltip } from 'antd'; +import { Button, Dropdown , Input, Menu , message, Modal, Select, Spin, Table, Tooltip , Radio } from 'antd'; import Modals from '../../Component/PublicModal/Index'; import './Index.scss'; @@ -29,26 +29,13 @@ function Index(props) { const [total, setTotal] = useState(0); const [pageSize, setPageSize] = useState(10); + const [ chooseStatus , setChooseStatus ] = useState("all"); + const { projectsId , owner } = props.match.params; const { isManager , isDeveloper , projectDetail , defaultBranch, getDetail } = props; useEffect(()=>{ - // getList(); - const url = `/v1/${owner}/${projectsId}/branches.json`; - Axios.get(url,{ - params:{ - keyword: name, - page: current, - limit: pageSize - } - }).then(result=>{ - if(result){ - const {branches, total_count} = result.data; - setTotal(total_count) - setList(branches); - } - setIsSpin(false); - }).catch(error=>{setIsSpin(false);}) - },[name, reload, pageSize, current]) + getList(chooseStatus); + },[name, reload, pageSize, current,chooseStatus]) useEffect(()=>{ if(projectDetail && document.title.indexOf('所有分支-') === -1){ @@ -96,7 +83,7 @@ function Index(props) { : - + {txt && txt.committer && txt.committer.name} } @@ -141,10 +128,12 @@ function Index(props) { dataIndex: "name", key: 6, align: "center", - width: "320px", + width: "300px", className: "branchActionColumn", - render: (txt, item) => { + render: (txt, item,key) => { + console.log("-----:",item.is_deleted); return ( + item.is_deleted ?
:
{ (isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) && @@ -165,11 +154,32 @@ function Index(props) { } ]; - function getList() { - const url = `/${owner}/${projectsId}/branches_slice.json`; - Axios.get(url).then(result=>{ + function restoreBranch(id,name){ + const url = `/v1/${owner}/${projectsId}/branches/restore.json`; + Axios.post(url,{ + branch_id:id,branch_name:name + }).then(result=>{ + message.success('恢复分支成功'); + let copyList = list; + copyList = copyList.filter(i=>i.branch_id !== id); + setList([...copyList]); + }) + } + + function getList(state) { + const url = `/v1/${owner}/${projectsId}/branches.json`; + Axios.get(url,{ + params:{ + keyword: name, + page: current, + limit: pageSize, + state:chooseStatus==="deleted" ?chooseStatus:undefined + } + }).then(result=>{ if(result){ - setList(result.data); + const {branches, total_count} = result.data; + setTotal(total_count) + setList(branches); } setIsSpin(false); }).catch(error=>{setIsSpin(false);}) @@ -275,7 +285,14 @@ function Index(props) {
- {setCurrent(1);setName(value)}} allowClear/> +
+ {setCurrent(1);setName(value)}} allowClear/> + + {setChooseStatus(v.target.value)}} style={{marginLeft:"25px"}}> + 代码库分支 + 已删除分支 + +
{isManager && 分支设置} {(isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) && } diff --git a/src/forge/Main/tree/Index.scss b/src/forge/Main/tree/Index.scss index 1c31ea8f1..1607f715b 100644 --- a/src/forge/Main/tree/Index.scss +++ b/src/forge/Main/tree/Index.scss @@ -136,12 +136,12 @@ margin-right: 5px; } } - .treeabout{ - flex:1; - text-align: right; - } } } +.treeabout{ + display: flex; + justify-content: space-between; +} .treecopy{ flex:1; display: flex;