Browse Source

(*)元数据检索功能完善

master
peng.peng 1 year ago
parent
commit
19c381245e
  1. 2
      api/app/lib/controllers/backups/index.js
  2. 9
      web/client/src/sections/backups/containers/backupTask.js
  3. 4
      web/client/src/sections/backups/nav-item.js
  4. 2
      web/client/src/sections/backups/routes.js
  5. 4
      web/client/src/sections/memberManagement/nav-item.js
  6. 8
      web/client/src/sections/resourceRetrieval/containers/retrieval.js

2
api/app/lib/controllers/backups/index.js

@ -8,7 +8,7 @@ function getBackupsList(opts) {
let errMsg = { message: '获取数据备份失败' }
try {
let searchWhere = {
}
let option = {
where: searchWhere,

9
web/client/src/sections/backups/containers/backupTask.js

@ -10,7 +10,8 @@ function Member(props) {
const { loading, clientHeight, actions, dispatch, backups, user, dataSources } = props;
const [pageSize, setPageSize] = useState(10);
const [currentPage, setCurrentPage] = useState(1);
const [searchValue, setSearchValue] = useState('')
const [searchValue, setSearchValue] = useState('');
const [addLoading, setAddLoading] = useState(false)
const queryData = (search) => {
const query = {
limit: search ? 10 : pageSize || 10,
@ -59,8 +60,6 @@ function Member(props) {
valueType: 'option',
render: (text, record) => {
const options = [];
options.push(
<Popconfirm
key="del"
@ -102,9 +101,11 @@ function Member(props) {
};
const onFinish = async (values, editData) => {
setAddLoading(true)
return dispatch(actions.backups.addBackups({
...values,
})).then(res => {
setAddLoading(false)
if (res.success) {
queryData();
return true;
@ -114,7 +115,7 @@ function Member(props) {
});
};
return <Spin spinning={loading}>
return <Spin spinning={loading || addLoading}>
<Row className='protable-title'>
<Col span={12}>
<BackupsModal

4
web/client/src/sections/backups/nav-item.js

@ -1,13 +1,13 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Menu } from 'antd';
import { BarChartOutlined } from '@ant-design/icons';
import { ControlOutlined } from '@ant-design/icons';
const SubMenu = Menu.SubMenu;
export function getNavItem(user) {
return (
user?.role == '系统管理员' && <SubMenu key="数据备份恢复" icon={<BarChartOutlined />} title='数据备份恢复'>
user?.role == '系统管理员' && <SubMenu key="数据备份恢复" icon={<ControlOutlined />} title='数据备份恢复'>
<Menu.Item key="backups">
<Link to="/backups/restore">备份恢复</Link>
</Menu.Item>

2
web/client/src/sections/backups/routes.js

@ -5,7 +5,7 @@ export default [{
route: {
path: '/backups',
key: 'backups',
breadcrumb: '用户管理',
breadcrumb: '数据备份恢复',
// 不设置 component 则面包屑禁止跳转
childRoutes: [{
path: '/restore',

4
web/client/src/sections/memberManagement/nav-item.js

@ -1,13 +1,13 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Menu } from 'antd';
import { BarChartOutlined } from '@ant-design/icons';
import { UserOutlined } from '@ant-design/icons';
const SubMenu = Menu.SubMenu;
export function getNavItem(user) {
return (
user?.role == '系统管理员' && <SubMenu key="memberManagement" icon={<BarChartOutlined />} title='用户管理'>
user?.role == '系统管理员' && <SubMenu key="memberManagement" icon={<UserOutlined />} title='用户管理'>
<Menu.Item key="auth">
<Link to="/memberManagement/auth">用户权限</Link>
</Menu.Item>

8
web/client/src/sections/resourceRetrieval/containers/retrieval.js

@ -181,7 +181,11 @@ function Retrieval(props) {
</div> :
<>
<Input.Search defaultValue={keywords} style={{ width: '30%', marginLeft: 10, marginBottom: 30 }}
onSearch={value => { setKeywords(value) }}
onSearch={value => {
setPage(1)
setKeywords(value)
}}
/>
{result?.rows?.slice((page - 1) * 10, (page - 1) * 10 + 10).map(s => {
const catalogText = renderCatalog(s?.catalog).split('/').reverse().toString().replaceAll(',', '/')
@ -212,9 +216,11 @@ function Retrieval(props) {
</div>
})}
{result?.rows?.length > 0 && <Pagination
key={keywords}
defaultCurrent={1} total={result?.rows?.length}
style={{ float: 'right', paddingRight: '5%' }}
showTotal={total => `${total} 条数据`}
showSizeChanger={false}
onChange={(page, pageSize) => {
setPage(page)
}}

Loading…
Cancel
Save