Jelajahi Sumber

feat: new components for menus

hi-cactus! 3 tahun lalu
induk
melakukan
d6f78948dd

+ 0 - 161
app/containers/Viz/DataManagerDisplay/Editor.tsx

@@ -1,161 +0,0 @@
-/*
- * <<
- * Davinci
- * ==
- * Copyright (C) 2016 - 2017 EDP
- * ==
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * >>
- */
-
-import React, { useEffect, useCallback, useState } from 'react'
-import Helmet from 'react-helmet'
-import { useDispatch, useSelector } from 'react-redux'
-
-import { makeSelectCurrentProject } from 'containers/Projects/selectors'
-import {
-  makeSelectCurrentDisplay,
-  makeSelectCurrentSlides,
-  makeSelectCurrentSlide
-} from '../selectors'
-
-import { VizActions } from '../actions'
-
-import { Route } from 'react-router-dom'
-import { RouteComponentWithParams } from 'utils/types'
-
-import { Layout, PageHeader } from 'antd'
-import SplitPane from 'components/SplitPane'
-import SlideThumbnailList from '../components/SlideThumbnail'
-import DisplayHeader from 'containers/Display/Editor/Header'
-import { Display } from 'containers/Display/Loadable'
-import { ISlideFormed } from 'containers/Viz/components/types'
-
-import styles from '../Viz.less'
-
-const VizDisplayEditor: React.FC<RouteComponentWithParams> = (props) => {
-  const dispatch = useDispatch()
-  const { id: projectId } = useSelector(makeSelectCurrentProject())
-  const currentDisplay = useSelector(makeSelectCurrentDisplay())
-  const displayId = currentDisplay.id
-  const { id: slideId } = useSelector(makeSelectCurrentSlide())
-  const currentSlides = useSelector(makeSelectCurrentSlides())
-  const { history } = props
-
-  const [selectedSlideIds, setSelectedSlideIds] = useState([])
-
-  const clearSelectedSlide = useCallback(() => {
-    setSelectedSlideIds([])
-  }, [])
-
-  useEffect(() => {
-    window.addEventListener('click', clearSelectedSlide, false)
-    return () => {
-      window.removeEventListener('click', clearSelectedSlide, false)
-    }
-  }, [])
-
-  const goToViz = useCallback(() => {
-    history.replace(`/project/${projectId}/vizs`)
-  }, [projectId])
-
-  const selectSlide = useCallback(
-    (slideId: number, append: boolean) => {
-      if (append) {
-        setSelectedSlideIds(
-          selectedSlideIds.includes(slideId)
-            ? selectedSlideIds.filter((id) => id !== slideId)
-            : selectedSlideIds.concat(slideId)
-        )
-      } else {
-        setSelectedSlideIds([slideId])
-        history.replace(
-          `/project/${projectId}/display/${displayId}/slide/${slideId}`
-        )
-      }
-    },
-    [projectId, displayId, selectedSlideIds]
-  )
-
-  const changeDisplayAvatar = useCallback(
-    (avatar: string) => {
-      dispatch(
-        VizActions.editDisplay({
-          ...currentDisplay,
-          avatar
-        })
-      )
-    },
-    [currentDisplay]
-  )
-
-  const editSlides = useCallback((newSlides: ISlideFormed[]) => {
-    dispatch(VizActions.editSlides(newSlides))
-  }, [])
-
-  const deleteSlides = useCallback(
-    (targetSlideId?: number) => {
-      if (!targetSlideId || selectedSlideIds.includes(targetSlideId)) {
-        dispatch(VizActions.deleteSlides(displayId, selectedSlideIds))
-        return
-      }
-      if (targetSlideId) {
-        dispatch(VizActions.deleteSlides(displayId, [targetSlideId]))
-      }
-    },
-    [displayId, selectedSlideIds]
-  )
-
-  return (
-    <>
-      <Helmet title={`${currentDisplay.name} - Display`} />
-      <Layout>
-        <PageHeader
-          ghost={false}
-          title={currentDisplay.name}
-          subTitle={currentDisplay.description}
-          avatar={{
-            src: currentDisplay.avatar,
-            shape: 'square'
-          }}
-          extra={<DisplayHeader />}
-          onBack={goToViz}
-        />
-        <SplitPane
-          className="ant-layout-content"
-          type="horizontal"
-          initialSize={120}
-          minSize={120}
-          maxSize={200}
-        >
-          <SlideThumbnailList
-            className={styles.slides}
-            currentSlideId={slideId}
-            selectedSlideIds={selectedSlideIds}
-            slides={currentSlides}
-            onChange={editSlides}
-            onSelect={selectSlide}
-            onDelete={deleteSlides}
-            onChangeDisplayAvatar={changeDisplayAvatar}
-          />
-          <Route
-            path="/project/:projectId/display/:displayId/slide/:slideId"
-            component={Display}
-          />
-        </SplitPane>
-      </Layout>
-    </>
-  )
-}
-
-export default VizDisplayEditor

