refs #11432 Merge branch 'origin/14432-search-object-object'
authorDaniel Kos <daniel.kos@contractors.roche.com>
Mon, 5 Nov 2018 20:23:58 +0000 (21:23 +0100)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Mon, 5 Nov 2018 20:25:36 +0000 (21:25 +0100)
Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos@contractors.roche.com>

src/index.tsx
src/store/context-menu/context-menu-actions.ts
src/views-components/collection-panel-files/collection-panel-files.ts
src/views-components/context-menu/action-sets/collection-files-not-selected-action-set.ts [new file with mode: 0644]
src/views-components/context-menu/context-menu.tsx
src/views/favorite-panel/favorite-panel.tsx
src/views/project-panel/project-panel.tsx
src/views/search-results-panel/search-results-panel.tsx
src/views/shared-with-me-panel/shared-with-me-panel.tsx
src/views/trash-panel/trash-panel.tsx
src/views/workbench/workbench.tsx

index d9235d0ffc6665edb8a6a40ba4b747b95c69aafb..efe3a576df3a7ca03bcade88819442f90c0a8663 100644 (file)
@@ -25,6 +25,7 @@ import { resourceActionSet } from './views-components/context-menu/action-sets/r
 import { favoriteActionSet } from "./views-components/context-menu/action-sets/favorite-action-set";
 import { collectionFilesActionSet } from './views-components/context-menu/action-sets/collection-files-action-set';
 import { collectionFilesItemActionSet } from './views-components/context-menu/action-sets/collection-files-item-action-set';
+import { collectionFilesNotSelectedActionSet } from './views-components/context-menu/action-sets/collection-files-not-selected-action-set';
 import { collectionActionSet } from './views-components/context-menu/action-sets/collection-action-set';
 import { collectionResourceActionSet } from './views-components/context-menu/action-sets/collection-resource-action-set';
 import { processActionSet } from './views-components/context-menu/action-sets/process-action-set';
@@ -55,6 +56,7 @@ addMenuActionSet(ContextMenuKind.PROJECT, projectActionSet);
 addMenuActionSet(ContextMenuKind.RESOURCE, resourceActionSet);
 addMenuActionSet(ContextMenuKind.FAVORITE, favoriteActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES, collectionFilesActionSet);
+addMenuActionSet(ContextMenuKind.COLLECTION_FILES_NOT_SELECTED, collectionFilesNotSelectedActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
index 3ae79db40515e3381a421930095783b70a925812..32bc47b6b8cd04f6e884614abe1d7fb46bfbe0c5 100644 (file)
@@ -48,6 +48,18 @@ export const openContextMenu = (event: React.MouseEvent<HTMLElement>, resource:
         );
     };
 
+export const openCollectionFilesContextMenu = (event: React.MouseEvent<HTMLElement>) =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        const isCollectionFileSelected = JSON.stringify(getState().collectionPanelFiles).includes('"selected":true');
+        dispatch<any>(openContextMenu(event, {
+            name: '',
+            uuid: '',
+            ownerUuid: '',
+            kind: ResourceKind.COLLECTION,
+            menuKind: isCollectionFileSelected ? ContextMenuKind.COLLECTION_FILES : ContextMenuKind.COLLECTION_FILES_NOT_SELECTED
+        }));
+    };
+
 export const openRootProjectContextMenu = (event: React.MouseEvent<HTMLElement>, projectUuid: string) =>
     (dispatch: Dispatch, getState: () => RootState) => {
         const res = getResource<UserResource>(projectUuid)(getState().resources);
index edc100f783d282745172da4bf68cfe6873436b84..294bd6d5d2858c667b3979d6876fb0d3c3e3746e 100644 (file)
@@ -20,7 +20,7 @@ import { collectionPanelFilesAction } from "~/store/collection-panel/collection-
 import { ContextMenuKind } from "../context-menu/context-menu";
 import { getNode, getNodeChildrenIds, Tree } from "~/models/tree";
 import { CollectionFileType } from "~/models/collection-file";
-import { openContextMenu } from '~/store/context-menu/context-menu-actions';
+import { openContextMenu, openCollectionFilesContextMenu } from '~/store/context-menu/context-menu-actions';
 import { openUploadCollectionFilesDialog } from '~/store/collections/collection-upload-actions';
 import { ResourceKind } from "~/models/resource";
 
@@ -54,7 +54,7 @@ const mapDispatchToProps = (dispatch: Dispatch): Pick<CollectionPanelFilesProps,
         dispatch<any>(openContextMenu(event, { menuKind: ContextMenuKind.COLLECTION_FILES_ITEM, kind: ResourceKind.COLLECTION, name: item.data.name, uuid: item.id, ownerUuid: '' }));
     },
     onOptionsMenuOpen: (event) => {
-        dispatch<any>(openContextMenu(event, { menuKind: ContextMenuKind.COLLECTION_FILES, kind: ResourceKind.COLLECTION, name: '', uuid: '', ownerUuid: '' }));
+        dispatch<any>(openCollectionFilesContextMenu(event));
     },
 });
 
