[ARVADOS-WORKBENCH2] updated: 1.1.4-639-g8fb7517

Git user git at public.curoverse.com
Sat Aug 18 02:56:16 EDT 2018


Summary of changes:
 .../collection-service/collection-service.ts       |  6 +-
 .../collection-panel-files-actions.ts              | 74 +++++++++++++++++-----
 .../collection-panel-files-reducer.ts              |  2 +-
 .../collection-panel-files-state.ts                | 14 +++-
 .../creator/collection-creator-action.ts           |  3 +-
 .../collection-partial-copy-dialog.tsx             | 26 ++++++++
 .../action-sets/collection-files-action-set.ts     |  5 +-
 .../create-collection-dialog-with-selected.tsx     | 30 ---------
 .../dialog-collection-create-selected.tsx          | 43 -------------
 .../form-dialog/collection-form-dialog.tsx         | 42 ++++++++++++
 src/views/workbench/workbench.tsx                  |  4 +-
 11 files changed, 149 insertions(+), 100 deletions(-)
 create mode 100644 src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
 delete mode 100644 src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx
 delete mode 100644 src/views-components/dialog-create/dialog-collection-create-selected.tsx
 create mode 100644 src/views-components/form-dialog/collection-form-dialog.tsx

       via  8fb7517405c53a71782863fcb5863f9b5a948964 (commit)
       via  0b94fe12e8705098542008753ce5a5caa12a4218 (commit)
      from  c4c906cb232d8974858e4da2393fb7a83a24fbd0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 8fb7517405c53a71782863fcb5863f9b5a948964
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Sat Aug 18 08:55:58 2018 +0200

    Implement collection partial copying
    
    Feature #14014
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/services/collection-service/collection-service.ts b/src/services/collection-service/collection-service.ts
index b154f40..671a1e1 100644
--- a/src/services/collection-service/collection-service.ts
+++ b/src/services/collection-service/collection-service.ts
@@ -28,8 +28,10 @@ export class CollectionService extends CommonResourceService<CollectionResource>
         return Promise.reject();
     }
 