+ 0 - 7
app/containers/Viz/DataManagerDisplay/Loadable.tsx

@@ -1,7 +0,0 @@
-import React from 'react'
-import loadable from 'utils/loadable'
-import { Skeleton } from 'antd'
-
-export const VizDisplayEditor = loadable(() => import('./Editor'), {
-  fallback: <Skeleton active={true} paragraph={{ rows: 15 }} />
-})

+ 0 - 71
app/containers/Viz/DataManagerDisplay/index.tsx

@@ -1,71 +0,0 @@
-/*
- * <<
- * Davinci
- * ==
- * Copyright (C) 2016 - 2017 EDP
- * ==
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * >>
- */
-
-import React, { useEffect } from 'react'
-import Helmet from 'react-helmet'
-import { useDispatch, useSelector } from 'react-redux'
-
-import {
-  makeSelectCurrentDisplay,
-  makeSelectCurrentSlide
-} from '../selectors'
-
-import { hideNavigator } from 'containers/App/actions'
-import { VizActions } from '../actions'
-
-import { Route, matchPath } from 'react-router-dom'
-import { RouteComponentWithParams, IRouteParams } from 'utils/types'
-
-import { Display } from 'containers/Display/Loadable'
-import { VizDisplayEditor } from './Loadable'
-
-const VizDisplay: React.FC<RouteComponentWithParams> = (props) => {
-  const dispatch = useDispatch()
-  const currentDisplay = useSelector(makeSelectCurrentDisplay())
-  const currentSlide = useSelector(makeSelectCurrentSlide())
-  const {
-    history,
-    match: { params }
-  } = props
-  const displayId = +params.displayId
-  const { pathname } = history.location
-
-  useEffect(() => {
-    dispatch(hideNavigator())
-  }, [])
-
-  useEffect(() => {
-    dispatch(VizActions.loadDisplaySlides(displayId))
-  }, [displayId])
-
-  if (!currentDisplay || !currentSlide) {
-    return null
-  }
-
-  return (
-    <>
-      <Helmet title={`${currentDisplay.name} - Display`} />
-      <Route exact path="/project/:projectId/display/:displayId/preview/slide/:slideId" component={Display} />
-      <Route exact path="/project/:projectId/display/:displayId/slide/:slideId" component={VizDisplayEditor} />
-    </>
-  )
-}
-
-export default VizDisplay

+ 0 - 201
app/containers/Viz/DataManagerPortal.tsx

