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

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

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

Loading…
Cancel
Save