diff --git a/src/forge/DevOps/Infos.jsx b/src/forge/DevOps/Infos.jsx index 373d21138..eb9848c57 100644 --- a/src/forge/DevOps/Infos.jsx +++ b/src/forge/DevOps/Infos.jsx @@ -12,11 +12,14 @@ const Div = styled.div`{ }`; export default ((props)=>{ const [ menu , setMenu ] = useState(false); + const [ permission , setPermission ] = useState(""); const childRef = useRef(); const path = props.location.pathname; const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; + + const projectDetail = props.projectDetail; useEffect(()=>{ if(path === `/projects/${owner}/${projectsId}/devops/list`){ setMenu(true); @@ -25,6 +28,12 @@ export default ((props)=>{ } },[path]) + useEffect(()=>{ + if(projectDetail){ + setPermission(props.projectDetail.permission); + } + },[projectDetail]) + const updateChildState = () => { // changeVal就是子组件暴露给父组件的方法 if (childRef.current) { @@ -35,13 +44,13 @@ export default ((props)=>{ return(
- 工作流配置 - 构建列表 + { permission !=="Reporter" && 工作流配置} + 构建列表 { menu===true && 刷新}
{ menu === true && childRef.current = form} ref={childRef}/> } - { menu === false && } + { menu === false && permission !=="Reporter" && }
) diff --git a/src/forge/DevOps/Structure.jsx b/src/forge/DevOps/Structure.jsx index 89ba01ca1..2654045a0 100644 --- a/src/forge/DevOps/Structure.jsx +++ b/src/forge/DevOps/Structure.jsx @@ -22,6 +22,7 @@ function Structure(props,ref){ let projectsId = props.match.params.projectsId; let owner = props.match.params.owner; + const permission = props.projectDetail && props.projectDetail.permission; useImperativeHandle(ref, () => ({ changeVal: () => { @@ -29,11 +30,13 @@ function Structure(props,ref){ Init(); } })) + useEffect(() => { if (projectsId) { Init(); } }, []); + let current_user = props.current_user; function Init(status) { const url = `/${owner}/${projectsId}/builds.json`; @@ -266,7 +269,11 @@ function Structure(props,ref){ dataIndex: "operation", key: "operation", render: (value, item, key) => { - return renderStatusBtn(item.status, item.number); + if(permission === "Admin" || permission === "Owner"){ + return renderStatusBtn(item.status, item.number); + }else{ + return "--"; + } }, }, ]; diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 74757c808..fe23ba961 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -369,7 +369,7 @@ class Detail extends Component { const { projectDetail, watchers_count, praises_count, forked_count, firstSync , secondSync , isManager, watched, praised, - project , open_devops , author } = this.state; + project , open_devops } = this.state; const url = this.props.history.location.pathname; const urlArr = url.split("/"); @@ -379,8 +379,6 @@ class Detail extends Component { const { projectsId , owner } = this.props.match.params; const { state } = this.props.history.location; - const { current_user } = this.props; - const checkLogin = current_user && current_user.login; const text = ( projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ? @@ -392,7 +390,6 @@ class Detail extends Component { : "" ); - const common = { getDetail: this.getDetail, changeOpenDevops:this.changeOpenDevops