Merge branch 'master' of git.curoverse.com:arvados-workbench2 into 14422_item_sorting... 14422_item_sorting_in_copy_to_project_modal
authorJanicki Artur <artur.janicki@contractors.roche.com>
Tue, 6 Nov 2018 07:58:12 +0000 (08:58 +0100)
committerJanicki Artur <artur.janicki@contractors.roche.com>
Tue, 6 Nov 2018 07:58:12 +0000 (08:58 +0100)
refs #2
14422

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

17 files changed:
src/index.tsx
src/store/context-menu/context-menu-actions.ts
src/store/data-explorer/data-explorer-action.ts
src/store/data-explorer/data-explorer-middleware.test.ts
src/store/data-explorer/data-explorer-middleware.ts
src/store/data-explorer/data-explorer-reducer.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-components/data-explorer/data-explorer.tsx
src/views-components/search-bar/search-bar-autocomplete-view.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 e637043dacde193f4af1983706289f1dc4b3255c..a58d20edb17eea49270caf32a5cc959bef7ecb82 100644 (file)
@@ -16,7 +16,7 @@ export const dataExplorerActions = unionize({
     SET_ROWS_PER_PAGE: ofType<{ id: string, rowsPerPage: number }>(),
     TOGGLE_COLUMN: ofType<{ id: string, columnName: string }>(),
     TOGGLE_SORT: ofType<{ id: string, columnName: string }>(),
-    SET_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(),
+    SET_EXPLORER_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(),
 });
 
 export type DataExplorerAction = UnionOf<typeof dataExplorerActions>;
@@ -40,6 +40,6 @@ export const bindDataExplorerActions = (id: string) => ({
         dataExplorerActions.TOGGLE_COLUMN({ ...payload, id }),
     TOGGLE_SORT: (payload: { columnName: string }) =>
         dataExplorerActions.TOGGLE_SORT({ ...payload, id }),
-    SET_SEARCH_VALUE: (payload: { searchValue: string }) =>
-        dataExplorerActions.SET_SEARCH_VALUE({ ...payload, id }),
+    SET_EXPLORER_SEARCH_VALUE: (payload: { searchValue: string }) =>
+        dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ ...payload, id }),
 });
index 2a88817cecc8ad9256b6ee9f33b3c212df83a78b..814d5855c0b6a45b0ee0224d73e382f13b561560 100644 (file)
@@ -169,7 +169,7 @@ describe("DataExplorerMiddleware", () => {
         };
         const next = jest.fn();
         const middleware = dataExplorerMiddleware(service)(api)(next);
-        middleware(dataExplorerActions.SET_SEARCH_VALUE({ id: service.getId(), searchValue: "" }));
+        middleware(dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ id: service.getId(), searchValue: "" }));
         expect(api.dispatch).toHaveBeenCalledTimes(2);
     });
 
index 3491862d49ce2f81d2156dbafeffdb42e0f62291..f90f9a6ce39d1ceddff638959544d1ec24c1d06c 100644 (file)
@@ -32,7 +32,7 @@ export const dataExplorerMiddleware = (service: DataExplorerMiddlewareService):
             TOGGLE_SORT: handleAction(() => {
                 api.dispatch(actions.REQUEST_ITEMS());
             }),
-            SET_SEARCH_VALUE: handleAction(() => {
+            SET_EXPLORER_SEARCH_VALUE: handleAction(() => {
                 api.dispatch(actions.RESET_PAGINATION());
                 api.dispatch(actions.REQUEST_ITEMS());
             }),
index d059d37af4639110170f848cf1badf4be411154a..141d1a9f20657e1a4a462dbe32b8dd583f817341 100644 (file)
@@ -50,7 +50,7 @@ export const dataExplorerReducer = (state: DataExplorerState = {}, action: DataE
         SET_ROWS_PER_PAGE: ({ id, rowsPerPage }) =>
             update(state, id, explorer => ({ ...explorer, rowsPerPage })),
 
-        SET_SEARCH_VALUE: ({ id, searchValue }) =>
+        SET_EXPLORER_SEARCH_VALUE: ({ id, searchValue }) =>
             update(state, id, explorer => ({ ...explorer, searchValue })),
 
         TOGGLE_SORT: ({ id, columnName }) =>
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 17f2c77b0a44fdd3b235b1625c9d0ddf39ba430f..59555707d11a2e509d886abf978b3ab4a2972580 100644 (file)
@@ -33,7 +33,7 @@ const mapDispatchToProps = () => {
         },
 
         onSearch: (searchValue: string) => {
-            dispatch(dataExplorerActions.SET_SEARCH_VALUE({ id, searchValue }));
+            dispatch(dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ id, searchValue }));
         },
 
         onColumnToggle: (column: DataColumn<any>) => {
index 4dab5db0890ab97acd5f46e69b29815504711903..e45197dd37280c710d28f3f2daf29130d396d3a8 100644 (file)
@@ -39,7 +39,6 @@ type SearchBarAutocompleteViewProps = SearchBarAutocompleteViewDataProps & Searc
 
 export const SearchBarAutocompleteView = withStyles(styles)(
     ({ classes, searchResults, searchValue, navigateTo, selectedItem }: SearchBarAutocompleteViewProps) => {
-        console.log(searchValue, selectedItem);
         return <Paper className={classes.searchView}>
             <List component="nav" className={classes.list}>
                 <ListItem button className={classes.listItem} selected={!selectedItem || searchValue === selectedItem.id}>
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