diff --git a/src/views-components/context-menu/action-sets/collection-files-not-selected-action-set.ts b/src/views-components/context-menu/action-sets/collection-files-not-selected-action-set.ts
new file mode 100644 (file)
index 0000000..ab31566
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "~/views-components/context-menu/context-menu-action-set";
+import { collectionPanelFilesAction } from "~/store/collection-panel/collection-panel-files/collection-panel-files-actions";
+
+export const collectionFilesNotSelectedActionSet: ContextMenuActionSet = [[{
+    name: "Select all",
+    execute: dispatch => {
+        dispatch(collectionPanelFilesAction.SELECT_ALL_COLLECTION_FILES());
+    }
+}]];
\ No newline at end of file
index ad6f7e306030b5eedea8309dd2d2b931fccc6bab..b6d2b91b1a5e58dd07353ed19eb024e48425c629 100644 (file)
@@ -62,6 +62,7 @@ export enum ContextMenuKind {
     TRASH = "Trash",
     COLLECTION_FILES = "CollectionFiles",
     COLLECTION_FILES_ITEM = "CollectionFilesItem",
+    COLLECTION_FILES_NOT_SELECTED = "CollectionFilesNotSelected",
     COLLECTION = 'Collection',
     COLLECTION_RESOURCE = 'CollectionResource',
     TRASHED_COLLECTION = 'TrashedCollection',
index 948885f7081a9e1e691379cf99266e512618bdb2..33c901cb784e19e51b03051cfaa640d1facd571b 100644 (file)
@@ -146,6 +146,7 @@ const mapDispatchToProps = (dispatch: Dispatch): FavoritePanelActionProps => ({
                 menuKind: kind
             }));
         }
+        dispatch<any>(loadDetailsPanel(resourceUuid));
     },
     onDialogOpen: (ownerUuid: string) => { return; },
     onItemClick: (resourceUuid: string) => {
index 2b2be2e8905ec5d111faf8c121da72dddba94371..1221d0d1fba4df866500dc7ed4669a7fe8f58f38 100644 (file)
@@ -170,6 +170,7 @@ export const ProjectPanel = withStyles(styles)(
                         menuKind
                     }));
                 }
+                this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
             }
 
             handleRowDoubleClick = (uuid: string) => {
index fd322d75fc2877f40bc405bde1a037f1505a3531..65999a5cbb30aea18b1c7ff66b9227b0cab5e7c0 100644 (file)
@@ -23,6 +23,7 @@ const mapDispatchToProps = (dispatch: Dispatch): SearchResultsPanelActionProps =
                 menuKind: kind
             }));
         }
+        dispatch<any>(loadDetailsPanel(resourceUuid));
     },
     onDialogOpen: (ownerUuid: string) => { return; },
     onItemClick: (resourceUuid: string) => {
index 4aee73a6fd26cd33fb86276a406abaf7ea8e6d52..582aa9c7416f50917c94aa32afc00be5ee96fa42 100644 (file)
@@ -63,6 +63,7 @@ export const SharedWithMePanel = withStyles(styles)(
                         menuKind
                     }));
                 }
+                this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
             }
 
             handleRowDoubleClick = (uuid: string) => {
index 92febd8acf55467f960eb234ac1ecee99c6ea28a..4d5df5cdbc3a304ca9573f8bb56a92e612d91bba 100644 (file)
@@ -180,6 +180,7 @@ export const TrashPanel = withStyles(styles)(
                         menuKind: ContextMenuKind.TRASH
                     }));
                 }
+                this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
             }
 
             handleRowDoubleClick = (uuid: string) => {
index 41f9682f639c8e76faed175f8bc2511ce680c196..9ae1018857d2080ca83f06dffa3ae584e6e713b9 100644 (file)
@@ -77,12 +77,23 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 
 type WorkbenchPanelProps = WithStyles<CssRules>;
 
+const defaultSplitterSize = 90;
+
+const getSplitterInitialSize = () => {
+    const splitterSize = localStorage.getItem('splitterSize');
+    return splitterSize ? Number(splitterSize) : defaultSplitterSize;
+};
+
+const saveSplitterSize = (size: number) => localStorage.setItem('splitterSize', size.toString());
+
 export const WorkbenchPanel =
     withStyles(styles)(({ classes }: WorkbenchPanelProps) =>
         <Grid container item xs className={classes.root}>
             <Grid container item xs className={classes.container}>
                 <SplitterLayout customClassName={classes.splitter} percentage={true}
-                    primaryIndex={0} primaryMinSize={10} secondaryInitialSize={90} secondaryMinSize={40}>
+                                primaryIndex={0} primaryMinSize={10}
+                                secondaryInitialSize={getSplitterInitialSize()} secondaryMinSize={40}
+                                onSecondaryPaneSizeChange={saveSplitterSize}>
                     <Grid container item xs component='aside' direction='column' className={classes.asidePanel}>
                         <SidePanel />
                     </Grid>
@@ -133,4 +144,4 @@ export const WorkbenchPanel =
             <UpdateProcessDialog />
             <UpdateProjectDialog />
         </Grid>
-    );
+    );
\ No newline at end of file