Commit 22415b4b by zhaochengxiang

模型目录管理权限

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