Browse Source

(*)适配器管理功能完善

master
peng.peng 2 years ago
parent
commit
14f0cbba4b
  1. 1
      scripts/0.0.3/data/01.insert_t_adapter.sql
  2. 13
      web/client/src/sections/metadataAcquisition/actions/adapter.js
  3. 18
      web/client/src/sections/metadataAcquisition/components/details/postgreDetail.js
  4. 35
      web/client/src/sections/metadataAcquisition/containers/adapter.js
  5. 2
      web/client/src/utils/webapi.js

1
scripts/0.0.3/data/01.insert_t_adapter.sql

@ -0,0 +1 @@
insert into t_adapter(adapter_name, adapter_version, tool_name, description, config) values ('PostgreSQL采集适配器','9.X','PostgreSQL数据库','采集数据数据库结构及相关对象','{"param":"参数名","title":"标题","value":"参数值","description":"描述"}');

13
web/client/src/sections/metadataAcquisition/actions/adapter.js

@ -29,3 +29,16 @@ export function addAdapter(params) {
});
}
export function getAdapters(query) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query: query || {},
actionType: 'GET_ACQ_ADAPTERS',
url: `${ApiTable.getAdapters}`,
msg: { error: '获取适配器列表失败' },
reducer: { name: 'adapters' }
});
}

18
web/client/src/sections/metadataAcquisition/components/details/postgreDetail.js

@ -17,10 +17,22 @@ const PostGreDetail = (props) => {
const renderManageInfo = () => {
const dataSource = [
{
param: 'url',
title: '数据库访问URL',
param: 'host',
title: '数据库访问host',
isRequired: 'true',
description: '数据库访问所需的URL',
description: '数据库访问所需的host',
},
{
param: 'port',
title: '数据库访问port',
isRequired: 'true',
description: '数据库访问所需的port',
},
{
param: 'database',
title: '数据库名称',
isRequired: 'true',
description: '数据库名称',
},
{
param: 'username',

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

@ -7,26 +7,30 @@ import AdapterStep from '../components/adapterStep';
//关系型数据库卡片配置
const RELATION_DATABASE_TOOL_CONFIG = [{
key: 'postgre', // key与详情配置(adapterDetail)中的key需一直否则无法查看详情页
name: 'PostgreSQL数据库',
version: '9.X',
desc: '采集数据数据库结构及相关对象',
title: 'PostgreSQL采集适配器'
name: 'PostgreSQL采集适配器',
}]
const LatestMetadata = (props) => {
const { history, actions, dispatch } = props;
const { history, actions, dispatch, adapters } = props;
const [isModalOpen, setIsModalOpen] = useState(false);
useEffect(() => {
dispatch(actions.metadataAcquisition.getAdapters())
}, [])
const renderRelationalDatabase = () => {
return RELATION_DATABASE_TOOL_CONFIG.map(s => <Card
title={<a onClick={() => { history.push(`/metadataAcquisition/adapter/detail/${s.key}`) }}>{s.title}</a>}
extra={<a onClick={() => { setIsModalOpen(s.key) }}><DatabaseOutlined style={{ fontSize: 18 }} /></a>}
style={{ width: '30%', lineHeight: '30px' }}
>
<p>工具名称{s.name}</p>
<p>工具版本{s.version}</p>
<p>描述{s.desc}</p>
</Card>)
return RELATION_DATABASE_TOOL_CONFIG.map(s => {
const adapterInfo = adapters?.find(x => x.adapterName == s.name)
return <Card
title={<a onClick={() => { history.push(`/metadataAcquisition/adapter/detail/${s.key}`) }}>{adapterInfo?.adapterName}</a>}
extra={<a onClick={() => { setIsModalOpen(s.key) }}><DatabaseOutlined style={{ fontSize: 18 }} /></a>}
style={{ width: '30%', lineHeight: '30px' }}
>
<p>工具名称{adapterInfo?.toolName}</p>
<p>工具版本{adapterInfo?.adapterVersion}</p>
<p>描述{adapterInfo?.description}</p>
</Card>
})
}
const items = [
@ -65,11 +69,12 @@ const LatestMetadata = (props) => {
}
function mapStateToProps(state) {
const { global, auth } = state;
const { global, auth, adapters } = state;
return {
clientHeight: global.clientHeight,
user: auth.user,
actions: global.actions,
adapters: adapters?.data || []
};
}
export default connect(mapStateToProps)(LatestMetadata)

2
web/client/src/utils/webapi.js

@ -21,7 +21,7 @@ export const ApiTable = {
//元数据采集
pgCheckConnect: 'adapter/check/connect',
addDataSource: 'meta/acq/dataSource',
getAdapters: 'meta/acq/adapters',
};
export const RouteTable = {

Loading…
Cancel
Save