Browse Source

(*) 业务元数据管理权限调整

master
liujiangyong 1 year ago
parent
commit
22624f127a
  1. 5
      web/client/src/sections/metadataManagement/components/businessDatabaseModal.js
  2. 11
      web/client/src/sections/metadataManagement/containers/businessDatabaseTable.js
  3. 11
      web/client/src/sections/metadataManagement/containers/businessFilesTable.js
  4. 11
      web/client/src/sections/metadataManagement/containers/businessMetadata.js
  5. 11
      web/client/src/sections/metadataManagement/containers/businessRestapisTable.js
  6. 8
      web/client/src/sections/metadataManagement/containers/businessTab.js

5
web/client/src/sections/metadataManagement/components/businessDatabaseModal.js

@ -6,7 +6,7 @@ const basicInfo = [{ name: '元数据名称:', key: 'name' },
{ name: '上下文路径:', key: 'path' }, { name: '上下文路径:', key: 'path' },
{ name: '元数据详情:', key: 'description' }]; { name: '元数据详情:', key: 'description' }];
const BusinessDatabaseModal = (props) => { const BusinessDatabaseModal = (props) => {
const { onConfirm, onCancel, editData, metadataModels, resourceCatalogPath, businessType } = props; const { onConfirm, onCancel, editData, metadataModels, resourceCatalogPath, businessType, isAdmin } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
useEffect(() => { useEffect(() => {
}, []); }, []);
@ -66,6 +66,7 @@ const BusinessDatabaseModal = (props) => {
return ( return (
<Modal title={editData.title} open={true} destroyOnClose <Modal title={editData.title} open={true} destroyOnClose
okText='确定' width={800} okText='确定' width={800}
footer={!isAdmin ? null : undefined}
onOk={() => handleOk(null)} onOk={() => handleOk(null)}
onCancel={onCancel}> onCancel={onCancel}>
{editData.record && editData.record.businessMetadata.length ? {editData.record && editData.record.businessMetadata.length ?
@ -87,7 +88,7 @@ const BusinessDatabaseModal = (props) => {
({ getFieldValue, validateFields }) => ({ ({ getFieldValue, validateFields }) => ({
validator(_, value) { return validatorNull(_, value, getFieldValue, validateFields, item.name) } validator(_, value) { return validatorNull(_, value, getFieldValue, validateFields, item.name) }
})]}> })]}>
<Input style={{ width: '90%' }} placeholder={`请输入${item.name}`} /> <Input style={{ width: '90%' }} placeholder={`请输入${item.name}`} disabled={!isAdmin} />
</Form.Item> </Form.Item>
)} )}
</Form> </Form>

11
web/client/src/sections/metadataManagement/containers/businessDatabaseTable.js

