|
@@ -34,36 +34,36 @@ import sagas from './sagas'
|
|
|
|
|
|
import { checkNameUniqueAction } from 'containers/App/actions'
|
|
|
import { ViewActions, ViewActionType } from './actions'
|
|
|
-import { makeSelectViews, makeSelectLoading } from './selectors'
|
|
|
+import { makeSelectLoading, makeSelectViews } from './selectors'
|
|
|
import { makeSelectCurrentProject } from 'containers/Projects/selectors'
|
|
|
|
|
|
import ModulePermission from '../Account/components/checkModulePermission'
|
|
|
import { initializePermission } from '../Account/components/checkUtilPermission'
|
|
|
|
|
|
import {
|
|
|
- Table,
|
|
|
- Tooltip,
|
|
|
+ Breadcrumb,
|
|
|
Button,
|
|
|
- Row,
|
|
|
Col,
|
|
|
- Breadcrumb,
|
|
|
+ Dropdown,
|
|
|
Icon,
|
|
|
- Popconfirm,
|
|
|
+ Menu,
|
|
|
message,
|
|
|
- Tree,
|
|
|
- Popover,
|
|
|
- Dropdown,
|
|
|
- Menu, Modal, Spin
|
|
|
+ Popconfirm,
|
|
|
+ Row,
|
|
|
+ Spin,
|
|
|
+ Table,
|
|
|
+ Tooltip,
|
|
|
+ Tree
|
|
|
} from 'antd'
|
|
|
import { ColumnProps, PaginationConfig, SorterResult } from 'antd/lib/table'
|
|
|
import { ButtonProps } from 'antd/lib/button'
|
|
|
-import Container, { ContainerTitle, ContainerBody } from 'components/Container'
|
|
|
+import Container, { ContainerBody, ContainerTitle } from 'components/Container'
|
|
|
import Box from 'components/Box'
|
|
|
import SearchFilterDropdown from 'components/SearchFilterDropdown'
|
|
|
import CopyModal from './components/CopyModal'
|
|
|
import CatalogueModal from './components/CatalogueModal'
|
|
|
|
|
|
-import { IViewBase, IView, IViewLoading, ICatalogue } from './types'
|
|
|
+import { ICatalogue, IViewBase, IViewLoading } from './types'
|
|
|
import { IProject } from '../Projects/types'
|
|
|
|
|
|
import utilStyles from 'assets/less/util.less'
|
|
@@ -85,7 +85,9 @@ interface IViewListDispatchProps {
|
|
|
onCheckName: (data, resolve, reject) => void
|
|
|
}
|
|
|
|
|
|
-type IViewListProps = IViewListStateProps & IViewListDispatchProps & RouteComponentWithParams
|
|
|
+type IViewListProps = IViewListStateProps &
|
|
|
+ IViewListDispatchProps &
|
|
|
+ RouteComponentWithParams
|
|
|
|
|
|
// tslint:disable-next-line:interface-name
|
|
|
interface Catalogue {
|
|
@@ -125,8 +127,11 @@ interface IViewListStates {
|
|
|
|
|
|
const { TreeNode, DirectoryTree } = Tree
|
|
|
|
|
|
-export class ViewList extends React.PureComponent<IViewListProps, IViewListStates> {
|
|
|
-
|
|
|
+export class ViewList extends React.PureComponent<
|
|
|
+ IViewListProps,
|
|
|
+ IViewListStates
|
|
|
+> {
|
|
|
+ // @ts-ignore
|
|
|
public state: Readonly<IViewListStates> = {
|
|
|
screenWidth: document.documentElement.clientWidth,
|
|
|
tempFilterViewName: '',
|
|
@@ -159,14 +164,21 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
window.addEventListener('resize', this.setScreenWidth, false)
|
|
|
}
|
|
|
|
|
|
- private loadViews = async() => {
|
|
|
+ private loadViews = async () => {
|
|
|
const { projectId } = this.props.match.params
|
|
|
if (projectId && this.state.selectedCatalogueKeys.length > 0) {
|
|
|
const parentId = Number(this.state.selectedCatalogueKeys[0])
|
|
|
try {
|
|
|
this.setState({ tableLoading: true })
|
|
|
- const data = await request(api.getViewsByParentId + `?projectId=${projectId}&parentId=${parentId}`, { method: 'get' })
|
|
|
- this.setState({ viewList: data.payload as unknown as IViewBase[] ?? [] })
|
|
|
+ const data = await request(
|
|
|
+ api.getViewsByParentId +
|
|
|
+ `?projectId=${projectId}&parentId=${parentId}`,
|
|
|
+ { method: 'get' }
|
|
|
+ )
|
|
|
+ // @ts-ignore
|
|
|
+ this.setState({
|
|
|
+ viewList: (data.payload as unknown as IViewBase[]) ?? []
|
|
|
+ })
|
|
|
} catch (e) {
|
|
|
console.log(e)
|
|
|
} finally {
|
|
@@ -183,14 +195,17 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
this.setState({ screenWidth: document.documentElement.clientWidth })
|
|
|
}
|
|
|
|
|
|
- private getFilterViews = memoizeOne((viewName: string, views: IViewBase[]) => {
|
|
|
- if (!Array.isArray(views) || !views.length) {
|
|
|
- return []
|
|
|
+ private getFilterViews = memoizeOne(
|
|
|
+ (viewName: string, views: IViewBase[]) => {
|
|
|
+ if (!Array.isArray(views) || !views.length) {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ const regex = new RegExp(viewName, 'gi')
|
|
|
+ return views.filter(
|
|
|
+ (v) => v.name.match(regex) || v.description.match(regex)
|
|
|
+ )
|
|
|
}
|
|
|
- const regex = new RegExp(viewName, 'gi')
|
|
|
- const filterViews = views.filter((v) => v.name.match(regex) || v.description.match(regex))
|
|
|
- return filterViews
|
|
|
- })
|
|
|
+ )
|
|
|
|
|
|
private static getViewPermission = memoizeOne((project: IProject) => ({
|
|
|
viewPermission: initializePermission(project, 'viewPermission'),
|
|
@@ -198,49 +213,67 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
EditButton: ModulePermission<ButtonProps>(project, 'view', false)(Button)
|
|
|
}))
|
|
|
|
|
|
- private getTableColumns = (
|
|
|
- { viewPermission, AdminButton, EditButton }: ReturnType<typeof ViewList.getViewPermission>
|
|
|
- ) => {
|
|
|
+ private getTableColumns = ({
|
|
|
+ viewPermission,
|
|
|
+ AdminButton,
|
|
|
+ EditButton
|
|
|
+ }: ReturnType<typeof ViewList.getViewPermission>) => {
|
|
|
// const { views } = this.props
|
|
|
const { viewList } = this.state
|
|
|
- const { tempFilterViewName, filterViewName, filterDropdownVisible, tableSorter } = this.state
|
|
|
+ const {
|
|
|
+ tempFilterViewName,
|
|
|
+ filterViewName,
|
|
|
+ filterDropdownVisible,
|
|
|
+ tableSorter
|
|
|
+ } = this.state
|
|
|
const sourceNames = viewList.map(({ sourceName }) => sourceName)
|
|
|
|
|
|
- const columns: Array<ColumnProps<IViewBase>> = [{
|
|
|
- title: '名称',
|
|
|
- dataIndex: 'name',
|
|
|
- filterDropdown: (
|
|
|
- <SearchFilterDropdown
|
|
|
- placeholder='名称'
|
|
|
- value={tempFilterViewName}
|
|
|
- onChange={this.filterViewNameChange}
|
|
|
- onSearch={this.searchView}
|
|
|
- />
|
|
|
- ),
|
|
|
- filterDropdownVisible,
|
|
|
- onFilterDropdownVisibleChange: (visible: boolean) => this.setState({ filterDropdownVisible: visible }),
|
|
|
- sorter: (a, b) => (a.name > b.name ? 1 : -1),
|
|
|
- sortOrder: tableSorter && tableSorter.columnKey === 'name' ? tableSorter.order : void 0
|
|
|
- }, {
|
|
|
- title: '描述',
|
|
|
- dataIndex: 'description'
|
|
|
- }, {
|
|
|
- title: '数据源',
|
|
|
- // title: 'Source',
|
|
|
- dataIndex: 'sourceName',
|
|
|
- filterMultiple: false,
|
|
|
- onFilter: (val, record) => record.sourceName === val,
|
|
|
- filters: sourceNames
|
|
|
- .filter((name, idx) => sourceNames.indexOf(name) === idx)
|
|
|
- .map((name) => ({ text: name, value: name }))
|
|
|
- }]
|
|
|
+ const columns: Array<ColumnProps<IViewBase>> = [
|
|
|
+ {
|
|
|
+ title: '名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ filterDropdown: (
|
|
|
+ <SearchFilterDropdown
|
|
|
+ placeholder="名称"
|
|
|
+ value={tempFilterViewName}
|
|
|
+ onChange={this.filterViewNameChange}
|
|
|
+ onSearch={this.searchView}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ filterDropdownVisible,
|
|
|
+ onFilterDropdownVisibleChange: (visible: boolean) =>
|
|
|
+ this.setState({ filterDropdownVisible: visible }),
|
|
|
+ sorter: (a, b) => (a.name > b.name ? 1 : -1),
|
|
|
+ sortOrder:
|
|
|
+ tableSorter && tableSorter.columnKey === 'name'
|
|
|
+ ? tableSorter.order
|
|
|
+ : void 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '描述',
|
|
|
+ dataIndex: 'description'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '数据源',
|
|
|
+ // title: 'Source',
|
|
|
+ dataIndex: 'sourceName',
|
|
|
+ filterMultiple: false,
|
|
|
+ onFilter: (val, record) => record.sourceName === val,
|
|
|
+ filters: sourceNames
|
|
|
+ .filter((name, idx) => sourceNames.indexOf(name) === idx)
|
|
|
+ .map((name) => ({ text: name, value: name }))
|
|
|
+ }
|
|
|
+ ]
|
|
|
|
|
|
if (filterViewName) {
|
|
|
const regex = new RegExp(`(${filterViewName})`, 'gi')
|
|
|
columns[0].render = (text: string) => (
|
|
|
<span
|
|
|
dangerouslySetInnerHTML={{
|
|
|
- __html: text.replace(regex, `<span class='${utilStyles.highlight}'>$1</span>`)
|
|
|
+ __html: text.replace(
|
|
|
+ regex,
|
|
|
+ `<span class='${utilStyles.highlight}'>$1</span>`
|
|
|
+ )
|
|
|
}}
|
|
|
/>
|
|
|
)
|
|
@@ -252,20 +285,30 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
width: 150,
|
|
|
className: utilStyles.textAlignCenter,
|
|
|
render: (_, record) => (
|
|
|
- <span className='ant-table-action-column'>
|
|
|
- <Tooltip title='复制'>
|
|
|
- <EditButton icon='copy' shape='circle' type='ghost' onClick={this.copyView(record)} />
|
|
|
+ <span className="ant-table-action-column">
|
|
|
+ <Tooltip title="复制">
|
|
|
+ <EditButton
|
|
|
+ icon="copy"
|
|
|
+ shape="circle"
|
|
|
+ type="ghost"
|
|
|
+ onClick={this.copyView(record)}
|
|
|
+ />
|
|
|
</Tooltip>
|
|
|
- <Tooltip title='修改'>
|
|
|
- <EditButton icon='edit' shape='circle' type='ghost' onClick={this.editView(record.id)} />
|
|
|
+ <Tooltip title="修改">
|
|
|
+ <EditButton
|
|
|
+ icon="edit"
|
|
|
+ shape="circle"
|
|
|
+ type="ghost"
|
|
|
+ onClick={this.editView(record.id)}
|
|
|
+ />
|
|
|
</Tooltip>
|
|
|
<Popconfirm
|
|
|
- title='确定删除?'
|
|
|
- placement='bottom'
|
|
|
+ title="确定删除?"
|
|
|
+ placement="bottom"
|
|
|
onConfirm={this.deleteView(record.id)}
|
|
|
>
|
|
|
- <Tooltip title='删除'>
|
|
|
- <AdminButton icon='delete' shape='circle' type='ghost' />
|
|
|
+ <Tooltip title="删除">
|
|
|
+ <AdminButton icon="delete" shape="circle" type="ghost" />
|
|
|
</Tooltip>
|
|
|
</Popconfirm>
|
|
|
</span>
|
|
@@ -302,7 +345,11 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
|
|
|
private addView = () => {
|
|
|
const { history, match } = this.props
|
|
|
- history.push(`/project/${match.params.projectId}/view`)
|
|
|
+ history.push(
|
|
|
+ `/project/${
|
|
|
+ match.params.projectId
|
|
|
+ }/view?parentId=${this.state.selectedCatalogueKeys?.join()}`
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
private copyView = (fromView: IViewBase) => () => {
|
|
@@ -338,20 +385,31 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- private checkViewUniqueName = (viewName: string, resolve: () => void, reject: (err: string) => void) => {
|
|
|
+ private checkViewUniqueName = (
|
|
|
+ viewName: string,
|
|
|
+ resolve: () => void,
|
|
|
+ reject: (err: string) => void
|
|
|
+ ) => {
|
|
|
const { currentProject, onCheckName } = this.props
|
|
|
- onCheckName({ name: viewName, projectId: currentProject.id }, resolve, reject)
|
|
|
+ onCheckName(
|
|
|
+ { name: viewName, projectId: currentProject.id },
|
|
|
+ resolve,
|
|
|
+ reject
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
- private getCatalogues = async() => {
|
|
|
+ private getCatalogues = async () => {
|
|
|
try {
|
|
|
const { projectId } = this.props.match.params
|
|
|
|
|
|
this.setState({ treeLoading: true })
|
|
|
// @ts-ignore
|
|
|
- const { payload } = await request(api.getCatalogues + `?projectId=${projectId}`, { method: 'GET' })
|
|
|
+ const { payload } = await request(
|
|
|
+ api.getCatalogues + `?projectId=${projectId}`,
|
|
|
+ { method: 'GET' }
|
|
|
+ )
|
|
|
this.setState({
|
|
|
- catalogues: (payload as unknown as ICatalogue[]),
|
|
|
+ catalogues: payload as unknown as ICatalogue[],
|
|
|
selectedCatalogueKeys: payload?.[0]?.id ? [`${payload?.[0]?.id}`] : []
|
|
|
})
|
|
|
} catch (e) {
|
|
@@ -361,7 +419,7 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private handleSaveCatalogue = async(catalogue: ICatalogue) => {
|
|
|
+ private handleSaveCatalogue = async (catalogue: ICatalogue) => {
|
|
|
const { projectId } = this.props.match.params
|
|
|
if (!projectId) {
|
|
|
return
|
|
@@ -372,11 +430,19 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
this.setState({ saveCatalogueLoading: true })
|
|
|
// const api = this.state.catalogueFromView ? api.updateCatalogue : api.createCatalogue
|
|
|
if (catalogueFromView) {
|
|
|
- await request(api.updateCatalogue + `/${catalogueFromView.id}`, { method: 'PUT' })
|
|
|
+ await request(api.updateCatalogue + `/${catalogueFromView.id}`, {
|
|
|
+ method: 'PUT'
|
|
|
+ })
|
|
|
} else {
|
|
|
- await request(api.createCatalogue, { method: 'post', data: { ...catalogue, parentId, projectId } })
|
|
|
+ await request(api.createCatalogue, {
|
|
|
+ method: 'post',
|
|
|
+ data: { ...catalogue, parentId, projectId }
|
|
|
+ })
|
|
|
}
|
|
|
- this.setState({ saveCatalogueLoading: true, catalogueModalVisible: false })
|
|
|
+ this.setState({
|
|
|
+ saveCatalogueLoading: true,
|
|
|
+ catalogueModalVisible: false
|
|
|
+ })
|
|
|
this.getCatalogues()
|
|
|
} finally {
|
|
|
this.setState({
|
|
@@ -385,129 +451,153 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+ private handleEditCatalogue = (c: ICatalogue) => {
|
|
|
+ this.setState({
|
|
|
+ catalogueModalVisible: true,
|
|
|
+ catalogueFromView: c
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ private handleDeleteCatalogue = async (c: ICatalogue) => {
|
|
|
+ try {
|
|
|
+ this.setState({ treeLoading: true })
|
|
|
+ const data = await request(api.deleteCatalogue + `/${c.id}`, {
|
|
|
+ method: 'DELETE'
|
|
|
+ })
|
|
|
+ // @ts-ignore
|
|
|
+ if (data?.header?.code === 200) {
|
|
|
+ message.error({ content: '删除成功' })
|
|
|
+ this.getCatalogues()
|
|
|
+ } else {
|
|
|
+ // @ts-ignore
|
|
|
+ // tslint:disable-next-line:no-unused-expression
|
|
|
+ data?.header?.msg && message.error({ content: data?.header?.msg })
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ this.setState({ treeLoading: false })
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
private renderTree = (catalogues: ICatalogue[]) => {
|
|
|
const { selectedCatalogueKeys } = this.state
|
|
|
// tslint:disable-next-line:jsx-wrap-multiline
|
|
|
- return <>
|
|
|
- {
|
|
|
- catalogues.map((c, idx) => (
|
|
|
- <>
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ {catalogues.map((c, idx) => (
|
|
|
+ <React.Fragment key={c.id ?? idx}>
|
|
|
<div
|
|
|
key={c.id ?? idx}
|
|
|
className={classnames(styles.treeNode, {
|
|
|
- [styles.treeNodeSelected]: selectedCatalogueKeys.includes(`${c.id}`),
|
|
|
+ [styles.treeNodeSelected]: selectedCatalogueKeys.includes(
|
|
|
+ `${c.id}`
|
|
|
+ ),
|
|
|
[styles.treeNodeChild]: !!c.parentId
|
|
|
})}
|
|
|
>
|
|
|
- <span
|
|
|
- className={styles.treeNodeLeft}
|
|
|
- onClick={() => {
|
|
|
- this.setState({ selectedCatalogueKeys: [`${c.id}`] }, () => {
|
|
|
- console.log(this.state.selectedCatalogueKeys, '~~~')
|
|
|
- this.loadViews()
|
|
|
- })
|
|
|
- }}
|
|
|
- >
|
|
|
- <Icon type='folder-open' />
|
|
|
- {c.name}</span>
|
|
|
- <span>
|
|
|
- <Dropdown
|
|
|
- overlay={() => (
|
|
|
- <Menu>
|
|
|
- <Menu.Item
|
|
|
- key='0'
|
|
|
- onClick={() => {
|
|
|
- this.setState({
|
|
|
- catalogueModalVisible: true,
|
|
|
- catalogueFromView: c
|
|
|
- })
|
|
|
- }}
|
|
|
- >编辑</Menu.Item>
|
|
|
- <Menu.Item
|
|
|
- key='1'
|
|
|
- onClick={() => {
|
|
|
- Modal.confirm({
|
|
|
- title: '确认删除吗?',
|
|
|
- onOk: async() => {
|
|
|
- try {
|
|
|
- const data = await request(api.deleteCatalogue + `/${c.id}`, { method: 'DELETE' })
|
|
|
- console.log(data)
|
|
|
-
|
|
|
- if (data?.header?.code === 200) {
|
|
|
- this.getCatalogues()
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }}
|
|
|
- >
|
|
|
- 删除
|
|
|
- </Menu.Item>
|
|
|
- </Menu>
|
|
|
- )}
|
|
|
- trigger={['click']}
|
|
|
- >
|
|
|
- <Icon type='more' />
|
|
|
- </Dropdown>
|
|
|
- </span>
|
|
|
+ <span
|
|
|
+ className={styles.treeNodeLeft}
|
|
|
+ onClick={() => {
|
|
|
+ this.setState({ selectedCatalogueKeys: [`${c.id}`] }, () => {
|
|
|
+ this.loadViews()
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Icon type="folder-open" />
|
|
|
+ {c.name}
|
|
|
+ </span>
|
|
|
+ <Dropdown
|
|
|
+ overlay={() => (
|
|
|
+ <Menu>
|
|
|
+ <Menu.Item
|
|
|
+ key="0"
|
|
|
+ onClick={() => this.handleEditCatalogue(c)}
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </Menu.Item>
|
|
|
+ <Menu.Item key="1">
|
|
|
+ <Popconfirm
|
|
|
+ title="确定删除?"
|
|
|
+ placement="bottom"
|
|
|
+ onConfirm={() => this.handleDeleteCatalogue(c)}
|
|
|
+ >
|
|
|
+ <a> 删除</a>
|
|
|
+ </Popconfirm>
|
|
|
+ </Menu.Item>
|
|
|
+ </Menu>
|
|
|
+ )}
|
|
|
+ trigger={['click']}
|
|
|
+ >
|
|
|
+ <Icon type="more" />
|
|
|
+ </Dropdown>
|
|
|
</div>
|
|
|
<div style={{ marginLeft: 20 }}>
|
|
|
{c.children && this.renderTree(c.children)}
|
|
|
</div>
|
|
|
- </>
|
|
|
- ))
|
|
|
- }
|
|
|
- </>
|
|
|
+ </React.Fragment>
|
|
|
+ ))}
|
|
|
+ </>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
public render() {
|
|
|
const { currentProject, views, loading } = this.props
|
|
|
const { screenWidth, filterViewName, viewList } = this.state
|
|
|
- const { viewPermission, AdminButton, EditButton } = ViewList.getViewPermission(currentProject)
|
|
|
- const tableColumns = this.getTableColumns({ viewPermission, AdminButton, EditButton })
|
|
|
+ const { viewPermission, AdminButton, EditButton } =
|
|
|
+ ViewList.getViewPermission(currentProject)
|
|
|
+ const tableColumns = this.getTableColumns({
|
|
|
+ viewPermission,
|
|
|
+ AdminButton,
|
|
|
+ EditButton
|
|
|
+ })
|
|
|
const tablePagination: PaginationConfig = {
|
|
|
...this.basePagination,
|
|
|
simple: screenWidth <= 768
|
|
|
}
|
|
|
const filterViews = this.getFilterViews(filterViewName, viewList)
|
|
|
|
|
|
- const { copyModalVisible, copyFromView, catalogueModalVisible, catalogueFromView } = this.state
|
|
|
+ const {
|
|
|
+ copyModalVisible,
|
|
|
+ copyFromView,
|
|
|
+ catalogueModalVisible,
|
|
|
+ catalogueFromView
|
|
|
+ } = this.state
|
|
|
|
|
|
const pathname = this.props.history.location.pathname
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
<Container>
|
|
|
- <Helmet title='数据资产' />
|
|
|
- {
|
|
|
- !pathname.includes('dataManager') && <ContainerTitle>
|
|
|
+ <Helmet title="数据资产" />
|
|
|
+ {!pathname.includes('dataManager') && (
|
|
|
+ <ContainerTitle>
|
|
|
<Row>
|
|
|
<Col span={24} className={utilStyles.shortcut}>
|
|
|
<Breadcrumb className={utilStyles.breadcrumb}>
|
|
|
<Breadcrumb.Item>
|
|
|
- <Link to=''>View</Link>
|
|
|
+ <Link to="">View</Link>
|
|
|
</Breadcrumb.Item>
|
|
|
</Breadcrumb>
|
|
|
<Link to={`/account/organization/${currentProject.orgId}`}>
|
|
|
- <i className='iconfont icon-organization' />
|
|
|
+ <i className="iconfont icon-organization" />
|
|
|
</Link>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
</ContainerTitle>
|
|
|
- }
|
|
|
+ )}
|
|
|
<ContainerBody>
|
|
|
<Box>
|
|
|
<Box.Header>
|
|
|
<Box.Title>
|
|
|
- <Icon type='bars' />
|
|
|
+ <Icon type="bars" />
|
|
|
数据资产列表
|
|
|
</Box.Title>
|
|
|
<Box.Tools>
|
|
|
- <Tooltip placement='bottom' title='新增'>
|
|
|
- <AdminButton type='primary' icon='plus' onClick={this.addView} />
|
|
|
+ <Tooltip placement="bottom" title="新增">
|
|
|
+ <AdminButton
|
|
|
+ type="primary"
|
|
|
+ icon="plus"
|
|
|
+ onClick={this.addView}
|
|
|
+ />
|
|
|
</Tooltip>
|
|
|
</Box.Tools>
|
|
|
</Box.Header>
|
|
@@ -518,13 +608,11 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
<h6>资源目录列表</h6>
|
|
|
<div
|
|
|
className={styles.treePlusNode}
|
|
|
- onClick={
|
|
|
- () => {
|
|
|
- this.setState({ catalogueModalVisible: true })
|
|
|
- }
|
|
|
- }
|
|
|
+ onClick={() => {
|
|
|
+ this.setState({ catalogueModalVisible: true })
|
|
|
+ }}
|
|
|
>
|
|
|
- <Icon type='plus' />
|
|
|
+ <Icon type="plus" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className={styles.treeContent}>
|
|
@@ -536,7 +624,7 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
<Table
|
|
|
style={{ flex: 1 }}
|
|
|
bordered
|
|
|
- rowKey='id'
|
|
|
+ rowKey="id"
|
|
|
loading={this.state.tableLoading}
|
|
|
dataSource={filterViews}
|
|
|
columns={tableColumns}
|
|
@@ -544,6 +632,7 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
onChange={this.tableChange}
|
|
|
/>
|
|
|
</div>
|
|
|
+ <div style={{ padding: 20 }} />
|
|
|
</Box.Body>
|
|
|
</Box>
|
|
|
</ContainerBody>
|
|
@@ -567,14 +656,17 @@ export class ViewList extends React.PureComponent<IViewListProps, IViewListState
|
|
|
</>
|
|
|
)
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
const mapDispatchToProps = (dispatch: Dispatch<ViewActionType>) => ({
|
|
|
- onLoadViews: (projectId, parentId) => dispatch(ViewActions.loadViews(projectId, parentId)),
|
|
|
- onDeleteView: (viewId, resolve) => dispatch(ViewActions.deleteView(viewId, resolve)),
|
|
|
+ onLoadViews: (projectId, parentId) =>
|
|
|
+ dispatch(ViewActions.loadViews(projectId, parentId)),
|
|
|
+ onDeleteView: (viewId, resolve) =>
|
|
|
+ dispatch(ViewActions.deleteView(viewId, resolve)),
|
|
|
onCopyView: (view, resolve) => dispatch(ViewActions.copyView(view, resolve)),
|
|
|
- onCheckName: (data, resolve, reject) => dispatch(checkNameUniqueAction('view', data, resolve, reject))
|
|
|
+ // @ts-ignore
|
|
|
+ onCheckName: (data, resolve, reject) =>
|
|
|
+ dispatch(checkNameUniqueAction('view', data, resolve, reject))
|
|
|
})
|
|
|
|
|
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -583,12 +675,12 @@ const mapStateToProps = createStructuredSelector({
|
|
|
loading: makeSelectLoading()
|
|
|
})
|
|
|
|
|
|
-const withConnect = connect<IViewListStateProps, IViewListDispatchProps, RouteComponentWithParams>(mapStateToProps, mapDispatchToProps)
|
|
|
+const withConnect = connect<
|
|
|
+ IViewListStateProps,
|
|
|
+ IViewListDispatchProps,
|
|
|
+ RouteComponentWithParams
|
|
|
+>(mapStateToProps, mapDispatchToProps)
|
|
|
const withReducer = injectReducer({ key: 'view', reducer })
|
|
|
const withSaga = injectSaga({ key: 'view', saga: sagas })
|
|
|
|
|
|
-export default compose(
|
|
|
- withReducer,
|
|
|
- withSaga,
|
|
|
- withConnect
|
|
|
-)(ViewList)
|
|
|
+export default compose(withReducer, withSaga, withConnect)(ViewList)
|