@@ -1,201 +0,0 @@
-/*
- * <<
- * Davinci
- * ==
- * Copyright (C) 2016 - 2017 EDP
- * ==
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * >>
- */
-
-import React, { useEffect, useCallback, useState } from 'react'
-import { createStructuredSelector } from 'reselect'
-import { useDispatch, useSelector } from 'react-redux'
-import {
-  makeSelectDownloadList
-} from 'containers/App/selectors'
-import {
-  makeSelectPortals,
-  makeSelectCurrentPortal,
-  makeSelectCurrentDashboards
-} from './selectors'
-
-import {
-  hideNavigator,
-  loadDownloadList,
-  downloadFile
-} from 'containers/App/actions'
-import { VizActions } from './actions'
-
-import { Route } from 'react-router-dom'
-import { RouteComponentWithParams } from 'utils/types'
-
-import {
-  Layout,
-  Result,
-  PageHeader,
-  Tree,
-  Icon,
-  Button,
-  Menu,
-  Dropdown
-} from 'antd'
-const { Header, Sider, Content } = Layout
-const { DirectoryTree } = Tree
-import SplitPane from 'components/SplitPane'
-import DownloadList from 'components/DownloadList'
-import useDashboardConfigMenu from './hooks/dashboardConfigMenu'
-import { Grid } from 'containers/Dashboard/Loadable'
-import useDashboardTreeNodes from './hooks/dashboardTreeNodes'
-import { AntTreeNodeMouseEvent } from 'antd/lib/tree'
-
-const mapStateToProps = createStructuredSelector({
-  downloadList: makeSelectDownloadList(),
-  portals: makeSelectPortals(),
-  currentPortal: makeSelectCurrentPortal(),
-  currentDashboards: makeSelectCurrentDashboards()
-})
-
-// tslint:disable-next-line:no-empty-interface
-interface IVizPortalProps extends RouteComponentWithParams {}
-
-const DataManagerPortal: React.FC<IVizPortalProps> = (props) => {
-  const dispatch = useDispatch()
-  const {
-    portals,
-    currentPortal,
-    currentDashboards,
-    downloadList
-  } = useSelector(mapStateToProps)
-  const {
-    history,
-    match: { params }
-  } = props
-  const portalId = +params.portalId
-  const projectId = +params.projectId
-
-  useEffect(() => {
-    dispatch(hideNavigator())
-    if (!portals.length) {
-      dispatch(VizActions.loadPortals(projectId))
-    }
-  }, [])
-
-  useEffect(() => {
-    dispatch(VizActions.loadPortalDashboards(portalId))
-  }, [portalId])
-
-  const goToViz = useCallback(() => {
-    history.replace(`/project/${projectId}/dataManager/vizs`)
-  }, [])
-
-  const onLoadDownloadList = useCallback(() => dispatch(loadDownloadList()), [])
-  const onDownloadFile = useCallback((id) => dispatch(downloadFile(id)), [])
-
-  const [dashboardTreeNodes, firstDashboardKey] = useDashboardTreeNodes(currentDashboards)
-  const [dashboardMenuVisible, setDashboardMenuVisible] = useState(false)
-  const [dashboardMenuStyle, setDashboardMenuStyle] = useState({})
-  const dashboardConfigMenu = useDashboardConfigMenu(dashboardMenuStyle)
-
-  const closeDashboardMenu = useCallback(() => {
-    setDashboardMenuVisible(false)
-  }, [])
-
-  useEffect(() => {
-    document.addEventListener('click', closeDashboardMenu, false)
-    return () => {
-      document.removeEventListener('click', closeDashboardMenu, false)
-    }
-  }, [])
-
-  const showDashboardContextMenu = useCallback((options: AntTreeNodeMouseEvent) => {
-    const { node, event } = options
-    const { pageX, pageY } = event
-    const menuStyle: React.CSSProperties = {
-      position: 'absolute',
-      left: pageX,
-      top: pageY
-    }
-    setDashboardMenuStyle(menuStyle)
-    setDashboardMenuVisible(true)
-  }, [])
-
-  return (
-    <Layout>
-      <PageHeader
-        ghost={false}
-        title={currentPortal.name}
-        subTitle={currentPortal.description}
-        onBack={goToViz}
-        extra={
-          <DownloadList
-            downloadList={downloadList}
-            onLoadDownloadList={onLoadDownloadList}
-            onDownloadFile={onDownloadFile}
-          />
-        }
-      />
-      {dashboardMenuVisible && dashboardConfigMenu}
-      {Array.isArray(currentDashboards) &&
-        (currentDashboards.length ? (
-          <SplitPane
-            spliter
-            className="ant-layout-content"
-            type="horizontal"
-            initialSize={150}
-            minSize={150}
-          >
-            <DirectoryTree
-              defaultExpandAll
-              blockNode
-              defaultSelectedKeys={firstDashboardKey}
-              onRightClick={showDashboardContextMenu}
-            >
-              {dashboardTreeNodes}
-            </DirectoryTree>
-            <Route
-              path="/project/:projectId/dataManager/portal/:portalId/dashboard/:dashboardId"
-              component={Grid}
-            />
-          </SplitPane>
-        ) : (
-          <Content
-            style={{
-              display: 'flex',
-              flexDirection: 'column',
-              alignItems: 'center',
-              justifyContent: 'center'
-            }}
-          >
-            <Result
-              icon={<img src={require('assets/images/noDashboard.png')} />}
-              extra={
-                <p>
-                  请
-                  <Button size="small" type="link">
-                    创建文件夹
-                  </Button>
-                  或
-                  <Button size="small" type="link">
-                    创建 Dashboard
-                  </Button>
-                </p>
-              }
-            />
-          </Content>
-        ))}
-    </Layout>
-  )
-}
-
-export default DataManagerPortal