@ -6,7 +6,7 @@ import FileSaver from 'file-saver';
import BusinessDatabaseModal from '../components/businessDatabaseModal'; import BusinessDatabaseModal from '../components/businessDatabaseModal';
const BusinessDatabaseTable = (props) => { const BusinessDatabaseTable = (props) => {
const { user, dispatch, actions, clientHeight, resourceCatalogId, const { user, dispatch, actions, clientHeight, resourceCatalogId,
resourceCatalogPath, isRequesting, metadataModels } = props; resourceCatalogPath, isRequesting, metadataModels, isAdmin } = props;
const { metadataManagement } = actions; const { metadataManagement } = actions;
const SortValues = { 'ascend': 'asc', 'descend': 'desc' }; const SortValues = { 'ascend': 'asc', 'descend': 'desc' };
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
@ -201,13 +201,13 @@ const BusinessDatabaseTable = (props) => {
if (record.businessMetadataDatabases.length) { if (record.businessMetadataDatabases.length) {
return <div> return <div>
<a style={{ marginLeft: 10 }} onClick={() => onAdd(record, false)}>查看</a> <a style={{ marginLeft: 10 }} onClick={() => onAdd(record, false)}>查看</a>
<Popconfirm {isAdmin && <Popconfirm
title="是否确认删除该业务元数据?" title="是否确认删除该业务元数据?"
onConfirm={() => confirmDelete(record.businessMetadataDatabases[0].id)} onConfirm={() => confirmDelete(record.businessMetadataDatabases[0].id)}
> <a style={{ marginLeft: 10 }}>删除</a></Popconfirm> > <a style={{ marginLeft: 10 }}>删除</a></Popconfirm>}
</div> </div>
} else } else
return <a style={{ marginLeft: 10 }} onClick={() => onAdd(record, true)}>新建</a> return isAdmin && <a style={{ marginLeft: 10 }} onClick={() => onAdd(record, true)}>新建</a>
} }
}]; }];
@ -329,7 +329,8 @@ const BusinessDatabaseTable = (props) => {
editData={editData} editData={editData}
onCancel={() => setModalVisible(false)} onCancel={() => setModalVisible(false)}
onConfirm={onConfirm} onConfirm={onConfirm}
resourceCatalogPath={resourceCatalogPath} /> : '' resourceCatalogPath={resourceCatalogPath}
isAdmin={isAdmin} /> : ''
} }
</Spin > </Spin >
} }

11
web/client/src/sections/metadataManagement/containers/businessFilesTable.js

@ -6,7 +6,7 @@ import FileSaver from 'file-saver';
import BusinessDatabaseModal from '../components/businessDatabaseModal'; import BusinessDatabaseModal from '../components/businessDatabaseModal';
const BusinessFilesTable = (props) => { const BusinessFilesTable = (props) => {
const { user, dispatch, actions, clientHeight, resourceCatalogId, const { user, dispatch, actions, clientHeight, resourceCatalogId,
resourceCatalogPath, isRequesting, metadataModels } = props; resourceCatalogPath, isRequesting, metadataModels, isAdmin } = props;
const { metadataManagement } = actions; const { metadataManagement } = actions;
const SortValues = { 'ascend': 'asc', 'descend': 'desc' }; const SortValues = { 'ascend': 'asc', 'descend': 'desc' };
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
@ -190,13 +190,13 @@ const BusinessFilesTable = (props) => {
if (record.businessMetadataFiles.length) { if (record.businessMetadataFiles.length) {
return <div> return <div>
<a style={{ marginLeft: 10 }} onClick={() => onAdd(record, false)}>查看</a> <a style={{ marginLeft: 10 }} onClick={() => onAdd(record, false)}>查看</a>
<Popconfirm {isAdmin && <Popconfirm
title="是否确认删除该业务元数据?" title="是否确认删除该业务元数据?"
onConfirm={() => confirmDelete(record.businessMetadataFiles[0].id)} onConfirm={() => confirmDelete(record.businessMetadataFiles[0].id)}
> <a style={{ marginLeft: 10 }}>删除</a></Popconfirm> > <a style={{ marginLeft: 10 }}>删除</a></Popconfirm>}
</div> </div>
} else } else
return <a style={{ marginLeft: 10 }} onClick={() => onAdd(record, true)}>新建</a> return isAdmin && <a style={{ marginLeft: 10 }} onClick={() => onAdd(record, true)}>新建</a>
} }
}]; }];
@ -317,7 +317,8 @@ const BusinessFilesTable = (props) => {
onCancel={() => setModalVisible(false)} onCancel={() => setModalVisible(false)}
onConfirm={onConfirm} onConfirm={onConfirm}
resourceCatalogPath={resourceCatalogPath} resourceCatalogPath={resourceCatalogPath}
businessType='文件' /> : '' businessType='文件'
isAdmin={isAdmin} /> : ''
} }
</Spin > </Spin >
} }

11
web/client/src/sections/metadataManagement/containers/businessMetadata.js

