Commit 22415b4b by zhaochengxiang

模型目录管理权限

parent bee98698
......@@ -346,6 +346,10 @@ export function* getPrivilegeAdmin() {
return yield call(datamodelerService.getPrivilegeAdmin);
}
export function* getCatalogAdmin() {
return yield call(datamodelerService.getCatalogAdmin);
}
export function* getPrivilegeBranchAdmin() {
return yield call(datamodelerService.getPrivilegeBranchAdmin);
}
......
......@@ -297,6 +297,10 @@ export function getPrivilegeAdmin() {
return Get("/datamodeler/easyDataModelerPrivilegeProvider/getAdmin");
}
export function getCatalogAdmin() {
return Get("/datamodeler/easyDataModelerPrivilegeProvider/getCatalogAdmin");
}
export function getPrivilegeBranchAdmin() {
return Get("/datamodeler/easyDataModelerPrivilegeProvider/getBranchCreation");
}
......
......@@ -62,6 +62,7 @@ const ModelTree = (props) => {
const [ dataList, setDataList ] = useState([]);
const [options, setOptions] = useState([]);
const [isAdmin, setAdmin] = useState(false);
const [isCatalogAdmin, setCatalogAdmin] = useState(false);
const [isBranchAdmin, setBranchAdmin] = useState(false);
const [loadingRoot, setLoadingRoot] = useState(false);
......@@ -74,6 +75,7 @@ const ModelTree = (props) => {
useEffect(() => {
getShowSyncAndDomains();
getPrivilegeAdmin();
getCatalogAdmin();
getPrivilegeBranchAdmin();
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
......@@ -153,6 +155,15 @@ const ModelTree = (props) => {
});
}
const getCatalogAdmin = () => {
dispatch({
type: 'datamodel.getCatalogAdmin',
callback: data => {
setCatalogAdmin(data==='true'?true:false);
}
});
}
const getPrivilegeBranchAdmin = () => {
dispatch({
type: 'datamodel.getPrivilegeBranchAdmin',
......@@ -650,7 +661,7 @@ const ModelTree = (props) => {
</Dropdown>
{
((viewSelectedKey==='dir'&&isAdmin) || (viewSelectedKey==='branch'&&(isAdmin||isBranchAdmin))) && (
((viewSelectedKey==='dir'&&(isAdmin||isCatalogAdmin)) || (viewSelectedKey==='branch'&&(isAdmin||isBranchAdmin))) && (
<Tooltip title={(viewSelectedKey==='dir')?"新增目录":'新增项目'}>
<PlusOutlined className='default' onClick={add} style={{ fontSize:16,cursor:'pointer' }} />
</Tooltip>
......@@ -669,7 +680,7 @@ const ModelTree = (props) => {
</Tooltip>
{
(viewSelectedKey==='dir' && isAdmin) && !isSetRootId && (
(viewSelectedKey==='dir'&&(isAdmin||isCatalogAdmin)) && !isSetRootId && (
<Dropdown overlay={syncMenu} placement="bottomLeft">
<Tooltip title="同步目录">
<SyncOutlined className='default' style={{ fontSize:16,cursor:'pointer' }} />
......@@ -679,7 +690,7 @@ const ModelTree = (props) => {
}
{
(viewSelectedKey==='dir' && isAdmin) && isSetRootId && (
(viewSelectedKey==='dir'&&(isAdmin||isCatalogAdmin)) && isSetRootId && (
<Tooltip title="同步目录" className='ml-2'>
<SyncOutlined className='default' style={{ fontSize:16,cursor:'pointer' }} onClick={sync} />
</Tooltip>
......@@ -687,7 +698,7 @@ const ModelTree = (props) => {
}
{
(viewSelectedKey==='dir' && !isAdmin) && <React.Fragment>
(viewSelectedKey==='dir'&&!isAdmin&&!isCatalogAdmin) && <React.Fragment>
<div style={{ width: 16 }}></div>
<div style={{ width: 16 }}></div>
</React.Fragment>
......@@ -739,7 +750,7 @@ const ModelTree = (props) => {
return <span title={nodeData?.remark||''}>{nodeData?.name||''}</span>;
}}
onRightClick={({event, node}) => {
if ((viewSelectedKey==='dir'&&isAdmin) || (viewSelectedKey === 'branch'&&(node?.deletable||node?.editable))) {
if ((viewSelectedKey==='dir'&&(isAdmin||isCatalogAdmin)) || (viewSelectedKey === 'branch'&&(node?.deletable||node?.editable))) {
setCurrentRightClickDir(node);
displayMenu(event);
}
......
......@@ -50,10 +50,10 @@ const FC = (props) => {
export default FC
const Basic = ({ item }) => {
const [totalCount, setTotalCount] = React.useState()
const [deployWaitingCount, setDeployWaitingCount] = React.useState()
const [deployedCount, setDeployedCount] = React.useState()
const [offlineCount, setOfflineCount] = React.useState()
const [totalCount, setTotalCount] = React.useState('')
const [deployWaitingCount, setDeployWaitingCount] = React.useState('')
const [deployedCount, setDeployedCount] = React.useState('')
const [offlineCount, setOfflineCount] = React.useState('')
const [modelListParams, setModelListParams] = React.useState({
visible: false,
type: undefined,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment