[ARVADOS-WORKBENCH2] created: 1.2.0-182-gdbde3a8

Git user git at public.curoverse.com
Tue Aug 28 08:10:34 EDT 2018


        at  dbde3a8cc8098e423fb7d7f7147ea8a664744957 (commit)


commit dbde3a8cc8098e423fb7d7f7147ea8a664744957
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date:   Tue Aug 28 14:10:20 2018 +0200

    rename and change path for collection partial copy
    
    Feature #13860
    
    Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>

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 01b4fe4..96ff17c 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
@@ -86,7 +86,7 @@ export const openMultipleFilesRemoveDialog = () =>
         }
     });
 
-export const COLLECTION_PARTIAL_COPY = 'COLLECTION_PARTIAL_COPY';
+export const COLLECTION_PARTIAL_COPY_FORM_NAME = 'collectionPartialCopyFormName';
 
 export interface CollectionPartialCopyFormData {
     name: string;
@@ -103,15 +103,16 @@ export const openCollectionPartialCopyDialog = () =>
                 description: currentCollection.description,
                 projectUuid: ''
             };
-            dispatch(initialize(COLLECTION_PARTIAL_COPY, initialData));
+            dispatch(initialize(COLLECTION_PARTIAL_COPY_FORM_NAME, initialData));
             dispatch<any>(resetPickerProjectTree());
-            dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY, data: {} }));
+            dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY_FORM_NAME, data: {} }));
         }
     };
 
-export const doCollectionPartialCopy = ({ name, description, projectUuid }: CollectionPartialCopyFormData) =>
+
+export const copyCollectionPartial = ({ name, description, projectUuid }: CollectionPartialCopyFormData) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        dispatch(startSubmit(COLLECTION_PARTIAL_COPY));
+        dispatch(startSubmit(COLLECTION_PARTIAL_COPY_FORM_NAME));
         const state = getState();
         const currentCollection = state.collectionPanel.item;
         if (currentCollection) {
@@ -127,17 +128,17 @@ export const doCollectionPartialCopy = ({ name, description, projectUuid }: Coll
                 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(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_FORM_NAME }));
                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'New collection created.', hideDuration: 2000 }));
             } catch (e) {
                 const error = getCommonResourceServiceError(e);
                 if (error === CommonResourceServiceError.UNIQUE_VIOLATION) {
-                    dispatch(stopSubmit(COLLECTION_PARTIAL_COPY, { name: 'Collection with this name already exists.' }));
+                    dispatch(stopSubmit(COLLECTION_PARTIAL_COPY_FORM_NAME, { name: 'Collection with this name already exists.' }));
                 } else if (error === CommonResourceServiceError.UNKNOWN) {
-                    dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY }));
+                    dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_FORM_NAME }));
                     dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not create a copy of collection', hideDuration: 2000 }));
                 } else {
-                    dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY }));
+                    dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_FORM_NAME }));
                     dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Collection has been copied but may contain incorrect files.', hideDuration: 2000 }));
                 }
             }
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
deleted file mode 100644
index 86fc360..0000000
--- a/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import * as React from "react";
-import { compose } from "redux";
-import { reduxForm, InjectedFormProps } from 'redux-form';
-import { withDialog, WithDialogProps } from '~/store/dialog/with-dialog';
-import { COLLECTION_PARTIAL_COPY, doCollectionPartialCopy, CollectionPartialCopyFormData } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
-import { CollectionPartialCopyFields } from '~/views-components/form-fields/collection-form-fields';
-import { FormDialog } from '~/components/form-dialog/form-dialog';
-
-export const CollectionPartialCopyDialog = compose(
-    withDialog(COLLECTION_PARTIAL_COPY),
-    reduxForm({
-        form: COLLECTION_PARTIAL_COPY,
-        onSubmit: (data: CollectionPartialCopyFormData, dispatch) => {
-            dispatch(doCollectionPartialCopy(data));
-        }
-    }))((props: WithDialogProps<string> & InjectedFormProps<CollectionPartialCopyFormData>) =>
-        <FormDialog
-            dialogTitle='Create a collection'
-            formFields={CollectionPartialCopyFields}
-            submitLabel='Create a collection'
-            {...props}
-        />);
diff --git a/src/views-components/dialog-copy/dialog-collection-partial-copy.tsx b/src/views-components/dialog-copy/dialog-collection-partial-copy.tsx
new file mode 100644
index 0000000..1975ea7
--- /dev/null
+++ b/src/views-components/dialog-copy/dialog-collection-partial-copy.tsx
@@ -0,0 +1,20 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { InjectedFormProps, Field } from 'redux-form';
+import { WithDialogProps } from '~/store/dialog/with-dialog';
+import { CollectionPartialCopyFormData } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { CollectionPartialCopyFields } from '~/views-components/form-fields/collection-form-fields';
+
+type CopyFormDialogProps = WithDialogProps<string> & InjectedFormProps<CollectionPartialCopyFormData>;
+
+export const DialogCollectionPartialCopy = (props: CopyFormDialogProps) =>
+    <FormDialog
+        dialogTitle='Create a collection'
+        formFields={CollectionPartialCopyFields}
+        submitLabel='Create a collection'
+        {...props}
+    />;
\ No newline at end of file
diff --git a/src/views-components/dialog-forms/copy-collection-partial-dialog.ts b/src/views-components/dialog-forms/copy-collection-partial-dialog.ts
new file mode 100644
index 0000000..9b9298a
--- /dev/null
+++ b/src/views-components/dialog-forms/copy-collection-partial-dialog.ts
@@ -0,0 +1,19 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { compose } from "redux";
+import { reduxForm } from 'redux-form';
+import { withDialog } from '~/store/dialog/with-dialog';
+import { COLLECTION_PARTIAL_COPY_FORM_NAME, copyCollectionPartial, CollectionPartialCopyFormData } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
+import { DialogCollectionPartialCopy } from '~/views-components/dialog-copy/dialog-collection-partial-copy';
+
+export const CopyCollectionPartialDialog = compose(
+    withDialog(COLLECTION_PARTIAL_COPY_FORM_NAME),
+    reduxForm<CollectionPartialCopyFormData>({
+        form: COLLECTION_PARTIAL_COPY_FORM_NAME,
+        onSubmit: (data, dispatch) => {
+            dispatch(copyCollectionPartial(data));
+        }
+    })
+)(DialogCollectionPartialCopy);
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 27470fa..a3c4d2f 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -25,7 +25,7 @@ import { RenameFileDialog } from '~/views-components/rename-file-dialog/rename-f
 import { FileRemoveDialog } from '~/views-components/file-remove-dialog/file-remove-dialog';
 import { MultipleFilesRemoveDialog } from '~/views-components/file-remove-dialog/multiple-files-remove-dialog';
 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';
+import { CopyCollectionPartialDialog } from '~/views-components/dialog-forms/copy-collection-partial-dialog';
 import { SidePanel } from '~/views-components/side-panel/side-panel';
 import { Routes } from '~/routes/routes';
 import { Breadcrumbs } from '~/views-components/breadcrumbs/breadcrumbs';
@@ -175,9 +175,9 @@ export const Workbench = withStyles(styles)(
                         <CreateProjectDialog />
                         <CreateCollectionDialog />
                         <RenameFileDialog />
-                        <CollectionPartialCopyDialog />
-                        <FileRemoveDialog />
                         <CopyCollectionDialog />
+                        <CopyCollectionPartialDialog />
+                        <FileRemoveDialog />
                         <MultipleFilesRemoveDialog />
                         <UpdateCollectionDialog />
                         <UploadCollectionFilesDialog />

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list