+ 0 - 161
app/containers/Viz/DataShareServiceDisplay/Editor.tsx

@@ -1,161 +0,0 @@
-/*
- * <<
- * Davinci
- * ==
- * Copyright (C) 2016 - 2017 EDP
- * ==
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * >>
- */
-
-import React, { useEffect, useCallback, useState } from 'react'
-import Helmet from 'react-helmet'
-import { useDispatch, useSelector } from 'react-redux'
-
-import { makeSelectCurrentProject } from 'containers/Projects/selectors'
-import {
-  makeSelectCurrentDisplay,
-  makeSelectCurrentSlides,
-  makeSelectCurrentSlide
-} from '../selectors'
-
-import { VizActions } from '../actions'
-
-import { Route } from 'react-router-dom'
-import { RouteComponentWithParams } from 'utils/types'
-
-import { Layout, PageHeader } from 'antd'
-import SplitPane from 'components/SplitPane'
-import SlideThumbnailList from '../components/SlideThumbnail'
-import DisplayHeader from 'containers/Display/Editor/Header'
-import { Display } from 'containers/Display/Loadable'
-import { ISlideFormed } from 'containers/Viz/components/types'
-
-import styles from '../Viz.less'
-
-const VizDisplayEditor: React.FC<RouteComponentWithParams> = (props) => {
-  const dispatch = useDispatch()
-  const { id: projectId } = useSelector(makeSelectCurrentProject())
-  const currentDisplay = useSelector(makeSelectCurrentDisplay())
-  const displayId = currentDisplay.id
-  const { id: slideId } = useSelector(makeSelectCurrentSlide())
-  const currentSlides = useSelector(makeSelectCurrentSlides())
-  const { history } = props
-
-  const [selectedSlideIds, setSelectedSlideIds] = useState([])
-
-  const clearSelectedSlide = useCallback(() => {
-    setSelectedSlideIds([])
-  }, [])
-
-  useEffect(() => {
-    window.addEventListener('click', clearSelectedSlide, false)
-    return () => {
-      window.removeEventListener('click', clearSelectedSlide, false)
-    }
-  }, [])
-
-  const goToViz = useCallback(() => {
-    history.replace(`/project/${projectId}/vizs`)
-  }, [projectId])
-
-  const selectSlide = useCallback(
-    (slideId: number, append: boolean) => {
-      if (append) {
-        setSelectedSlideIds(
-          selectedSlideIds.includes(slideId)
-            ? selectedSlideIds.filter((id) => id !== slideId)
-            : selectedSlideIds.concat(slideId)
-        )
-      } else {
-        setSelectedSlideIds([slideId])
-        history.replace(
-          `/project/${projectId}/display/${displayId}/slide/${slideId}`
-        )
-      }
-    },
-    [projectId, displayId, selectedSlideIds]
-  )
-
-  const changeDisplayAvatar = useCallback(
-    (avatar: string) => {
-      dispatch(
-        VizActions.editDisplay({
-          ...currentDisplay,
-          avatar
-        })
-      )
-    },
-    [currentDisplay]
-  )
-
-  const editSlides = useCallback((newSlides: ISlideFormed[]) => {
-    dispatch(VizActions.editSlides(newSlides))
-  }, [])
-
-  const deleteSlides = useCallback(
-    (targetSlideId?: number) => {
-      if (!targetSlideId || selectedSlideIds.includes(targetSlideId)) {
-        dispatch(VizActions.deleteSlides(displayId, selectedSlideIds))
-        return
-      }
-      if (targetSlideId) {
-        dispatch(VizActions.deleteSlides(displayId, [targetSlideId]))
-      }
-    },
-    [displayId, selectedSlideIds]
-  )
-
-  return (
-    <>
-      <Helmet title={`${currentDisplay.name} - Display`} />
-      <Layout>
-        <PageHeader
-          ghost={false}
-          title={currentDisplay.name}
-          subTitle={currentDisplay.description}
-          avatar={{
-            src: currentDisplay.avatar,
-            shape: 'square'
-          }}
-          extra={<DisplayHeader />}
-          onBack={goToViz}
-        />
-        <SplitPane
-          className="ant-layout-content"
-          type="horizontal"
-          initialSize={120}
-          minSize={120}
-          maxSize={200}
-        >
-          <SlideThumbnailList
-            className={styles.slides}
-            currentSlideId={slideId}
-            selectedSlideIds={selectedSlideIds}
-            slides={currentSlides}
-            onChange={editSlides}
-            onSelect={selectSlide}
-            onDelete={deleteSlides}
-            onChangeDisplayAvatar={changeDisplayAvatar}
-          />
-          <Route
-            path="/project/:projectId/display/:displayId/slide/:slideId"
-            component={Display}
-          />
-        </SplitPane>
-      </Layout>
-    </>
-  )
-}
-
-export default VizDisplayEditor

