diff --git a/web/client/src/sections/metadataManagement/containers/databasesTable.js b/web/client/src/sections/metadataManagement/containers/databasesTable.js index beac381..db40d2e 100644 --- a/web/client/src/sections/metadataManagement/containers/databasesTable.js +++ b/web/client/src/sections/metadataManagement/containers/databasesTable.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; -import { Spin, Table, Popconfirm, Button, Input } from 'antd'; +import { Spin, Table, Popconfirm, Button, Input, Row, Col } from 'antd'; import { ButtonGroup } from '$components'; import moment from 'moment'; import FileSaver from 'file-saver'; @@ -173,13 +173,18 @@ const DatabaseTable = (props) => { ra.applyBy == user.id && ra.resourceName === record.name); return onView(record)}>查看 - onEdit(record)}>编辑 - confirmDelete(record.id)} - > 删除 - {record.type === '表' ? marking(record.id)}>打标 : null} - {user.role == '系统管理员' ? '' : record.type === '表' ? resourceApplicationsRecords.length === 0 ? + {user.role == '数据消费者' ? null : + <> + onEdit(record)}>编辑 + confirmDelete(record.id)} + > 删除 + {record.type === '表' ? marking(record.id)}>打标 : null} + > + } + + {user.role !== '数据消费者' ? null : record.type === '表' ? resourceApplicationsRecords.length === 0 ? applyResources(record)}>申请资源 : 申请资源 : null} @@ -252,27 +257,33 @@ const DatabaseTable = (props) => { } } return - - { - dispatch(metadataManagement.getMetadataModels({ modelTypes: ModelTypes.join(',') })).then(res => { - if (res.success) { - setEditData({ add: true, title: '新建库表元数据', record: { path: '/' + resourceCatalogPath.join('/'), type: '目录' } }); - setModalVisible(true); + + + {user.role == '数据消费者' ? null : <> + { + dispatch(metadataManagement.getMetadataModels({ modelTypes: ModelTypes.join(',') })).then(res => { + if (res.success) { + setEditData({ add: true, title: '新建库表元数据', record: { path: '/' + resourceCatalogPath.join('/'), type: '目录' } }); + setModalVisible(true); + } + }) + }}>新建 + { + tableDataCount == 0 ? handleExport()}>导出 : + selectedRowKeys && selectedRowKeys.length ? + handleExport()}>导出 + : handleExport(true)} okText="确定" cancelText="取消"> + 导出 + } - }) - }}>新建 - { - tableDataCount == 0 ? handleExport()}>导出 : - selectedRowKeys && selectedRowKeys.length ? - handleExport()}>导出 - : handleExport(true)} okText="确定" cancelText="取消"> - 导出 - - } - 查询 - setKeywords(e.target.value || '')} /> - + >} + + + setKeywords(e.target.value || '')} /> + 查询 + + { let resourceApplicationsRecords = metadataResourceApplications.filter(ra => ra.applyBy == user.id && ra.resourceName === record.name); return - onEdit(record)}>编辑 - confirmDelete(record)} - > 删除 - marking(record.id)}>打标 + {user.role == '数据消费者' ? null : + <> + onEdit(record)}>编辑 + confirmDelete(record)} + >删除 + marking(record.id)}>打标 + > + } + {user.role == '系统管理员' ? '' : resourceApplicationsRecords.length === 0 ? applyResources(record)}>申请资源 : 申请资源} @@ -298,27 +303,34 @@ const FilesTable = (props) => { } } return - - { - dispatch(metadataManagement.getMetadataModels({ modelTypes: '文件' })).then(res => { - if (res.success) { - setEditData({ add: true, title: '新建文件元数据', record: {} }); - setModalVisible(true); - } - }) - }}>新建 - { - tableDataCount == 0 ? handleExport()}>导出 : - selectedRowKeys && selectedRowKeys.length ? - handleExport()}>导出 - : handleExport(true)} okText="确定" cancelText="取消"> - 导出 - - } - 查询 - setKeywords(e.target.value || '')} /> - + + + {user.role == '数据消费者' ? null : <> + { + dispatch(metadataManagement.getMetadataModels({ modelTypes: '文件' })).then(res => { + if (res.success) { + setEditData({ add: true, title: '新建文件元数据', record: {} }); + setModalVisible(true); + } + }) + }}>新建 + { + tableDataCount == 0 ? handleExport()}>导出 : + selectedRowKeys && selectedRowKeys.length ? + handleExport()}>导出 + : handleExport(true)} okText="确定" cancelText="取消"> + 导出 + + }>} + + + setKeywords(e.target.value || '')} /> + 查询 + + + + { - { + {user?.role == '系统管理员' && { setEditData({ title: '新建资源目录', add: true }); setModalVisible(true); - }}>新建资源目录 + }}>新建资源目录} { let resourceApplicationsRecords = metadataResourceApplications.filter(ra => ra.applyBy == user.id && ra.resourceName === record.name); return - onEdit(record)}>编辑 - confirmDelete(record.id)} - > 删除 - marking(record.id)}>打标 + {user.role == '数据消费者' ? null : + <> + onEdit(record)}>编辑 + confirmDelete(record.id)} + > 删除 + marking(record.id)}>打标 + > + } + {user.role == '系统管理员' ? '' : resourceApplicationsRecords.length === 0 ? applyResources(record)}>申请资源 : 申请资源} @@ -180,19 +185,24 @@ const RestapisTable = (props) => { } } return - - { - dispatch(metadataManagement.getMetadataModels({ modelTypes: '接口' })).then(res => { - if (res.success) { - setEditData({ add: true, title: '新建接口元数据', record: {} }); - setModalVisible(true); - } - }) - }}>新建 - 查询 - setKeywords(e.target.value || '')} /> - + + + {user.role == '数据消费者' ? null : <> { + dispatch(metadataManagement.getMetadataModels({ modelTypes: '接口' })).then(res => { + if (res.success) { + setEditData({ add: true, title: '新建接口元数据', record: {} }); + setModalVisible(true); + } + }) + }}>新建>} + + + setKeywords(e.target.value || '')} /> + 查询 + + +