From ccc52fb9e9a880f8b8e9b15b09c2ebd513575bd4 Mon Sep 17 00:00:00 2001 From: Janicki Artur Date: Mon, 30 Jul 2018 09:10:46 +0200 Subject: [PATCH] change code after CR Feature #13853 Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- src/common/actions.ts | 11 ----------- src/models/collection.ts | 4 ++++ src/models/project.ts | 4 ++++ src/store/navigation/navigation-action.ts | 7 ++++--- src/views/collection-panel/collection-panel.tsx | 11 ++++++----- src/views/workbench/workbench.tsx | 6 +++--- 6 files changed, 21 insertions(+), 22 deletions(-) delete mode 100644 src/common/actions.ts diff --git a/src/common/actions.ts b/src/common/actions.ts deleted file mode 100644 index 9ab6fd48db..0000000000 --- a/src/common/actions.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) The Arvados Authors. All rights reserved. -// -// SPDX-License-Identifier: AGPL-3.0 - -export const goToProject = (uuid: string) => { - return `/projects/${uuid}`; -}; - -export const goToCollection = (uuid: string) => { - return `/collections/${uuid}`; -}; \ No newline at end of file diff --git a/src/models/collection.ts b/src/models/collection.ts index 2a92594473..8ab319991c 100644 --- a/src/models/collection.ts +++ b/src/models/collection.ts @@ -18,3 +18,7 @@ export interface CollectionResource extends Resource { deleteAt: string; isTrashed: boolean; } + +export const getCollectionUrl = (uuid: string) => { + return `/collections/${uuid}`; +}; \ No newline at end of file diff --git a/src/models/project.ts b/src/models/project.ts index 1373ca7d50..d3626d3be9 100644 --- a/src/models/project.ts +++ b/src/models/project.ts @@ -7,3 +7,7 @@ import { GroupResource, GroupClass } from "./group"; export interface ProjectResource extends GroupResource { groupClass: GroupClass.Project; } + +export const getProjectUrl = (uuid: string) => { + return `/projects/${uuid}`; +}; diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts index 0cb6983139..d65685d296 100644 --- a/src/store/navigation/navigation-action.ts +++ b/src/store/navigation/navigation-action.ts @@ -11,12 +11,13 @@ import { dataExplorerActions } from "../data-explorer/data-explorer-action"; import { PROJECT_PANEL_ID } from "../../views/project-panel/project-panel"; import { RootState } from "../store"; import { Resource, ResourceKind } from "../../models/resource"; -import { goToProject, goToCollection } from "../../common/actions"; +import { getCollectionUrl } from "../../models/collection"; +import { getProjectUrl } from "../../models/project"; export const getResourceUrl = (resource: T): string => { switch (resource.kind) { - case ResourceKind.Project: return goToProject(resource.uuid); - case ResourceKind.Collection: return goToCollection(resource.uuid); + case ResourceKind.Project: return getProjectUrl(resource.uuid); + case ResourceKind.Collection: return getCollectionUrl(resource.uuid); default: return resource.href; } }; diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx index 99c4e00a14..1e5fb5e8a6 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -85,15 +85,16 @@ export const CollectionPanel = withStyles(styles)( class extends React.Component { state = { - anchorEl: undefined + anchorEl: undefined, + open: false }; showMenu = (event: any) => { - this.setState({ anchorEl: event.currentTarget }); + this.setState({ anchorEl: event.currentTarget, open: true }); } closeMenu = () => { - this.setState({ anchorEl: undefined }); + this.setState({ anchorEl: undefined, open: false }); } displayMenuAction = () => { @@ -107,7 +108,7 @@ export const CollectionPanel = withStyles(styles)( } render() { - const { anchorEl } = this.state; + const { anchorEl, open } = this.state; const { classes, item } = this.props; return
@@ -127,7 +128,7 @@ export const CollectionPanel = withStyles(styles)( {MENU_OPTIONS.map((option) => ( diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index f39c779235..bef7ad8673 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -28,7 +28,7 @@ import { authService } from '../../services/services'; import { detailsPanelActions, loadDetails } from "../../store/details-panel/details-panel-action"; import { contextMenuActions } from "../../store/context-menu/context-menu-actions"; -import { sidePanelData, SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer'; +import { SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer'; import { ProjectResource } from '../../models/project'; import { ResourceKind } from '../../models/resource'; import { ContextMenu, ContextMenuKind } from "../../views-components/context-menu/context-menu"; @@ -37,8 +37,8 @@ import { CurrentTokenDialog } from '../../views-components/current-token-dialog/ import { dataExplorerActions } from '../../store/data-explorer/data-explorer-action'; import { Snackbar } from '../../views-components/snackbar/snackbar'; import { CollectionPanel } from '../collection-panel/collection-panel'; -import { goToCollection } from '../../common/actions'; import { loadCollection } from '../../store/collection-panel/collection-panel-action'; +import { getCollectionUrl } from '../../models/collection'; const drawerWidth = 240; const appBarHeight = 100; @@ -253,7 +253,7 @@ export const Workbench = withStyles(styles)( switch (item.kind) { case ResourceKind.Collection: this.props.dispatch(loadCollection(item.uuid, item.kind as ResourceKind)); - this.props.dispatch(push(goToCollection(item.uuid))); + this.props.dispatch(push(getCollectionUrl(item.uuid))); default: this.props.dispatch(setProjectItem(item.uuid, ItemMode.ACTIVE)); this.props.dispatch(loadDetails(item.uuid, item.kind as ResourceKind)); -- 2.30.2