+ 0 - 7
app/containers/Viz/DataShareServiceDisplay/Loadable.tsx

@@ -1,7 +0,0 @@
-import React from 'react'
-import loadable from 'utils/loadable'
-import { Skeleton } from 'antd'
-
-export const VizDisplayEditor = loadable(() => import('./Editor'), {
-  fallback: <Skeleton active={true} paragraph={{ rows: 15 }} />
-})

+ 0 - 71
app/containers/Viz/DataShareServiceDisplay/index.tsx

@@ -1,71 +0,0 @@
-/*
- * <<
- * Davinci
- * ==
- * Copyright (C) 2016 - 2017 EDP
- * ==
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * >>
- */
-
-import React, { useEffect } from 'react'
-import Helmet from 'react-helmet'
-import { useDispatch, useSelector } from 'react-redux'
-
-import {
-  makeSelectCurrentDisplay,
-  makeSelectCurrentSlide
-} from '../selectors'
-
-import { hideNavigator } from 'containers/App/actions'
-import { VizActions } from '../actions'
-
-import { Route, matchPath } from 'react-router-dom'
-import { RouteComponentWithParams, IRouteParams } from 'utils/types'
-
-import { Display } from 'containers/Display/Loadable'
-import { VizDisplayEditor } from './Loadable'
-
-const VizDisplay: React.FC<RouteComponentWithParams> = (props) => {
-  const dispatch = useDispatch()
-  const currentDisplay = useSelector(makeSelectCurrentDisplay())
-  const currentSlide = useSelector(makeSelectCurrentSlide())
-  const {
-    history,
-    match: { params }
-  } = props
-  const displayId = +params.displayId
-  const { pathname } = history.location
-
-  useEffect(() => {
-    dispatch(hideNavigator())
-  }, [])
-
-  useEffect(() => {
-    dispatch(VizActions.loadDisplaySlides(displayId))
-  }, [displayId])
-
-  if (!currentDisplay || !currentSlide) {
-    return null
-  }
-
-  return (
-    <>
-      <Helmet title={`${currentDisplay.name} - Display`} />
-      <Route exact path="/project/:projectId/display/:displayId/preview/slide/:slideId" component={Display} />
-      <Route exact path="/project/:projectId/display/:displayId/slide/:slideId" component={VizDisplayEditor} />
-    </>
-  )
-}
-
-export default VizDisplay

