cr changes
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 21 Aug 2018 10:01:44 +0000 (12:01 +0200)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 21 Aug 2018 10:01:44 +0000 (12:01 +0200)
Feature #13988

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

src/components/project-copy/project-copy.tsx [moved from src/components/make-a-copy/make-a-copy.tsx with 88% similarity]
src/components/tree/tree.test.tsx
src/components/tree/tree.tsx
src/index.tsx
src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
src/views-components/context-menu/action-sets/collection-action-set.ts
src/views-components/context-menu/action-sets/collection-resource-action-set.ts
src/views-components/context-menu/action-sets/project-action-set.ts
src/views-components/make-a-copy-dialog/make-a-copy-dialog.tsx [deleted file]
src/views-components/project-copy-dialog/project-copy-dialog.tsx [new file with mode: 0644]
src/views/workbench/workbench.tsx

similarity index 88%
rename from src/components/make-a-copy/make-a-copy.tsx
rename to src/components/project-copy/project-copy.tsx
index f1098ff43a8fa4353add3cfb5ea4d8a9f3935f1e..34c8e6d1f7cc14381d67f27ad737e15389f5db0f 100644 (file)
@@ -15,7 +15,7 @@ export interface CopyFormData {
     uuid: string;
 }
 
-export const MakeACopyDialog = (props: WithDialogProps<string> & InjectedFormProps<CopyFormData>) =>
+export const ProjectCopy = (props: WithDialogProps<string> & InjectedFormProps<CopyFormData>) =>
     <form>
         <Dialog open={props.open}
             disableBackdropClick={true}
