forked from Gitlink/forgeplus-react
组织团队设置:增加可选访问单元wiki
This commit is contained in:
parent
5d465ec782
commit
061fa0ee71
|
@ -24,21 +24,24 @@ export default Form.create()(
|
|||
const [check_box, setCheckBox] = useState(false);
|
||||
const [switch_box, setSwtichBox] = useState([]);
|
||||
const [onwers, setOnwers] = useState(false);
|
||||
const [auth, setAuth] = useState("");
|
||||
const [ descNum , setDescNum ] = useState(0);
|
||||
const [switch_box_code, setSwtichBoxCode] = useState(false);
|
||||
const [switch_box_pull, setSwtichBoxPull] = useState(false);
|
||||
const [switch_box_issue, setSwtichBoxIssue] = useState(false);
|
||||
const [switch_box_release, setSwtichBoxRelease] = useState(false);
|
||||
const [switch_box_wiki, setSwtichBoxWiki] = useState(false);
|
||||
const { getFieldDecorator, validateFields, setFieldsValue } = form;
|
||||
const { OIdentifier, groupId } = match.params;
|
||||
|
||||
useEffect(() => {
|
||||
if (GroupDetail) {
|
||||
setOnwers(GroupDetail.authorize === "owner");
|
||||
setAuth(GroupDetail.authorize);
|
||||
setCheckBox(GroupDetail.can_create_org_project)
|
||||
setSwtichBox(GroupDetail.units)
|
||||
setFieldsValue({
|
||||
...GroupDetail
|
||||
...GroupDetail,
|
||||
})
|
||||
setDescNum(GroupDetail.description ? GroupDetail.description.length : 0);
|
||||
}
|
||||
|
@ -50,6 +53,7 @@ export default Form.create()(
|
|||
setSwtichBoxPull(switch_checked("pulls"))
|
||||
setSwtichBoxIssue(switch_checked("issues"))
|
||||
setSwtichBoxRelease(switch_checked("releases"))
|
||||
setSwtichBoxWiki(switch_checked("wiki"))
|
||||
}
|
||||
}, [switch_box])
|
||||
|
||||
|
@ -132,6 +136,11 @@ export default Form.create()(
|
|||
setSwtichBoxRelease(checked)
|
||||
}
|
||||
|
||||
function switch_wiki_types(checked, event) {
|
||||
switch_unit_types(checked, "wiki");
|
||||
setSwtichBoxWiki(checked);
|
||||
}
|
||||
|
||||
function cancelEdit(){
|
||||
if(groupId){
|
||||
history.push(`/organize/${OIdentifier}/group/${groupId}`);
|
||||
|
@ -140,6 +149,9 @@ export default Form.create()(
|
|||
}
|
||||
}
|
||||
|
||||
function changeAuth(params) {
|
||||
setAuth(params.target.value)
|
||||
}
|
||||
|
||||
function checkname(rule, value, callback){
|
||||
if(!value){
|
||||
|
@ -206,31 +218,36 @@ export default Form.create()(
|
|||
'版本库权限:',
|
||||
"authorize",
|
||||
[],
|
||||
<Radio.Group>
|
||||
<Radio.Group onChange={changeAuth}>
|
||||
<Radio value="read" style={addStyle}>读取权限<span className="color-grey-8 ml10">(成员可以查看和克隆团队项目)</span></Radio>
|
||||
<Radio value="write" style={addStyle}>写入权限<span className="color-grey-8 ml10">(成员可以查看和推送提交到团队项目)</span></Radio>
|
||||
<Radio value="admin" style={OptionStyle}>管理员权限<span className="color-grey-8 ml10">(成员可以拉取和推送到团队项目同时可以添加协作者)</span></Radio>
|
||||
</Radio.Group>, false, 20,onwers ? "hide":""
|
||||
)}
|
||||
</Form>
|
||||
<p className="required">允许访问项目单元:</p>
|
||||
<AlignCenter className="mb10">
|
||||
<Switch checked={switch_box_code} onClick={switch_code_types} />
|
||||
<span className="ml30 color-grey-3">代码库<span className="color-grey-8 ml15">(查看源码、文件、提交和分支)</span></span>
|
||||
</AlignCenter>
|
||||
<AlignCenter className="mb10">
|
||||
<Switch checked={switch_box_issue} onClick={switch_issue_types} />
|
||||
<span className="ml30 color-grey-3">任务<span className="color-grey-8 ml15">(组织 bug 报告、任务和里程碑)</span></span>
|
||||
</AlignCenter>
|
||||
<AlignCenter className="mb10">
|
||||
<Switch checked={switch_box_pull} onClick={switch_pull_types} />
|
||||
<span className="ml30 color-grey-3">合并请求<span className="color-grey-8 ml15">(启用合并请求和代码评审)</span></span>
|
||||
</AlignCenter>
|
||||
<AlignCenter className="mb20">
|
||||
<Switch checked={switch_box_release} onClick={switch_releas_types} />
|
||||
<span className="ml30 color-grey-3">版本发布<span className="color-grey-8 ml15">(跟踪项目版本和下载)</span></span>
|
||||
</AlignCenter>
|
||||
|
||||
<div className={(auth!=="owner" && auth !=="admin") ? "" :"hide"}>
|
||||
<p className="required">允许访问项目单元:</p>
|
||||
<AlignCenter className="mb10">
|
||||
<Switch checked={switch_box_code} onClick={switch_code_types} />
|
||||
<span className="ml30 color-grey-3">代码库<span className="color-grey-8 ml15">(查看源码、文件、提交和分支)</span></span>
|
||||
</AlignCenter>
|
||||
<AlignCenter className="mb10">
|
||||
<Switch checked={switch_box_issue} onClick={switch_issue_types} />
|
||||
<span className="ml30 color-grey-3">任务<span className="color-grey-8 ml15">(组织 bug 报告、任务和里程碑)</span></span>
|
||||
</AlignCenter>
|
||||
<AlignCenter className="mb10">
|
||||
<Switch checked={switch_box_pull} onClick={switch_pull_types} />
|
||||
<span className="ml30 color-grey-3">合并请求<span className="color-grey-8 ml15">(启用合并请求和代码评审)</span></span>
|
||||
</AlignCenter>
|
||||
<AlignCenter className="mb20">
|
||||
<Switch checked={switch_box_release} onClick={switch_releas_types} />
|
||||
<span className="ml30 color-grey-3">版本发布<span className="color-grey-8 ml15">(跟踪项目版本和下载)</span></span>
|
||||
</AlignCenter>
|
||||
<AlignCenter className="mb20">
|
||||
<Switch checked={switch_box_wiki} onClick={switch_wiki_types} />
|
||||
<span className="ml30 color-grey-3">wiki<span className="color-grey-8 ml15">(编辑此仓库的相关文档说明)</span></span>
|
||||
</AlignCenter>
|
||||
</div>
|
||||
<Button type={"primary"} onClick={saveGroupFrom}>{groupId ? "更新团队设置" : "新建团队"}</Button>
|
||||
<Cancel className="ml30" onClick={() => cancelEdit()}><span className="pl30 pr30">取消</span></Cancel>
|
||||
</Div>
|
||||
|
|
|
@ -368,5 +368,5 @@
|
|||
}
|
||||
}
|
||||
.hide{
|
||||
display: hidden;
|
||||
display: none;
|
||||
}
|
Loading…
Reference in New Issue