Browse Source

数据源管理列表展示完善 适配器增加采集模式字段 数据源增加修改时间字段

master
peng.peng 2 years ago
parent
commit
6052633cbf
  1. 11
      api/app/lib/models/adapter.js
  2. 9
      api/app/lib/models/data_source.js
  3. 2
      scripts/0.0.3/schema/01_alter_t_data_source.sql
  4. 2
      scripts/0.0.3/schema/02_alter_t_adapter.sql
  5. 25
      web/client/src/sections/metadataAcquisition/containers/adapter.js
  6. 16
      web/client/src/sections/metadataAcquisition/containers/dataSourceManagement.js
  7. 5
      web/client/src/sections/metadataAcquisition/containers/style.less

11
api/app/lib/models/adapter.js

@ -60,7 +60,16 @@ module.exports = dc => {
primaryKey: false,
field: "config",
autoIncrement: false
}
},
mode: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "采集模式",
primaryKey: false,
field: "mode",
autoIncrement: false
},
}, {
tableName: "t_adapter",
comment: "",

9
api/app/lib/models/data_source.js

@ -77,6 +77,15 @@ module.exports = dc => {
primaryKey: false,
field: "config",
autoIncrement: false
},
time: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: "修改时间",
primaryKey: false,
field: "time",
autoIncrement: false
}
}, {
tableName: "t_data_source",

2
scripts/0.0.3/schema/01_alter_t_data_source.sql

@ -0,0 +1,2 @@
alter table t_data_source
add time timestamp(6) with time zone;

2
scripts/0.0.3/schema/02_alter_t_adapter.sql

@ -0,0 +1,2 @@
alter table t_adapter
add mode varchar(255);

25
web/client/src/sections/metadataAcquisition/containers/adapter.js

@ -3,7 +3,7 @@ import { connect } from 'react-redux';
import { Tabs, Card, Modal } from 'antd'
import { DatabaseOutlined } from '@ant-design/icons'
import AdapterStep from '../components/adapterStep';
import moment from 'moment';
//关系型数据库卡片配置
const RELATION_DATABASE_TOOL_CONFIG = [{
key: 'postgre', // key与详情配置(adapterDetail)中的key需一直否则无法查看详情页
@ -39,14 +39,21 @@ const LatestMetadata = (props) => {
const onFinish = (values) => {
const { stepOneValues, stepTwoValues } = values;
dispatch(actions.metadataAcquisition.addDataSource({
name: stepOneValues?.name,
audited: true,
adapter: 1,
mountPath: 1,
description: stepOneValues?.description,
config: stepTwoValues
}))
const adapterName = RELATION_DATABASE_TOOL_CONFIG?.find(x => x.key == isModalOpen)?.name;
const adapterInfo = adapters?.find(x => x.adapterName == adapterName)
if (adapterInfo) {
dispatch(actions.metadataAcquisition.addDataSource({
name: stepOneValues?.name,
audited: true,
adapter: adapterInfo?.id,
mountPath: 1,
description: stepOneValues?.description,
config: stepTwoValues,
time: moment()
})).then(res => {
setIsModalOpen(false)
})
}
}
return <>

16
web/client/src/sections/metadataAcquisition/containers/dataSourceManagement.js

@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react'
import { Spin, Popconfirm, Tree, Row, Col, Button, Input, Table } from 'antd';
import { connect } from 'react-redux';
import ProTable from '@ant-design/pro-table';
const TreeNode = Tree.TreeNode;
import moment from 'moment';
import './style.less';
function DataSourceManagement(props) {
const { loading, clientHeight, actions, dispatch, dataSources, adapters } = props;
const [pageSize, setPageSize] = useState(10);
@ -52,7 +52,7 @@ function DataSourceManagement(props) {
dataIndex: 'control',
render: (text, record) => {
const adapterInfo = adapters?.find(s => s.id == record?.adapter)
return adapterInfo?.toolName
return adapterInfo?.mode
}
},
{
@ -65,11 +65,14 @@ function DataSourceManagement(props) {
},
{
title: '修改时间',
dataIndex: 'nullable',
dataIndex: 'time',
render: (text, record) => moment(record?.time).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '描述',
dataIndex: 'description',
ellipsis: true,
search: false,
},
{
title: '操作',
@ -96,14 +99,15 @@ function DataSourceManagement(props) {
},
},
];
return <Spin spinning={loading}>
<Row style={{ marginBottom: 16 }}>
<Row className='protable-title'>
<Col span={12}><Button type='primary'>新建</Button></Col>
<Col span={12} style={{ textAlign: 'right' }}><Input
value={searchValue} onChange={e => { setSearchValue(e.target.value) }}
style={{ width: 220, marginRight: 15 }} placeholder="数据源名称" /><Button onClick={() => { queryData() }} type='primary'>查询</Button></Col>
</Row>
<Table
<ProTable
columns={columns}
dateFormatter="string"
search={false}

5
web/client/src/sections/metadataAcquisition/containers/style.less

@ -0,0 +1,5 @@
.protable-title {
margin-bottom: 16px;
padding-left: 24px;
padding-right: 24px;
}
Loading…
Cancel
Save