small-snackbar-fix
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 2 Oct 2018 08:23:20 +0000 (10:23 +0200)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 2 Oct 2018 08:23:20 +0000 (10:23 +0200)
Feature #14231

Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>

src/store/collections/collection-move-actions.ts
src/store/workbench/workbench-actions.ts
src/views-components/workflow-tree-picker/workflow-tree-picker.tsx

index 9bdc5523793a789a2df2b8329abe2b188117be5c..54508e139f2b2b35bdfb14fb0bdfe805c1c3847e 100644 (file)
@@ -8,7 +8,7 @@ import { startSubmit, stopSubmit, initialize } from 'redux-form';
 import { ServiceRepository } from '~/services/services';
 import { RootState } from '~/store/store';
 import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service";
-import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { projectPanelActions } from '~/store/project-panel/project-panel-action';
 import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
 import { resetPickerProjectTree } from '~/store/project-tree-picker/project-tree-picker-actions';
@@ -32,11 +32,6 @@ export const moveCollection = (resource: MoveToFormDialogData) =>
             await services.collectionService.update(resource.uuid, { ...collection, ownerUuid: resource.ownerUuid });
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_MOVE_FORM_NAME }));
-            dispatch(snackbarActions.OPEN_SNACKBAR({
-                message: 'Collection has been moved',
-                hideDuration: 2000,
-                kind: SnackbarKind.SUCCESS
-            }));
             dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_MOVE_FORM_NAME));
             return collection;
         } catch (e) {
index bd480bda99e10c05925da4ef5de07c6fc6520d9c..62fca46997ffc68f50fe38dee65764df5cf21103 100644 (file)
@@ -48,6 +48,7 @@ import { GroupContentsResource } from '~/services/groups-service/groups-service'
 import { unionize, ofType, UnionOf, MatchCases } from '~/common/unionize';
 import { loadRunProcessPanel } from '~/store/run-process-panel/run-process-panel-actions';
 import { loadCollectionFiles } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
+import { SnackbarKind } from '~/store/snackbar/snackbar-actions';
 
 export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
 
@@ -262,7 +263,7 @@ export const moveCollection = (data: MoveToFormDialogData) =>
             const collection = await dispatch<any>(collectionMoveActions.moveCollection(data));
             dispatch<any>(updateResources([collection]));
             dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
-            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Collection has been moved.', hideDuration: 2000 }));
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Collection has been moved.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
         } catch (e) {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
         }
index 3f971720f525ef1fcd3a4bc9bd2da5c98594b1c7..a765f815eeb50e520cf3457cfc598c718f31c3b6 100644 (file)
@@ -64,9 +64,6 @@ enum TreePickerId {
 
 export const WorkflowTreePicker = connect(undefined, mapDispatchToProps)((props: WorkflowTreePickerProps) =>
     <div style={{ display: 'flex', flexDirection: 'column' }}>
-        <Typography variant='caption' style={{ flexShrink: 0 }}>
-            Select a project
-        </Typography>
         <div style={{ flexGrow: 1, overflow: 'auto' }}>
             <MainWorkflowTreePicker {...props} render={renderTreeItem} pickerId={TreePickerId.PROJECTS} />
             <MainWorkflowTreePicker {...props} render={renderTreeItem} pickerId={TreePickerId.SHARED_WITH_ME} />
@@ -109,7 +106,10 @@ export const loadFavoriteTreePicker = (nodeId: string) =>
                 .addEqual('ownerUuid', nodeId)
                 .getFilters();
 
-            const { items } = await services.groupsService.contents(parentId, { filters });
+                const { items } = (extractUuidKind(nodeId) === ResourceKind.COLLECTION)
+                ? dispatch<any>(loadCollectionFiles(nodeId))
+                : await services.groupsService.contents(parentId, { filters });
+
 
             dispatch<any>(receiveTreePickerData(nodeId, items, TreePickerId.FAVORITES));
         }