@ -4,10 +4,12 @@ import { Spin, Row, Col, Tree, Tooltip, Input } from 'antd';
import BusinessTab from './businessTab'; import BusinessTab from './businessTab';
let expandedKeysData = []; let expandedKeysData = [];
let allTreeNodeKeys = []; let allTreeNodeKeys = [];
let resourceCatalogRawData = [];
const BusinessMetadata = (props) => { const BusinessMetadata = (props) => {
const { user, dispatch, actions, clientHeight, isRequesting, resourceCatalog } = props; const { user, dispatch, actions, clientHeight, isRequesting, resourceCatalog } = props;
const { metadataManagement } = actions; const { metadataManagement } = actions;
const [isAdmin, setIsAdmin] = useState(false);
const [resourceCatalogData, setResourceCatalogData] = useState([]); const [resourceCatalogData, setResourceCatalogData] = useState([]);
const [selectedKeys, setSelectedKeys] = useState([]); const [selectedKeys, setSelectedKeys] = useState([]);
const [expandedKeys, setExpandedKeys] = useState([]); const [expandedKeys, setExpandedKeys] = useState([]);
@ -23,6 +25,7 @@ const BusinessMetadata = (props) => {
dispatch(metadataManagement.getResourceCatalog()).then(res => { dispatch(metadataManagement.getResourceCatalog()).then(res => {
const { data } = res.payload; const { data } = res.payload;
if (res.success) { if (res.success) {
resourceCatalogRawData = data;
allTreeNodeKeys = [] allTreeNodeKeys = []
const resourceCatalogData = getTreeNodeData(data, null, 'rc', [], null); const resourceCatalogData = getTreeNodeData(data, null, 'rc', [], null);
setResourceCatalogData(resourceCatalogData); setResourceCatalogData(resourceCatalogData);
@ -44,7 +47,10 @@ const BusinessMetadata = (props) => {
const keyArr = selectedData[0].split('-'); const keyArr = selectedData[0].split('-');
keyArr.shift();//['rc-2-5']->返回'rc';keyArr:['2','5'] keyArr.shift();//['rc-2-5']->返回'rc';keyArr:['2','5']
const allExpandedKeys = allTreeNodeKeys.filter(k => keyArr.includes(k.id.toString())); const allExpandedKeys = allTreeNodeKeys.filter(k => keyArr.includes(k.id.toString()));
setResourceCatalogId(keyArr.pop()); const resourceCatalogId = keyArr.pop();
setResourceCatalogId(resourceCatalogId);
setIsAdmin(user?.username === 'SuperAdmin'
|| (user?.role === '系统管理员' && user?.orgId == resourceCatalogRawData.find(a => a.id == resourceCatalogId)?.orgId));
setResourceCatalogKey(selectedData[0]); setResourceCatalogKey(selectedData[0]);
const resourceCatalogPath = allExpandedKeys.map(a => a.name); const resourceCatalogPath = allExpandedKeys.map(a => a.name);
setResourceCatalogPath(resourceCatalogPath); setResourceCatalogPath(resourceCatalogPath);
@ -161,7 +167,8 @@ const BusinessMetadata = (props) => {
<Col style={{ width: 'calc(100% - 240px)' }}> <Col style={{ width: 'calc(100% - 240px)' }}>
<BusinessTab resourceCatalogId={resourceCatalogId} <BusinessTab resourceCatalogId={resourceCatalogId}
resourceCatalogKey={resourceCatalogKey} resourceCatalogKey={resourceCatalogKey}
resourceCatalogPath={resourceCatalogPath} /> resourceCatalogPath={resourceCatalogPath}
isAdmin={isAdmin} />
</Col> </Col>
</Row> </Row>
</Spin> </Spin>

11
web/client/src/sections/metadataManagement/containers/businessRestapisTable.js

@ -6,7 +6,7 @@ import FileSaver from 'file-saver';
import BusinessDatabaseModal from '../components/businessDatabaseModal'; import BusinessDatabaseModal from '../components/businessDatabaseModal';
const BusinessFilesTable = (props) => { const BusinessFilesTable = (props) => {
const { user, dispatch, actions, clientHeight, resourceCatalogId, const { user, dispatch, actions, clientHeight, resourceCatalogId,
resourceCatalogPath, isRequesting, metadataModels } = props; resourceCatalogPath, isRequesting, metadataModels, isAdmin } = props;
const { metadataManagement } = actions; const { metadataManagement } = actions;
const SortValues = { 'ascend': 'asc', 'descend': 'desc' }; const SortValues = { 'ascend': 'asc', 'descend': 'desc' };
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
@ -190,13 +190,13 @@ const BusinessFilesTable = (props) => {
if (record.businessMetadataRestapis.length) { if (record.businessMetadataRestapis.length) {
return <div> return <div>
<a style={{ marginLeft: 10 }} onClick={() => onAdd(record, false)}>查看</a> <a style={{ marginLeft: 10 }} onClick={() => onAdd(record, false)}>查看</a>
<Popconfirm {isAdmin && <Popconfirm
title="是否确认删除该业务元数据?" title="是否确认删除该业务元数据?"
onConfirm={() => confirmDelete(record.businessMetadataRestapis[0].id)} onConfirm={() => confirmDelete(record.businessMetadataRestapis[0].id)}
> <a style={{ marginLeft: 10 }}>删除</a></Popconfirm> > <a style={{ marginLeft: 10 }}>删除</a></Popconfirm>}
</div> </div>
} else } else
return <a style={{ marginLeft: 10 }} onClick={() => onAdd(record, true)}>新建</a> return isAdmin && <a style={{ marginLeft: 10 }} onClick={() => onAdd(record, true)}>新建</a>
} }
}]; }];
@ -317,7 +317,8 @@ const BusinessFilesTable = (props) => {
onCancel={() => setModalVisible(false)} onCancel={() => setModalVisible(false)}
onConfirm={onConfirm} onConfirm={onConfirm}
resourceCatalogPath={resourceCatalogPath} resourceCatalogPath={resourceCatalogPath}
businessType='接口' /> : '' businessType='接口'
isAdmin={isAdmin} /> : ''
} }
</Spin > </Spin >
} }

8
web/client/src/sections/metadataManagement/containers/businessTab.js

@ -6,7 +6,7 @@ import BusinessFilesTable from './businessFilesTable';
import BusinessRestapisTable from './businessRestapisTable'; import BusinessRestapisTable from './businessRestapisTable';
const BusinessTab = (props) => { const BusinessTab = (props) => {
const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch } = props; const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch, isAdmin } = props;
const [activeKey, setActiveKey] = useState('databases'); const [activeKey, setActiveKey] = useState('databases');
useEffect(() => { useEffect(() => {
setActiveKey('databases'); setActiveKey('databases');
@ -36,11 +36,11 @@ const BusinessTab = (props) => {
</Tabs> </Tabs>
{ {
activeKey === 'databases' && resourceCatalogId ? <BusinessDatabaseTable resourceCatalogId={resourceCatalogId} activeKey === 'databases' && resourceCatalogId ? <BusinessDatabaseTable resourceCatalogId={resourceCatalogId}
resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} /> : resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> :
activeKey === 'files' && resourceCatalogId ? <BusinessFilesTable resourceCatalogId={resourceCatalogId} activeKey === 'files' && resourceCatalogId ? <BusinessFilesTable resourceCatalogId={resourceCatalogId}
resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} /> : resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> :
activeKey === 'restapis' && resourceCatalogId ? <BusinessRestapisTable resourceCatalogId={resourceCatalogId} activeKey === 'restapis' && resourceCatalogId ? <BusinessRestapisTable resourceCatalogId={resourceCatalogId}
resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} /> : resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> :
null null
} }
</div> </div>

Loading…
Cancel
Save