diff --git a/web/client/src/sections/metadataManagement/actions/metadata.js b/web/client/src/sections/metadataManagement/actions/metadata.js index c2aa252..c307abf 100644 --- a/web/client/src/sections/metadataManagement/actions/metadata.js +++ b/web/client/src/sections/metadataManagement/actions/metadata.js @@ -135,4 +135,15 @@ export function delMeatadataDatabases(id) { option: '删除库表元数据', } }); +} + +export function getMetadataDatabasesById(id) { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + actionType: 'GET_METADATA_DATABASES_Info', + url: ApiTable.getMetadataDatabasesById.replace('{id}', id), + msg: { error: '获取库表元数据基本信息失败' }, + reducer: { name: 'metadataDatabasesInfo' } + }); } \ No newline at end of file diff --git a/web/client/src/sections/metadataManagement/components/metadataDatabModal.js b/web/client/src/sections/metadataManagement/components/metadataDatabModal.js index 4c26378..5f70132 100644 --- a/web/client/src/sections/metadataManagement/components/metadataDatabModal.js +++ b/web/client/src/sections/metadataManagement/components/metadataDatabModal.js @@ -4,6 +4,7 @@ const { TextArea } = Input; const MetadataDatabaseModal = (props) => { const { onConfirm, onCancel, editData, metadataModels, modelTypes } = props; const [form] = Form.useForm(); + const [type, setType] = useState(editData.record.type); useEffect(() => { }, []); const handleOk = () => { @@ -26,7 +27,7 @@ const MetadataDatabaseModal = (props) => { return Promise.resolve(); } const renderModelItems = () => { - const items = metadataModels.map(m => { + const items = metadataModels.filter(mm => mm.modelType === type).map(m => { if (m.control === '文本框') { const rules = [{ required: !m.nullable, message: '' }] if (!m.nullable) { @@ -114,6 +115,8 @@ const MetadataDatabaseModal = (props) => { getPopupContainer={triggerNode => triggerNode.parentNode} filterOption={(input, option) => option.props.children .toLowerCase().indexOf(input.toLowerCase()) >= 0} + onChange={value => setType(value)} + disabled={!editData.add} > {modelTypes.map(m => {m})} @@ -133,7 +136,7 @@ const MetadataDatabaseModal = (props) => { {renderModelItems()} - + ) } export default MetadataDatabaseModal; \ No newline at end of file diff --git a/web/client/src/sections/metadataManagement/constants/index.js b/web/client/src/sections/metadataManagement/constants/index.js index f11612e..dfcc4bf 100644 --- a/web/client/src/sections/metadataManagement/constants/index.js +++ b/web/client/src/sections/metadataManagement/constants/index.js @@ -1,3 +1,8 @@ 'use strict'; import React from 'react'; -export const ModelTypes = ['目录', '库', '视图', '表', '字段', '索引', '外键', '主键', '唯一约束']; \ No newline at end of file +export const ModelTypes = ['目录', '库', '视图', '表', '字段', '索引', '外键', '主键', '唯一约束']; +export const ConfigurableTypes = { + '目录': ['库'], + '库': ['视图', '表'], + '表': ['字段', '索引', '外键', '主键', '唯一约束'] +} diff --git a/web/client/src/sections/metadataManagement/containers/databasesTable.js b/web/client/src/sections/metadataManagement/containers/databasesTable.js index 945e714..7aacbed 100644 --- a/web/client/src/sections/metadataManagement/containers/databasesTable.js +++ b/web/client/src/sections/metadataManagement/containers/databasesTable.js @@ -36,8 +36,8 @@ const DatabaseTable = (props) => { } }) } - const onView = (id) => { - setView(id); + const onView = (record) => { + setView({ path: '/' + resourceCatalogPath.join('/'), ...record }); } const onEdit = (record) => { dispatch(metadataManagement.getMetadataModels({ modelTypes: ModelTypes })).then(res => { @@ -118,7 +118,7 @@ const DatabaseTable = (props) => { width: '8%', render: (text, record) => { return - onView(record.id)}>查看 + onView(record)}>查看 onEdit(record)}>编辑 { + + { return {`共${Math.ceil(total / limit)} 页,${total} 项`} }, + onShowSizeChange: (currentPage, pageSize) => { + setCurrentPage(currentPage); + setLimit(pageSize); + }, + onChange: (page, pageSize) => { + setCurrentPage(page); + setLimit(pageSize); + let queryParams = { + id: databasesRecord.id, + page: page - 1, + size: pageSize + }; + initTableData(queryParams); + } + }} + > +
+ { + modalVisible ? + ConfigurableTypes[databasesRecord.type].includes(m.modelType))} + editData={editData} + onCancel={() => setModalVisible(false)} + onConfirm={onConfirm} /> : '' + } + -export default MetadataDetails \ No newline at end of file + } + return
+ 基本信息, + key: 'info', children: renderBasicInfo() + }, + { + label: 组合, + key: 'detailConfig', children: renderConfigInfo() + } + ]}> + + { + + } +
+} +function mapStateToProps(state) { + const { global, auth, metadataModels } = state; + return { + user: auth.user, + actions: global.actions, + clientHeight: global.clientHeight, + isRequesting: metadataModels.isRequesting, + metadataModels: metadataModels.data, + }; +} +export default connect(mapStateToProps)(MetadataDetails) \ No newline at end of file diff --git a/web/client/src/sections/metadataManagement/containers/metadataTab.js b/web/client/src/sections/metadataManagement/containers/metadataTab.js index b27a8f6..ac324cc 100644 --- a/web/client/src/sections/metadataManagement/containers/metadataTab.js +++ b/web/client/src/sections/metadataManagement/containers/metadataTab.js @@ -4,9 +4,10 @@ import { Tabs } from 'antd'; import DatabaseTable from './databasesTable'; import FilesTable from './filesTable'; import RestapisTable from './restapisTable'; +import { push } from 'react-router-redux'; const MetadataTab = (props) => { - const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch, history } = props; + const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch } = props; const [activeKey, setActiveKey] = useState('databases'); useEffect(() => { setActiveKey('databases'); @@ -15,9 +16,9 @@ const MetadataTab = (props) => { const onTabChange = (key) => { setActiveKey(key) } - const onView = (id) => { + const onView = (record) => { sessionStorage.setItem('jumpSelectedKey', resourceCatalogKey); - history.push(`/metadataManagement/latestMetadata/detail/${id}`); + dispatch(push(`/metadataManagement/latestMetadata/detail/${record.id}`)); } return