+ 0 - 202
app/containers/Viz/DataShareServicePortal.tsx

@@ -1,202 +0,0 @@
-/*
- * <<
- * Davinci
- * ==
- * Copyright (C) 2016 - 2017 EDP
- * ==
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * >>
- */
-
-import React, { useEffect, useCallback, useState } from 'react'
-import { createStructuredSelector } from 'reselect'
-import { useDispatch, useSelector } from 'react-redux'
-import {
-  makeSelectDownloadList
-} from 'containers/App/selectors'
-import {
-  makeSelectPortals,
-  makeSelectCurrentPortal,
-  makeSelectCurrentDashboards
-} from './selectors'
-
-import {
-  hideNavigator,
-  loadDownloadList,
-  downloadFile
-} from 'containers/App/actions'
-import { VizActions } from './actions'
-
-import { Route } from 'react-router-dom'
-import { RouteComponentWithParams } from 'utils/types'
-
-import {
-  Layout,
-  Result,
-  PageHeader,
-  Tree,
-  Icon,
-  Button,
-  Menu,
-  Dropdown
-} from 'antd'
-const { Header, Sider, Content } = Layout
-const { DirectoryTree } = Tree
-import SplitPane from 'components/SplitPane'
-import DownloadList from 'components/DownloadList'
-import useDashboardConfigMenu from './hooks/dashboardConfigMenu'
-import { Grid } from 'containers/Dashboard/Loadable'
-import useDashboardTreeNodes from './hooks/dashboardTreeNodes'
-import { AntTreeNodeMouseEvent } from 'antd/lib/tree'
-
-const mapStateToProps = createStructuredSelector({
-  downloadList: makeSelectDownloadList(),
-  portals: makeSelectPortals(),
-  currentPortal: makeSelectCurrentPortal(),
-  currentDashboards: makeSelectCurrentDashboards()
-})
-
-interface IVizPortalProps extends RouteComponentWithParams {}
-
-const VizPortal: React.FC<IVizPortalProps> = (props) => {
-  const dispatch = useDispatch()
-  const {
-    portals,
-    currentPortal,
-    currentDashboards,
-    downloadList
-  } = useSelector(mapStateToProps)
-  const {
-    history,
-    match: { params }
-  } = props
-  const portalId = +params.portalId
-  const projectId = +params.projectId
-
-  useEffect(() => {
-    dispatch(hideNavigator())
-    if (!portals.length) {
-      dispatch(VizActions.loadPortals(projectId))
-    }
-  }, [])
-
-  useEffect(() => {
-    dispatch(VizActions.loadPortalDashboards(portalId))
-  }, [portalId])
-
-  const goToViz = useCallback(() => {
-    // eslint-disable-next-line react/prop-types
-    history.replace(`/project/${projectId}/dataShareService/vizs`)
-    // eslint-disable-next-line react-hooks/exhaustive-deps
-  }, [])
-
-  const onLoadDownloadList = useCallback(() => dispatch(loadDownloadList()), [])
-  const onDownloadFile = useCallback((id) => dispatch(downloadFile(id)), [])
-
-  const [dashboardTreeNodes, firstDashboardKey] = useDashboardTreeNodes(currentDashboards)
-  const [dashboardMenuVisible, setDashboardMenuVisible] = useState(false)
-  const [dashboardMenuStyle, setDashboardMenuStyle] = useState({})
-  const dashboardConfigMenu = useDashboardConfigMenu(dashboardMenuStyle)
-
-  const closeDashboardMenu = useCallback(() => {
-    setDashboardMenuVisible(false)
-  }, [])
-
-  useEffect(() => {
-    document.addEventListener('click', closeDashboardMenu, false)
-    return () => {
-      document.removeEventListener('click', closeDashboardMenu, false)
-    }
-  }, [])
-
-  const showDashboardContextMenu = useCallback((options: AntTreeNodeMouseEvent) => {
-    const { node, event } = options
-    const { pageX, pageY } = event
-    const menuStyle: React.CSSProperties = {
-      position: 'absolute',
-      left: pageX,
-      top: pageY
-    }
-    setDashboardMenuStyle(menuStyle)
-    setDashboardMenuVisible(true)
-  }, [])
-
-  return (
-    <Layout>
-      <PageHeader
-        ghost={false}
-        title={currentPortal.name}
-        subTitle={currentPortal.description}
-        onBack={goToViz}
-        extra={
-          <DownloadList
-            downloadList={downloadList}
-            onLoadDownloadList={onLoadDownloadList}
-            onDownloadFile={onDownloadFile}
-          />
-        }
-      />
-      {dashboardMenuVisible && dashboardConfigMenu}
-      {Array.isArray(currentDashboards) &&
-        (currentDashboards.length ? (
-          <SplitPane
-            spliter
-            className="ant-layout-content"
-            type="horizontal"
-            initialSize={150}
-            minSize={150}
-          >
-            <DirectoryTree
-              defaultExpandAll
-              blockNode
-              defaultSelectedKeys={firstDashboardKey}
-              onRightClick={showDashboardContextMenu}
-            >
-              {dashboardTreeNodes}
-            </DirectoryTree>
-            <Route
-              path="/project/:projectId/dataShareService/portal/:portalId/dashboard/:dashboardId"
-              component={Grid}
-            />
-          </SplitPane>
-        ) : (
-          <Content
-            style={{
-              display: 'flex',
-              flexDirection: 'column',
-              alignItems: 'center',
-              justifyContent: 'center'
-            }}
-          >
-            <Result
-              icon={<img src={require('assets/images/noDashboard.png')} />}
-              extra={
-                <p>
-                  请
-                  <Button size="small" type="link">
-                    创建文件夹
-                  </Button>
-                  或
-                  <Button size="small" type="link">
-                    创建 Dashboard
-                  </Button>
-                </p>
-              }
-            />
-          </Content>
-        ))}
-    </Layout>
-  )
-}
-
-export default VizPortal

+ 0 - 42
app/containers/Viz/dataManagerViz.tsx

@@ -1,42 +0,0 @@
-/*
- * <<
- * Davinci
- * ==
- * Copyright (C) 2016 - 2017 EDP
- * ==
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * >>
- */
-
-import React from 'react'
-import { Switch, Route } from 'react-router-dom'
-import { useInjectReducer } from 'utils/injectReducer'
-import { useInjectSaga } from 'utils/injectSaga'
-
-import reducer from './reducer'
-import saga from './sagas'
-
-import { DataManagerPortalIndex, DataManagerVizDisplay, DataVizList } from './Loadable'
-
-export default () => {
-  useInjectReducer({ key: 'viz', reducer })
-  useInjectSaga({ key: 'viz', saga })
-
-  return (
-    <Switch>
-      <Route path="/project/:projectId/dataManager/vizs" component={DataVizList} />
-      <Route path="/project/:projectId/dataManager/portal/:portalId" component={DataManagerPortalIndex} />
-      <Route path="/project/:projectId/dataManager/display/:displayId" component={DataManagerVizDisplay} />
-    </Switch>
-  )
-}