change code after CR
authorJanicki Artur <artur.janicki@contractors.roche.com>
Mon, 30 Jul 2018 07:10:46 +0000 (09:10 +0200)
committerJanicki Artur <artur.janicki@contractors.roche.com>
Mon, 30 Jul 2018 07:10:46 +0000 (09:10 +0200)
Feature #13853

Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki@contractors.roche.com>

src/common/actions.ts [deleted file]
src/models/collection.ts
src/models/project.ts
src/store/navigation/navigation-action.ts
src/views/collection-panel/collection-panel.tsx
src/views/workbench/workbench.tsx

diff --git a/src/common/actions.ts b/src/common/actions.ts
deleted file mode 100644 (file)
index 9ab6fd4..0000000
+++ /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
index 2a92594473cac819263e0af8ece34044475ba37f..8ab319991cc91a0f130576f1d4f72f4292be48c0 100644 (file)
@@ -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
index 1373ca7d509976d82962efd9cc48f17e07f90aa3..d3626d3be9dd6f0f776b69a9a80f5748877de10c 100644 (file)
@@ -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}`;
+};
index 0cb698313914b8d582650dfc453b39297c7105ca..d65685d296becd4bad5d9d6ed7c3ef8c30ce0e9b 100644 (file)
@@ -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 = <T extends Resource>(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;
     }
 };
index 99c4e00a1470c440f20a49e7463a772cd99d24a2..1e5fb5e8a6891185394c89655a96533350cc9db4 100644 (file)
@@ -85,15 +85,16 @@ export const CollectionPanel = withStyles(styles)(
         class extends React.Component<CollectionPanelProps> { 
 
             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 <div>
                         <Card className={classes.card}>
@@ -127,7 +128,7 @@ export const CollectionPanel = withStyles(styles)(
                                 <Menu
                                     id="submenu"
                                     anchorEl={anchorEl}
-                                    open={Boolean(anchorEl)}
+                                    open={open}
                                     onClose={this.closeMenu}>
                                     {MENU_OPTIONS.map((option) => (
                                         <MenuItem key={option.title}>
index f39c779235c1110210207892ad8dd6d4e408bfda..bef7ad8673a0d24911f52ca0044f06628ac6d76e 100644 (file)
@@ -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<any>(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<any>(setProjectItem(item.uuid, ItemMode.ACTIVE));
                             this.props.dispatch<any>(loadDetails(item.uuid, item.kind as ResourceKind));