@@ -46,8 +46,9 @@ export const MakeACopyDialog = (props: WithDialogProps<string> & InjectedFormPro
                     type='submit'
                     onClick={props.handleSubmit}
                     disabled={props.pristine || props.invalid || props.submitting}>
-                    {props.submitting ? <CircularProgress size={20} /> : 'Copy'}
-                </Button>
+                    {props.submitting && <CircularProgress size={20} style={{position: 'absolute'}}/>}
+                    Copy
+                </Button>                
             </DialogActions>
         </Dialog>
     </form>;
index 45981d8962c7119f614b48a9ab866bceed9c65f9..50d1368abedc0776b1b81b4e2fe88013f4f7c134 100644 (file)
@@ -7,7 +7,7 @@ import * as Enzyme from 'enzyme';
 import * as Adapter from 'enzyme-adapter-react-16';
 import ListItem from "@material-ui/core/ListItem/ListItem";
 
-import { Tree, TreeItem } from './tree';
+import { Tree, TreeItem, TreeItemStatus } from './tree';
 import { ProjectResource } from '../../models/project';
 import { mockProjectResource } from '../../models/test-utils';
 import { Checkbox } from '@material-ui/core';
@@ -22,7 +22,7 @@ describe("Tree component", () => {
             id: "3",
             open: true,
             active: true,
-            status: 1,
+            status: TreeItemStatus.LOADED
         };
         const wrapper = mount(<Tree
             render={project => <div />}
@@ -39,7 +39,7 @@ describe("Tree component", () => {
             id: "3",
             open: true,
             active: true,
-            status: 1,
+            status: TreeItemStatus.LOADED,
         };
         const wrapper = mount(<Tree
             render={project => <div />}
@@ -56,7 +56,7 @@ describe("Tree component", () => {
             id: "3",
             open: true,
             active: true,
-            status: 1,
+            status: TreeItemStatus.LOADED
         };
         const wrapper = mount(<Tree
             showSelection={true}
@@ -74,7 +74,7 @@ describe("Tree component", () => {
             id: "3",
             open: true,
             active: true,
-            status: 1,
+            status: TreeItemStatus.LOADED,
         };
         const spy = jest.fn();
         const onSelectionChanged = (event: any, item: TreeItem<any>) => spy(item);
index 8a56739758c8ec13810c5454f03463221ade35ec..8d657f8dd63dabff570abafaa831d8411a9d1eab 100644 (file)
@@ -141,9 +141,13 @@ export const Tree = withStyles(styles)(
         }
 
         getProperArrowAnimation = (status: string, items: Array<TreeItem<T>>) => {
+            return this.isSidePanelIconNotNeeded(status, items) ? <span /> : <SidePanelRightArrowIcon />;
+        }
+
+        isSidePanelIconNotNeeded = (status: string, items: Array<TreeItem<T>>) => {
             return status === TreeItemStatus.PENDING ||
-            (status === TreeItemStatus.LOADED && !items) || 
-            (status === TreeItemStatus.LOADED && items && items.length === 0) ? <span /> : <SidePanelRightArrowIcon />;
+                (status === TreeItemStatus.LOADED && !items) ||
+                (status === TreeItemStatus.LOADED && items && items.length === 0);
         }
 
         getToggableIconClassNames = (isOpen?: boolean, isActive?: boolean) => {
index f5b1464eb898010719eb98a10bb3103f483d514f..b368d3f88f9cdf560f9f6c5a6b3340c23cf88d2a 100644 (file)
@@ -27,7 +27,6 @@ import { collectionFilesActionSet } from './views-components/context-menu/action
 import { collectionFilesItemActionSet } from './views-components/context-menu/action-sets/collection-files-item-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 { initPickerProjectTree } from './store/project-tree-picker/project-tree-picker-actions';
 
 const getBuildNumber = () => "BN-" + (process.env.BUILD_NUMBER || "dev");
 const getGitCommit = () => "GIT-" + (process.env.GIT_COMMIT || "latest").substr(0, 7);
@@ -53,8 +52,7 @@ fetchConfig()
         const store = configureStore(history, services);
 
         store.dispatch(initAuth());
-        store.dispatch(getProjectList(services.authService.getUuid()));
-        store.dispatch(initPickerProjectTree());    
+        store.dispatch(getProjectList(services.authService.getUuid()));  
 
         const TokenComponent = (props: any) => <ApiToken authService={services.authService} {...props}/>;
         const WorkbenchComponent = (props: any) => <Workbench authService={services.authService} buildInfo={buildInfo} {...props}/>;
index e7a7ec86b6b017eabee18c8a48575fa800b20961..3ad753fc92802cac6383167210d68bc605188e05 100644 (file)
@@ -11,9 +11,9 @@ import { snackbarActions } from "../../snackbar/snackbar-actions";
 import { dialogActions } from '../../dialog/dialog-actions';
 import { getNodeValue } from "~/models/tree";
 import { filterCollectionFilesBySelection } from './collection-panel-files-state';
-import { startSubmit, initialize, SubmissionError, stopSubmit } from 'redux-form';
-import { loadProjectTreePickerProjects } from '../../../views-components/project-tree-picker/project-tree-picker';
+import { startSubmit, initialize, stopSubmit } from 'redux-form';
 import { getCommonResourceServiceError, CommonResourceServiceError } from "~/common/api/common-resource-service";
+import { resetPickerProjectTree } from '../../project-tree-picker/project-tree-picker-actions';
 
 export const collectionPanelFilesAction = unionize({
     SET_COLLECTION_FILES: ofType<CollectionFilesTree>(),
@@ -103,7 +103,7 @@ export const openCollectionPartialCopyDialog = () =>
                 projectUuid: ''
             };
             dispatch(initialize(COLLECTION_PARTIAL_COPY, initialData));
-            dispatch<any>(loadProjectTreePickerProjects(''));
+            dispatch<any>(resetPickerProjectTree());
             dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY, data: {} }));
         }
     };
index 0f0125c54cdd45408b6ed427f58397d52b4ca83b..7d49e34c03a59078642ed2f68ebeeb3d02db016d 100644 (file)
@@ -8,7 +8,7 @@ import { toggleFavorite } from "~/store/favorites/favorites-actions";
 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, ProvenanceGraphIcon, AdvancedIcon, RemoveIcon } from "~/components/icon/icon";
 import { openUpdater } from "~/store/collections/updater/collection-updater-action";
 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
-import { openMakeACopyDialog } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog";
+import { openProjectCopyDialog } from "~/views-components/project-copy-dialog/project-copy-dialog";
 import { openMoveToDialog } from "../../move-to-dialog/move-to-dialog";
 
 export const collectionActionSet: ContextMenuActionSet = [[
@@ -43,7 +43,7 @@ export const collectionActionSet: ContextMenuActionSet = [[
         icon: CopyIcon,
         name: "Copy to project",
         execute: (dispatch, resource) => {
-            dispatch<any>(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid}));
+            dispatch<any>(openProjectCopyDialog({name: resource.name, projectUuid: resource.uuid}));
         }
     },
     {
index cf05aeea98c275f1bc62cc67fc1269567aa65df2..f988ee2b0cc570406d2ab614798980f9a0dbd64d 100644 (file)
@@ -8,7 +8,7 @@ import { toggleFavorite } from "~/store/favorites/favorites-actions";
 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "~/components/icon/icon";
 import { openUpdater } from "~/store/collections/updater/collection-updater-action";
 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
-import { openMakeACopyDialog } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog";
+import { openProjectCopyDialog } from "~/views-components/project-copy-dialog/project-copy-dialog";
 import { openMoveToDialog } from '../../move-to-dialog/move-to-dialog';
 
 export const collectionResourceActionSet: ContextMenuActionSet = [[
@@ -43,7 +43,7 @@ export const collectionResourceActionSet: ContextMenuActionSet = [[
         icon: CopyIcon,
         name: "Copy to project",
         execute: (dispatch, resource) => {
-            dispatch<any>(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid}));
+            dispatch<any>(openProjectCopyDialog({name: resource.name, projectUuid: resource.uuid}));
         },
     },
     {
index f7fc4f5b8b800502434628375e72d0890144098a..e5db66db3ade1b81e96ba64f422c5631abf5b7d9 100644 (file)
@@ -12,7 +12,7 @@ import { toggleFavorite } from "~/store/favorites/favorites-actions";
 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
 import { openMoveToDialog } from "../../move-to-dialog/move-to-dialog";
 import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create";
-import { openMakeACopyDialog } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog";
+import { openProjectCopyDialog } from "~/views-components/project-copy-dialog/project-copy-dialog";
 
 export const projectActionSet: ContextMenuActionSet = [[
     {
@@ -48,7 +48,7 @@ export const projectActionSet: ContextMenuActionSet = [[
         icon: CopyIcon,
         name: "Copy to project",
         execute: (dispatch, resource) => {
-            dispatch<any>(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid}));
+            dispatch<any>(openProjectCopyDialog({name: resource.name, projectUuid: resource.uuid}));
         }
     }
 ]];
diff --git a/src/views-components/make-a-copy-dialog/make-a-copy-dialog.tsx b/src/views-components/make-a-copy-dialog/make-a-copy-dialog.tsx
deleted file mode 100644 (file)
index 8dd19d9..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-import { Dispatch, compose } from "redux";
-import { withDialog } from "../../store/dialog/with-dialog";
-import { dialogActions } from "../../store/dialog/dialog-actions";
-import { MakeACopyDialog, CopyFormData } from "../../components/make-a-copy/make-a-copy";
-import { reduxForm, startSubmit, stopSubmit, initialize } from 'redux-form';
-import { resetPickerProjectTree } from "~/store/project-tree-picker/project-tree-picker-actions";
-
-export const MAKE_A_COPY_DIALOG = 'makeACopyDialog';
-export const openMakeACopyDialog = (data: {projectUuid: string, name: string}) =>
-    (dispatch: Dispatch) => {
-        dispatch<any>(resetPickerProjectTree());
-        const initialData: CopyFormData = {name: "Copy of: " + data.name, projectUuid: '', uuid: data.projectUuid};
-        dispatch<any>(initialize(MAKE_A_COPY_DIALOG, initialData));
-        dispatch(dialogActions.OPEN_DIALOG({ id: MAKE_A_COPY_DIALOG, data: {} }));
-    };
-export const MakeACopyToProjectDialog = compose(
-    withDialog(MAKE_A_COPY_DIALOG),
-    reduxForm({
-        form: MAKE_A_COPY_DIALOG,
-        onSubmit: (data, dispatch) => {
-            dispatch(startSubmit(MAKE_A_COPY_DIALOG));
-            setTimeout(() => dispatch(stopSubmit(MAKE_A_COPY_DIALOG, { name: 'Invalid path' })), 2000);
-        }
-    })
-)(MakeACopyDialog);
\ No newline at end of file
diff --git a/src/views-components/project-copy-dialog/project-copy-dialog.tsx b/src/views-components/project-copy-dialog/project-copy-dialog.tsx
new file mode 100644 (file)
index 0000000..489e4f5
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+import { Dispatch, compose } from "redux";
+import { withDialog } from "../../store/dialog/with-dialog";
+import { dialogActions } from "../../store/dialog/dialog-actions";
+import { ProjectCopy, CopyFormData } from "../../components/project-copy/project-copy";
+import { reduxForm, startSubmit, stopSubmit, initialize } from 'redux-form';
+import { resetPickerProjectTree } from "~/store/project-tree-picker/project-tree-picker-actions";
+
+export const PROJECT_COPY_DIALOG = 'projectCopy';
+export const openProjectCopyDialog = (data: { projectUuid: string, name: string }) =>
+    (dispatch: Dispatch) => {
+        dispatch<any>(resetPickerProjectTree());
+        const initialData: CopyFormData = { name: `Copy of: ${data.name}`, projectUuid: '', uuid: data.projectUuid };
+        dispatch<any>(initialize(PROJECT_COPY_DIALOG, initialData));
+        dispatch(dialogActions.OPEN_DIALOG({ id: PROJECT_COPY_DIALOG, data: {} }));
+    };
+
+export const ProjectCopyDialog = compose(
+    withDialog(PROJECT_COPY_DIALOG),
+    reduxForm({
+        form: PROJECT_COPY_DIALOG,
+        onSubmit: (data, dispatch) => {
+            dispatch(startSubmit(PROJECT_COPY_DIALOG));
+            setTimeout(() => dispatch(stopSubmit(PROJECT_COPY_DIALOG, { name: 'Invalid path' })), 2000);
+        }
+    })
+)(ProjectCopy);
\ No newline at end of file
index d84119e2b0c725715175fe1f6cd35b1367c9587f..f5f62a284553e44e2f48a6ce1e41636b9348edee 100644 (file)
@@ -51,7 +51,7 @@ import { MoveToProjectDialog } from '../../views-components/move-to-dialog/move-
 import { COLLECTION_CREATE_DIALOG } from '~/views-components/dialog-create/dialog-collection-create';
 import { PROJECT_CREATE_DIALOG } from '~/views-components/dialog-create/dialog-project-create';
 import { UploadCollectionFilesDialog } from '~/views-components/upload-collection-files-dialog/upload-collection-files-dialog';
-import { MakeACopyToProjectDialog } from '~/views-components/make-a-copy-dialog/make-a-copy-dialog';
+import { ProjectCopyDialog } from '~/views-components/project-copy-dialog/project-copy-dialog';
 import { CollectionPartialCopyDialog } from '../../views-components/collection-partial-copy-dialog/collection-partial-copy-dialog';
 
 const DRAWER_WITDH = 240;
@@ -250,7 +250,7 @@ export const Workbench = withStyles(styles)(
                         <MoveToProjectDialog />
                         <DialogCollectionCreateWithSelectedFile />
                         <FileRemoveDialog />
-                        <MakeACopyToProjectDialog />
+                        <ProjectCopyDialog />
                         <MultipleFilesRemoveDialog />
                         <UpdateCollectionDialog />
                         <UploadCollectionFilesDialog />