You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.4 KiB
55 lines
2.4 KiB
import React, { useEffect, useState } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { Tabs } from 'antd';
|
|
import BusinessDatabaseTable from './businessDatabaseTable';
|
|
import BusinessFilesTable from './businessFilesTable';
|
|
import BusinessRestapisTable from './businessRestapisTable';
|
|
|
|
const BusinessTab = (props) => {
|
|
const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch, isAdmin } = props;
|
|
const [activeKey, setActiveKey] = useState('databases');
|
|
useEffect(() => {
|
|
setActiveKey('databases');
|
|
}, [resourceCatalogId]);
|
|
|
|
const onTabChange = (key) => {
|
|
setActiveKey(key)
|
|
}
|
|
return <div>
|
|
<Tabs defaultActiveKey="databases"
|
|
onChange={onTabChange}
|
|
activeKey={activeKey}
|
|
items={[
|
|
{
|
|
label: <span> 表 </span>,
|
|
key: 'databases'
|
|
},
|
|
{
|
|
label: <span> 文件 </span>,
|
|
key: 'files'
|
|
},
|
|
{
|
|
label: <span> 接口 </span>,
|
|
key: 'restapis'
|
|
}
|
|
]}>
|
|
</Tabs>
|
|
{
|
|
activeKey === 'databases' && resourceCatalogId ? <BusinessDatabaseTable resourceCatalogId={resourceCatalogId}
|
|
resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> :
|
|
activeKey === 'files' && resourceCatalogId ? <BusinessFilesTable resourceCatalogId={resourceCatalogId}
|
|
resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> :
|
|
activeKey === 'restapis' && resourceCatalogId ? <BusinessRestapisTable resourceCatalogId={resourceCatalogId}
|
|
resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> :
|
|
null
|
|
}
|
|
</div>
|
|
}
|
|
function mapStateToProps(state) {
|
|
const { global, auth } = state;
|
|
return {
|
|
user: auth.user,
|
|
actions: global.actions
|
|
};
|
|
}
|
|
export default connect(mapStateToProps)(BusinessTab)
|