Browse Source

(*)数据源刷新功能完善

master
peng.peng 2 years ago
parent
commit
a090abd355
  1. 14
      web/client/src/sections/metadataAcquisition/components/steps/postgre/stepOne.js
  2. 29
      web/client/src/sections/metadataAcquisition/containers/dataSourceManagement.js

14
web/client/src/sections/metadataAcquisition/components/steps/postgre/stepOne.js

@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react'
import { Button, Spin, Input, Row, Col } from 'antd';
import React, { useRef } from 'react'
import { Button, Spin } from 'antd';
import {
ProForm,
ProFormSelect,
@ -12,7 +12,6 @@ import { push } from 'react-router-redux';
import '../../style.less';
function StepOne(props) {
const { next, stepOneValues, stepOneValuesFinish, readOnly, treeData, dataSources, dispatch, refresh, loading, editData } = props;
const formRef = React.createRef();
const initialValues = stepOneValues ? stepOneValues : {
adapterName: 'PostgreSQL采集适配器',
adapterVersion: '9.x',
@ -42,8 +41,10 @@ function StepOne(props) {
return treeData
}
const treeDataFilter = treeData && dataSources?.rows?.length > 0 ? getTreeNodeData(treeData, null, 'rc') : []
const formRef = useRef();
return <Spin spinning={loading || treeDataFilter.length == 0}>
<ProForm
formRef={formRef}
title={''}
initialValues={initialValues}
layout="horizontal"
@ -114,6 +115,7 @@ function StepOne(props) {
// disabled={true}
/> */}
{treeDataFilter.length > 0 ? <ProFormTreeSelect
key={JSON.stringify(treeDataFilter)}
// width={'md'}
name="catalogKey"
label="数据源挂载路径"
@ -144,6 +146,9 @@ function StepOne(props) {
dispatch(push(`/metadataManagement/latestMetadata`));
}} style={{ marginRight: 8 }}>新建</a>
<a onClick={() => {
formRef?.current?.setFieldsValue({
catalogKey: null
})
refresh()
}}>刷新</a>
</>}
@ -153,6 +158,7 @@ function StepOne(props) {
options={[]}
name="catalogKey"
label="数据源挂载路径"
placeholder="请选择数据源挂载路径"
disabled={editData}
/>}
@ -169,7 +175,7 @@ function StepOne(props) {
</Button>
</div>
</ProForm>
</Spin>
</Spin >
}
export default StepOne

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

@ -146,7 +146,7 @@ function DataSourceManagement(props) {
}
}
const refresh = () => {
queryData();
// queryData();
setRefreshTree(refreshTree + 1)
}
@ -171,6 +171,7 @@ function DataSourceManagement(props) {
y: clientHeight - 260
}
}
//1490 2256
pagination={{
size: 'large',
total: dataSources?.count,
@ -180,19 +181,19 @@ function DataSourceManagement(props) {
// pageSize: pageSize || 10,
defaultPageSize: 10,
pageSizeOptions: [10, 20, 50],
showTotal: (total) => {
return <span style={{ fontSize: 15 }}>{`${Math.ceil(total / pageSize)}页,${total}`}</span>
},
onShowSizeChange: (currentPage, pageSize) => {
setCurrentPage(currentPage);
setPageSize(pageSize);
},
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);
}
// showTotal: (total) => {
// return <span style={{ fontSize: 15 }}>{`共${Math.ceil(total / pageSize)}页,${total}项`}</span>
// },
// onShowSizeChange: (currentPage, pageSize) => {
// setCurrentPage(currentPage);
// setPageSize(pageSize);
// },
// onChange: (page, pageSize) => {
// setCurrentPage(page);
// setPageSize(pageSize);
// }
}}
dataSource={dataSources?.rows || []}
options={false}

Loading…
Cancel
Save