-    async deleteFile(collectionUuid: string, filePath: string) {
-        return this.webdavClient.delete(`/c=${collectionUuid}${filePath}`);
+    async deleteFiles(collectionUuid: string, filePaths: string[]) {
+        for (const path of filePaths) {
+            await this.webdavClient.delete(`/c=${collectionUuid}${path}`);
+        }
     }
 
     async uploadFiles(collectionUuid: string, files: File[], onProgress?: UploadProgress) {
diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
index cedfbeb..114446a 100644
--- a/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
+++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
@@ -8,9 +8,11 @@ import { CollectionFilesTree, CollectionFileType } from "~/models/collection-fil
 import { ServiceRepository } from "~/services/services";
 import { RootState } from "../../store";
 import { snackbarActions } from "../../snackbar/snackbar-actions";
-import { dialogActions } from "../../dialog/dialog-actions";
-import { getNodeValue, getNodeDescendants } from "~/models/tree";
-import { CollectionPanelDirectory, CollectionPanelFile } from "./collection-panel-files-state";
+import { dialogActions } from '../../dialog/dialog-actions';
+import { getNodeValue } from "~/models/tree";
+import { filterCollectionFilesBySelection } from './collection-panel-files-state';
+import { startSubmit, initialize } from 'redux-form';
+import { loadProjectTreePickerProjects } from '../../../views-components/project-tree-picker/project-tree-picker';
 
 export const collectionPanelFilesAction = unionize({
     SET_COLLECTION_FILES: ofType<CollectionFilesTree>(),
@@ -30,30 +32,23 @@ export const loadCollectionFiles = (uuid: string) =>
 
 export const removeCollectionFiles = (filePaths: string[]) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        const { item } = getState().collectionPanel;
-        if (item) {
+        const currentCollection = getState().collectionPanel.item;
+        if (currentCollection) {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
-            const promises = filePaths.map(filePath => services.collectionService.deleteFile(item.uuid, filePath));
-            await Promise.all(promises);
-            dispatch<any>(loadCollectionFiles(item.uuid));
+            await services.collectionService.deleteFiles(currentCollection.uuid, filePaths);
+            dispatch<any>(loadCollectionFiles(currentCollection.uuid));
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000 }));
         }
     };
 
 export const removeCollectionsSelectedFiles = () =>
     (dispatch: Dispatch, getState: () => RootState) => {
-        const tree = getState().collectionPanelFiles;
-        const allFiles = getNodeDescendants('')(tree)
-            .map(id => getNodeValue(id)(tree))
-            .filter(file => file !== undefined) as Array<CollectionPanelDirectory | CollectionPanelFile>;
-
-        const selectedDirectories = allFiles.filter(file => file.selected && file.type === CollectionFileType.DIRECTORY);
-        const selectedFiles = allFiles.filter(file => file.selected && !selectedDirectories.some(dir => dir.id === file.path));
-        const paths = [...selectedDirectories, ...selectedFiles].map(file => file.id);
+        const paths = filterCollectionFilesBySelection(getState().collectionPanelFiles, true).map(file => file.id);
         dispatch<any>(removeCollectionFiles(paths));
     };
 
 export const FILE_REMOVE_DIALOG = 'fileRemoveDialog';
+
 export const openFileRemoveDialog = (filePath: string) =>
     (dispatch: Dispatch, getState: () => RootState) => {
         const file = getNodeValue(filePath)(getState().collectionPanelFiles);
@@ -78,6 +73,7 @@ export const openFileRemoveDialog = (filePath: string) =>
     };
 
 export const MULTIPLE_FILES_REMOVE_DIALOG = 'multipleFilesRemoveDialog';
+
 export const openMultipleFilesRemoveDialog = () =>
     dialogActions.OPEN_DIALOG({
         id: MULTIPLE_FILES_REMOVE_DIALOG,
@@ -87,3 +83,49 @@ export const openMultipleFilesRemoveDialog = () =>
             confirmButtonLabel: 'Remove'
         }
     });
+
+export const COLLECTION_PARTIAL_COPY = 'COLLECTION_PARTIAL_COPY';
+
+export interface CollectionPartialCopyFormData {
+    name: string;
+    description: string;
+    projectUuid: string;
+}
+
+export const openCollectionPartialCopyDialog = () =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        const currentCollection = getState().collectionPanel.item;
+        if (currentCollection) {
+            const initialData = {
+                name: currentCollection.name,
+                description: currentCollection.description,
+                projectUuid: ''
+            };
+            dispatch(initialize(COLLECTION_PARTIAL_COPY, initialData));
+            dispatch<any>(loadProjectTreePickerProjects(''));
+            dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY, data: {} }));
+        }
+    };
+
+export const doCollectionPartialCopy = ({ name, description, projectUuid }: CollectionPartialCopyFormData) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(startSubmit(COLLECTION_PARTIAL_COPY));
+        const state = getState();
+        const currentCollection = state.collectionPanel.item;
+        if (currentCollection) {
+            const collection = await services.collectionService.get(currentCollection.uuid);
+            const collectionCopy = {
+                ...collection,
+                name,
+                description,
+                ownerUuid: projectUuid,
+                uuid: undefined
+            };
+            const newCollection = await services.collectionService.create(collectionCopy);
+            const paths = filterCollectionFilesBySelection(state.collectionPanelFiles, false).map(file => file.id);
+            await services.collectionService.deleteFiles(newCollection.uuid, paths);
+            dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY }));
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'New collection created.', hideDuration: 2000 }));
+        }
+    };
+
diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts
index 08b6030..a34fc21 100644
--- a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts
+++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { CollectionPanelFilesState, CollectionPanelFile, CollectionPanelDirectory, mapCollectionFileToCollectionPanelFile, mergeCollectionPanelFilesStates } from "./collection-panel-files-state";
+import { CollectionPanelFilesState, CollectionPanelFile, CollectionPanelDirectory, mapCollectionFileToCollectionPanelFile, mergeCollectionPanelFilesStates } from './collection-panel-files-state';
 import { CollectionPanelFilesAction, collectionPanelFilesAction } from "./collection-panel-files-actions";
 import { createTree, mapTreeValues, getNode, setNode, getNodeAncestors, getNodeDescendants, setNodeValueWith, mapTree } from "~/models/tree";
 import { CollectionFileType } from "~/models/collection-file";
diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
index 35b81d2..8c5ebd7 100644
--- a/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
+++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-state.ts
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { Tree, TreeNode, mapTreeValues, getNodeValue } from '~/models/tree';
+import { Tree, TreeNode, mapTreeValues, getNodeValue, getNodeDescendants } from '~/models/tree';
 import { CollectionFile, CollectionDirectory, CollectionFileType } from '~/models/collection-file';
 
 export type CollectionPanelFilesState = Tree<CollectionPanelDirectory | CollectionPanelFile>;
@@ -34,4 +34,14 @@ export const mergeCollectionPanelFilesStates = (oldState: CollectionPanelFilesSt
                 : { ...value, selected: oldValue.selected }
             : value;
     })(newState);
-}; 
+};
+
+export const filterCollectionFilesBySelection = (tree: CollectionPanelFilesState, selected: boolean) => {
+    const allFiles = getNodeDescendants('')(tree)
+        .map(id => getNodeValue(id)(tree))
+        .filter(file => file !== undefined) as Array<CollectionPanelDirectory | CollectionPanelFile>;
+
+    const selectedDirectories = allFiles.filter(file => file.selected === selected && file.type === CollectionFileType.DIRECTORY);
+    const selectedFiles = allFiles.filter(file => file.selected === selected && !selectedDirectories.some(dir => dir.id === file.path));
+    return [...selectedDirectories, ...selectedFiles];
+};
diff --git a/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx b/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
index 0105ad2..e230470 100644
--- a/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
+++ b/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
@@ -2,29 +2,25 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { Dispatch, compose } from "redux";
-import { reduxForm, reset, startSubmit, stopSubmit } from "redux-form";
-import { withDialog } from "~/store/dialog/with-dialog";
-import { dialogActions } from "~/store/dialog/dialog-actions";
-import { loadProjectTreePickerProjects } from "../project-tree-picker/project-tree-picker";
-import { CollectionPartialCopyFormDialog } from "~/views-components/form-dialog/collection-form-dialog";
-
-export const COLLECTION_PARTIAL_COPY = 'COLLECTION_PARTIAL_COPY';
-
-export const openCollectionPartialCopyDialog = () =>
-    (dispatch: Dispatch) => {
-        dispatch(reset(COLLECTION_PARTIAL_COPY));
-        dispatch<any>(loadProjectTreePickerProjects(''));
-        dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY, data: {} }));
-    };
-
+import * as React from "react";
+import { compose } from "redux";
+import { reduxForm, InjectedFormProps } from 'redux-form';
+import { withDialog, WithDialogProps } from '~/store/dialog/with-dialog';
+import { CollectionPartialCopyFields } from '../form-dialog/collection-form-dialog';
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { COLLECTION_PARTIAL_COPY, doCollectionPartialCopy, CollectionPartialCopyFormData } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
 
 export const CollectionPartialCopyDialog = compose(
     withDialog(COLLECTION_PARTIAL_COPY),
     reduxForm({
         form: COLLECTION_PARTIAL_COPY,
-        onSubmit: (data, dispatch) => {
-            dispatch(startSubmit(COLLECTION_PARTIAL_COPY));
-            setTimeout(() => dispatch(stopSubmit(COLLECTION_PARTIAL_COPY, { name: 'Invalid name' })), 2000);
+        onSubmit: (data: CollectionPartialCopyFormData, dispatch) => {
+            dispatch(doCollectionPartialCopy(data));
         }
-    }))(CollectionPartialCopyFormDialog);
+    }))((props: WithDialogProps<string> & InjectedFormProps<CollectionPartialCopyFormData>) =>
+        <FormDialog
+            dialogTitle='Create a collection'
+            formFields={CollectionPartialCopyFields}
+            submitLabel='Create a collection'
+            {...props}
+        />);
diff --git a/src/views-components/context-menu/action-sets/collection-files-action-set.ts b/src/views-components/context-menu/action-sets/collection-files-action-set.ts
index 69815ef..965109c 100644
--- a/src/views-components/context-menu/action-sets/collection-files-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-files-action-set.ts
@@ -4,8 +4,7 @@
 
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { collectionPanelFilesAction, openMultipleFilesRemoveDialog } from "~/store/collection-panel/collection-panel-files/collection-panel-files-actions";
-import { openCollectionPartialCopyDialog } from "~/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog";
-
+import { openCollectionPartialCopyDialog } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
 
 export const collectionFilesActionSet: ContextMenuActionSet = [[{
     name: "Select all",
diff --git a/src/views-components/form-dialog/collection-form-dialog.tsx b/src/views-components/form-dialog/collection-form-dialog.tsx
index 937558c..d5f1d85 100644
--- a/src/views-components/form-dialog/collection-form-dialog.tsx
+++ b/src/views-components/form-dialog/collection-form-dialog.tsx
@@ -3,20 +3,10 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { InjectedFormProps, Field, WrappedFieldProps } from "redux-form";
-import { WithDialogProps } from "~/store/dialog/with-dialog";
+import { Field, WrappedFieldProps } from "redux-form";
 import { TextField } from "~/components/text-field/text-field";
 import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION } from "~/validators/validators";
 import { ProjectTreePicker } from "../project-tree-picker/project-tree-picker";
-import { FormDialog } from '../../components/form-dialog/form-dialog';
-
-export const CollectionPartialCopyFormDialog = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
-    <FormDialog
-        dialogTitle='Create a collection'
-        formFields={CollectionPartialCopyFields}
-        submitLabel='Create a collection'
-        {...props}
-    />;
 
 export const CollectionPartialCopyFields = () => <div style={{ display: 'flex' }}>
     <div>

commit 0b94fe12e8705098542008753ce5a5caa12a4218
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Sat Aug 18 07:29:08 2018 +0200

    Extract collection form components
    
    Feature #14014
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/collections/creator/collection-creator-action.ts b/src/store/collections/creator/collection-creator-action.ts
index 5243a61..8c35ffa 100644
--- a/src/store/collections/creator/collection-creator-action.ts
+++ b/src/store/collections/creator/collection-creator-action.ts
@@ -21,6 +21,8 @@ export const collectionCreateActions = unionize({
         value: 'payload'
     });
 
+export type CollectionCreateAction = UnionOf<typeof collectionCreateActions>;
+
 export const createCollection = (collection: Partial<CollectionResource>, files: File[]) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const { ownerUuid } = getState().collections.creator;
@@ -33,4 +35,3 @@ export const createCollection = (collection: Partial<CollectionResource>, files:
         return newCollection;
     };
 
-export type CollectionCreateAction = UnionOf<typeof collectionCreateActions>;
diff --git a/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx b/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
new file mode 100644
index 0000000..0105ad2
--- /dev/null
+++ b/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
@@ -0,0 +1,30 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch, compose } from "redux";
+import { reduxForm, reset, startSubmit, stopSubmit } from "redux-form";
+import { withDialog } from "~/store/dialog/with-dialog";
+import { dialogActions } from "~/store/dialog/dialog-actions";
+import { loadProjectTreePickerProjects } from "../project-tree-picker/project-tree-picker";
+import { CollectionPartialCopyFormDialog } from "~/views-components/form-dialog/collection-form-dialog";
+
+export const COLLECTION_PARTIAL_COPY = 'COLLECTION_PARTIAL_COPY';
+
+export const openCollectionPartialCopyDialog = () =>
+    (dispatch: Dispatch) => {
+        dispatch(reset(COLLECTION_PARTIAL_COPY));
+        dispatch<any>(loadProjectTreePickerProjects(''));
+        dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY, data: {} }));
+    };
+
+
+export const CollectionPartialCopyDialog = compose(
+    withDialog(COLLECTION_PARTIAL_COPY),
+    reduxForm({
+        form: COLLECTION_PARTIAL_COPY,
+        onSubmit: (data, dispatch) => {
+            dispatch(startSubmit(COLLECTION_PARTIAL_COPY));
+            setTimeout(() => dispatch(stopSubmit(COLLECTION_PARTIAL_COPY, { name: 'Invalid name' })), 2000);
+        }
+    }))(CollectionPartialCopyFormDialog);
diff --git a/src/views-components/context-menu/action-sets/collection-files-action-set.ts b/src/views-components/context-menu/action-sets/collection-files-action-set.ts
index 653da01..69815ef 100644
--- a/src/views-components/context-menu/action-sets/collection-files-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-files-action-set.ts
@@ -4,7 +4,7 @@
 
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { collectionPanelFilesAction, openMultipleFilesRemoveDialog } from "~/store/collection-panel/collection-panel-files/collection-panel-files-actions";
-import { createCollectionWithSelected } from "~/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected";
+import { openCollectionPartialCopyDialog } from "~/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog";
 
 
 export const collectionFilesActionSet: ContextMenuActionSet = [[{
@@ -30,6 +30,6 @@ export const collectionFilesActionSet: ContextMenuActionSet = [[{
 }, {
     name: "Create a new collection with selected",
     execute: (dispatch) => {
-        dispatch<any>(createCollectionWithSelected());
+        dispatch<any>(openCollectionPartialCopyDialog());
     }
 }]];
diff --git a/src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx b/src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx
deleted file mode 100644
index 5346402..0000000
--- a/src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { Dispatch, compose } from "redux";
-import { reduxForm, reset, startSubmit, stopSubmit } from "redux-form";
-import { withDialog } from "~/store/dialog/with-dialog";
-import { dialogActions } from "~/store/dialog/dialog-actions";
-import { DialogCollectionCreateWithSelected } from "../dialog-create/dialog-collection-create-selected";
-import { loadProjectTreePickerProjects } from "../project-tree-picker/project-tree-picker";
-
-export const DIALOG_COLLECTION_CREATE_WITH_SELECTED = 'dialogCollectionCreateWithSelected';
-
-export const createCollectionWithSelected = () =>
-    (dispatch: Dispatch) => {
-        dispatch(reset(DIALOG_COLLECTION_CREATE_WITH_SELECTED));
-        dispatch<any>(loadProjectTreePickerProjects(''));
-        dispatch(dialogActions.OPEN_DIALOG({ id: DIALOG_COLLECTION_CREATE_WITH_SELECTED, data: {} }));
-    };
-
-
-export const DialogCollectionCreateWithSelectedFile = compose(
-    withDialog(DIALOG_COLLECTION_CREATE_WITH_SELECTED),
-    reduxForm({
-        form: DIALOG_COLLECTION_CREATE_WITH_SELECTED,
-        onSubmit: (data, dispatch) => {
-            dispatch(startSubmit(DIALOG_COLLECTION_CREATE_WITH_SELECTED));
-            setTimeout(() => dispatch(stopSubmit(DIALOG_COLLECTION_CREATE_WITH_SELECTED, { name: 'Invalid name' })), 2000);
-        }
-    }))(DialogCollectionCreateWithSelected);
diff --git a/src/views-components/dialog-create/dialog-collection-create-selected.tsx b/src/views-components/form-dialog/collection-form-dialog.tsx
similarity index 51%
rename from src/views-components/dialog-create/dialog-collection-create-selected.tsx
rename to src/views-components/form-dialog/collection-form-dialog.tsx
index 7083747..937558c 100644
--- a/src/views-components/dialog-create/dialog-collection-create-selected.tsx
+++ b/src/views-components/form-dialog/collection-form-dialog.tsx
@@ -10,34 +10,43 @@ import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION, COLLECTI
 import { ProjectTreePicker } from "../project-tree-picker/project-tree-picker";
 import { FormDialog } from '../../components/form-dialog/form-dialog';
 
-export const DialogCollectionCreateWithSelected = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
+export const CollectionPartialCopyFormDialog = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
     <FormDialog
         dialogTitle='Create a collection'
-        formFields={FormFields}
+        formFields={CollectionPartialCopyFields}
         submitLabel='Create a collection'
         {...props}
     />;
 
-const FormFields = () => <div style={{ display: 'flex' }}>
+export const CollectionPartialCopyFields = () => <div style={{ display: 'flex' }}>
     <div>
-        <Field
-            name='name'
-            component={TextField}
-            validate={COLLECTION_NAME_VALIDATION}
-            label="Collection Name" />
-        <Field
-            name='description'
-            component={TextField}
-            validate={COLLECTION_DESCRIPTION_VALIDATION}
-            label="Description - optional" />
+        <CollectionNameField />
+        <CollectionDescriptionField />
     </div>
+    <CollectionProjectPickerField />
+</div>;
+
+export const CollectionNameField = () =>
+    <Field
+        name='name'
+        component={TextField}
+        validate={COLLECTION_NAME_VALIDATION}
+        label="Collection Name" />;
+
+export const CollectionDescriptionField = () =>
+    <Field
+        name='description'
+        component={TextField}
+        validate={COLLECTION_DESCRIPTION_VALIDATION}
+        label="Description - optional" />;
+
+export const CollectionProjectPickerField = () =>
     <Field
         name="projectUuid"
-        component={Picker}
-        validate={COLLECTION_PROJECT_VALIDATION} />
-</div>;
+        component={ProjectPicker}
+        validate={COLLECTION_PROJECT_VALIDATION} />;
 
-const Picker = (props: WrappedFieldProps) =>
+const ProjectPicker = (props: WrappedFieldProps) =>
     <div style={{ width: '400px', height: '144px', display: 'flex', flexDirection: 'column' }}>
         <ProjectTreePicker onChange={projectUuid => props.input.onChange(projectUuid)} />
     </div>;
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 01a92ab..71e5a03 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -47,10 +47,10 @@ import { AuthService } from "~/services/auth-service/auth-service";
 import { RenameFileDialog } from '~/views-components/rename-file-dialog/rename-file-dialog';
 import { FileRemoveDialog } from '~/views-components/file-remove-dialog/file-remove-dialog';
 import { MultipleFilesRemoveDialog } from '~/views-components/file-remove-dialog/multiple-files-remove-dialog';
-import { DialogCollectionCreateWithSelectedFile } from '~/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected';
 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 { CollectionPartialCopyDialog } from '../../views-components/collection-partial-copy-dialog/collection-partial-copy-dialog';
 
 const DRAWER_WITDH = 240;
 const APP_BAR_HEIGHT = 100;
@@ -243,7 +243,7 @@ export const Workbench = withStyles(styles)(
                         <CreateProjectDialog />
                         <CreateCollectionDialog />
                         <RenameFileDialog />
-                        <DialogCollectionCreateWithSelectedFile />
+                        <CollectionPartialCopyDialog />
                         <FileRemoveDialog />
                         <MultipleFilesRemoveDialog />
                         <UpdateCollectionDialog />

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list