peng.peng 2 years ago
parent
commit
8463a6b3ad
  1. 26
      web/client/src/sections/metadataManagement/components/metadataDatabModal.js
  2. 9
      web/client/src/sections/metadataManagement/containers/latestMetadata.js
  3. 1
      web/client/src/sections/metadataManagement/containers/metadataTab.js
  4. 1
      web/client/src/sections/metadataManagement/routes.js

26
web/client/src/sections/metadataManagement/components/metadataDatabModal.js

@ -19,15 +19,15 @@ const MetadataDatabaseModal = (props) => {
}
return Promise.resolve();
}
const renderModel = () => {
const renderModelItems = () => {
const items = metadataModels.map(m => {
if (m.control === '文本框') {
const rules = [{ required: m.nullable, message: '' },
{ max: m.length, message: `${m.attributeName}不超过${m.length}个字符` }]
if (m.nullable) {
const rules = [{ required: !m.nullable, message: '' }]
if (!m.nullable) {
rules.push(({ getFieldValue, validateFields }) => ({
validator(_, value) { return validatorNull(_, value, getFieldValue, validateFields, m.attributeName) }
}))
rules.push({ max: m.length, message: `${m.attributeName}不超过${m.length}个字符` })
}
return <Form.Item
label={m.attributeName}
@ -36,17 +36,25 @@ const MetadataDatabaseModal = (props) => {
<Input style={{ width: '90%' }} placeholder={`请输入${m.attributeName}`} />
</Form.Item>
} else if (m.control === '数字输入框') {
const rules = [{ required: !m.nullable, message: `${m.attributeName}不可空` }]
let maxValue = '';
if (m.length) {
while (m.length > 0) {
maxValue += '9'
m.length--;
}
}
return <Form.Item
label={m.attributeName}
name={m.attributeCode}
rules={[{ required: m.nullable, message: '' }, { max: m.length || 0 }]}>
<InputNumber style={{ width: '90%' }} placeholder={`请输入${m.attributeName}`} />
rules={rules}>
<InputNumber min={0} max={maxValue ? parseInt(maxValue) : 0} style={{ width: '90%' }} placeholder={`请输入${m.attributeName}`} />
</Form.Item>
} else {
return <Form.Item
label={m.attributeName}
name={m.attributeCode}
rules={[{ required: m.nullable, message: '' }]}>
rules={[{ required: !m.nullable, message: `${m.attributeName}不可空` }]}>
<Select
placeholder={`请选择${m.attributeName}`}
style={{ width: '90%' }}
@ -109,7 +117,7 @@ const MetadataDatabaseModal = (props) => {
name='path'
rules={[{ required: true }]}
>
<Input disabled style={{ width: '90%' }} />
<TextArea disabled rows={1} style={{ width: '90%' }} />
</Form.Item>
<Form.Item
label='详情'
@ -117,7 +125,7 @@ const MetadataDatabaseModal = (props) => {
rules={[{ max: 255, message: `描述不超过255个字符` }]}>
<TextArea rows={4} style={{ width: '90%' }} placeholder={`请输入描述`} />
</Form.Item>
{renderModel()}
{renderModelItems()}
</Form>
</Modal>
)

9
web/client/src/sections/metadataManagement/containers/latestMetadata.js

@ -29,6 +29,7 @@ const LatestMetadata = (props) => {
dispatch(metadataManagement.getResourceCatalog()).then(res => {
const { data } = res.payload;
if (res.success) {
allTreeNodeKeys = []
const resourceCatalogData = getTreeNodeData(data, null, 'rc');
setResourceCatalogData(resourceCatalogData);
if (data.length) {
@ -39,7 +40,6 @@ const LatestMetadata = (props) => {
setSelectedKeys(expandedKeysData);
setExpandedKeys(expandedKeys);
expandedKeysData = [];
allTreeNodeKeys = [];
}
} else {
setExpandedKeys([]);
@ -81,16 +81,16 @@ const LatestMetadata = (props) => {
const setTreeNodeTitle = (name) => {
let content = <span>{name}</span>
if (name.length > 10) {
if (name.length > 6) {
content = <Tooltip title={name}>
{name.substring(0, 10) + '...'}
{name.substring(0, 6) + '...'}
</Tooltip>
}
return content;
}
const renderTreeNode = (ds, dataSource) => {
return <div className={theStyle.icon}>
return <div className={theStyle.icon} style={{ width: 180 }}>
{setTreeNodeTitle(ds.name)}
<EditOutlined title='修改' style={{ marginLeft: 10 }} className={theStyle.tip} onClick={() => {
let record = JSON.parse(JSON.stringify(ds));
@ -164,7 +164,6 @@ const LatestMetadata = (props) => {
resourceCatalogKey={resourceCatalogKey}
resourceCatalogPath={resourceCatalogPath} history={history} />
}
{/* {props.children} */}
</Col>
</Row>
{

1
web/client/src/sections/metadataManagement/containers/metadataTab.js

@ -4,7 +4,6 @@ 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;

1
web/client/src/sections/metadataManagement/routes.js

@ -22,6 +22,7 @@ export default [{
{
path: '/detail/:id',
key: 'metadataDetail',
// component: MetadataDetails,
component: LatestMetadata,
breadcrumb: '元数据详情'
}

Loading…
Cancel
Save