[ARVADOS-WORKBENCH2] updated: 1.2.0-178-g6a024c9

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


Summary of changes:
 .../collection-panel/collection-panel-action.ts    |  1 +
 src/store/collections/collection-upload-actions.ts | 13 +++++-----
 .../dialog-forms/collection-files-upload-dialog.ts | 20 +++++++++++++++
 .../dialog-forms/create-collection-dialog.ts       |  2 --
 .../collection-files-upload-dialog.tsx}            | 20 ++++++---------
 .../upload-collection-files-dialog.ts              | 30 ----------------------
 src/views/workbench/workbench.tsx                  |  4 +--
 7 files changed, 38 insertions(+), 52 deletions(-)
 create mode 100644 src/views-components/dialog-forms/collection-files-upload-dialog.ts
 copy src/views-components/{dialog-create/dialog-collection-create.tsx => dialog-upload/collection-files-upload-dialog.tsx} (51%)
 delete mode 100644 src/views-components/upload-collection-files-dialog/upload-collection-files-dialog.ts

       via  6a024c9a0ad6543bf95359b10bcd22aeec3e7dca (commit)
      from  fb1ecf2421f8aac07d733d3bb56bb39312274f8c (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 6a024c9a0ad6543bf95359b10bcd22aeec3e7dca
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Aug 28 13:26:21 2018 +0200

    Implement upload data dialog as form dialog
    
    Feature #14119
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/collection-panel/collection-panel-action.ts b/src/store/collection-panel/collection-panel-action.ts
index 5b2690b..97b6d49 100644
--- a/src/store/collection-panel/collection-panel-action.ts
+++ b/src/store/collection-panel/collection-panel-action.ts
@@ -34,6 +34,7 @@ export const loadCollectionPanel = (uuid: string) =>
         dispatch(collectionPanelActions.LOAD_COLLECTION({ uuid }));
         dispatch(collectionPanelFilesAction.SET_COLLECTION_FILES({ files: createTree() }));
         const collection = await services.collectionService.get(uuid);
+        dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item: collection }));
         dispatch(resourcesActions.SET_RESOURCES([collection]));
         dispatch<any>(loadCollectionFiles(collection.uuid));
         dispatch<any>(loadCollectionTags(collection.uuid));
diff --git a/src/store/collections/collection-upload-actions.ts b/src/store/collections/collection-upload-actions.ts
index c04ef1a..4a5aff3 100644
--- a/src/store/collections/collection-upload-actions.ts
+++ b/src/store/collections/collection-upload-actions.ts
@@ -9,7 +9,7 @@ import { dialogActions } from '~/store/dialog/dialog-actions';
 import { loadCollectionFiles } from '../collection-panel/collection-panel-files/collection-panel-files-actions';
 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { fileUploaderActions } from '~/store/file-uploader/file-uploader-actions';
-import { reset } from 'redux-form';
+import { reset, startSubmit } from 'redux-form';
 
 export const uploadCollectionFiles = (collectionUuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
@@ -19,18 +19,19 @@ export const uploadCollectionFiles = (collectionUuid: string) =>
         dispatch(fileUploaderActions.CLEAR_UPLOAD());
     };
 
-export const UPLOAD_COLLECTION_FILES_DIALOG = 'uploadCollectionFilesDialog';
+export const COLLECTION_UPLOAD_FILES_DIALOG = 'uploadCollectionFilesDialog';
 
 export const openUploadCollectionFilesDialog = () => (dispatch: Dispatch) => {
-    dispatch(reset(UPLOAD_COLLECTION_FILES_DIALOG));
+    dispatch(reset(COLLECTION_UPLOAD_FILES_DIALOG));
     dispatch(fileUploaderActions.CLEAR_UPLOAD());
-    dispatch<any>(dialogActions.OPEN_DIALOG({ id: UPLOAD_COLLECTION_FILES_DIALOG, data: {} }));
+    dispatch<any>(dialogActions.OPEN_DIALOG({ id: COLLECTION_UPLOAD_FILES_DIALOG, data: {} }));
 };
 
-export const uploadCurrentCollectionFiles = () =>
+export const submitCollectionFiles = () =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const currentCollection = getState().collectionPanel.item;
         if (currentCollection) {
+            dispatch(startSubmit(COLLECTION_UPLOAD_FILES_DIALOG));
             await dispatch<any>(uploadCollectionFiles(currentCollection.uuid));
             dispatch<any>(loadCollectionFiles(currentCollection.uuid));
             dispatch(closeUploadCollectionFilesDialog());
@@ -38,7 +39,7 @@ export const uploadCurrentCollectionFiles = () =>
         }
     };
 
-export const closeUploadCollectionFilesDialog = () => dialogActions.CLOSE_DIALOG({ id: UPLOAD_COLLECTION_FILES_DIALOG });
+export const closeUploadCollectionFilesDialog = () => dialogActions.CLOSE_DIALOG({ id: COLLECTION_UPLOAD_FILES_DIALOG });
 
 const handleUploadProgress = (dispatch: Dispatch) => (fileId: number, loaded: number, total: number, currentTime: number) => {
     dispatch(fileUploaderActions.SET_UPLOAD_PROGRESS({ fileId, loaded, total, currentTime }));
diff --git a/src/views-components/dialog-forms/collection-files-upload-dialog.ts b/src/views-components/dialog-forms/collection-files-upload-dialog.ts
new file mode 100644
index 0000000..b8b1af6
--- /dev/null
+++ b/src/views-components/dialog-forms/collection-files-upload-dialog.ts
@@ -0,0 +1,20 @@
+// 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 { CollectionCreateFormDialogData } from '~/store/collections/collection-create-actions';
+import { COLLECTION_UPLOAD_FILES_DIALOG, submitCollectionFiles } from '~/store/collections/collection-upload-actions';
+import { CollectionFilesUploadDialog as Dialog } from '../dialog-upload/collection-files-upload-dialog';
+
+export const CollectionFilesUploadDialog = compose(
+    withDialog(COLLECTION_UPLOAD_FILES_DIALOG),
+    reduxForm<CollectionCreateFormDialogData>({
+        form: COLLECTION_UPLOAD_FILES_DIALOG,
+        onSubmit: (data, dispatch) => {
+            dispatch(submitCollectionFiles());
+        }
+    })
+)(Dialog);
diff --git a/src/views-components/dialog-forms/create-collection-dialog.ts b/src/views-components/dialog-forms/create-collection-dialog.ts
index 581743e..785be78 100644
--- a/src/views-components/dialog-forms/create-collection-dialog.ts
+++ b/src/views-components/dialog-forms/create-collection-dialog.ts
@@ -18,5 +18,3 @@ export const CreateCollectionDialog = compose(
         }
     })
 )(DialogCollectionCreate);
-
-// onSubmit: (data: { name: string, description: string }, files: UploadFile[]) => void;
\ No newline at end of file
diff --git a/src/views-components/dialog-upload/collection-files-upload-dialog.tsx b/src/views-components/dialog-upload/collection-files-upload-dialog.tsx
new file mode 100644
index 0000000..c2a2061
--- /dev/null
+++ b/src/views-components/dialog-upload/collection-files-upload-dialog.tsx
@@ -0,0 +1,30 @@
+// 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 { CollectionCreateFormDialogData } from '~/store/collections/collection-create-actions';
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { require } from '~/validators/require';
+import { FileUploaderField } from '../file-uploader/file-uploader';
+
+
+type CollectionFilesUploadDialogProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
+
+export const CollectionFilesUploadDialog = (props: CollectionFilesUploadDialogProps) =>
+    <FormDialog
+        dialogTitle='Upload data'
+        formFields={UploadCollectionFilesFields}
+        submitLabel='Upload data'
+        {...props}
+    />;
+
+const UploadCollectionFilesFields = () =>
+    <Field
+        name='files'
+        validate={[require]}
+        component={FileUploaderField} />;
+
+
diff --git a/src/views-components/upload-collection-files-dialog/upload-collection-files-dialog.ts b/src/views-components/upload-collection-files-dialog/upload-collection-files-dialog.ts
deleted file mode 100644
index 52a2e1d..0000000
--- a/src/views-components/upload-collection-files-dialog/upload-collection-files-dialog.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { connect } from "react-redux";
-import { Dispatch, compose } from "redux";
-import { withDialog } from '~/store/dialog/with-dialog';
-import { FilesUploadDialog } from '~/components/file-upload-dialog/file-upload-dialog';
-import { RootState } from '~/store/store';
-import { UPLOAD_COLLECTION_FILES_DIALOG, uploadCurrentCollectionFiles } from '~/store/collections/collection-upload-actions';
-import { fileUploaderActions } from '~/store/file-uploader/file-uploader-actions';
-
-const mapStateToProps = (state: RootState) => ({
-    files: state.fileUploader,
-    uploading: state.fileUploader.some(file => file.loaded < file.total)
-});
-
-const mapDispatchToProps = (dispatch: Dispatch) => ({
-    onSubmit: () => {
-        dispatch<any>(uploadCurrentCollectionFiles());
-    },
-    onChange: (files: File[]) => {
-        dispatch(fileUploaderActions.SET_UPLOAD_FILES(files));
-    }
-});
-
-export const UploadCollectionFilesDialog = compose(
-    withDialog(UPLOAD_COLLECTION_FILES_DIALOG),
-    connect(mapStateToProps, mapDispatchToProps)
-)(FilesUploadDialog);
\ No newline at end of file
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 12010ac..3468ed4 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -24,7 +24,6 @@ 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 { 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 { SidePanel } from '~/views-components/side-panel/side-panel';
 import { Routes } from '~/routes/routes';
@@ -36,6 +35,7 @@ import { UpdateCollectionDialog } from '~/views-components/dialog-forms/update-c
 import { UpdateProjectDialog } from '~/views-components/dialog-forms/update-project-dialog';
 import { MoveProjectDialog } from '~/views-components/dialog-forms/move-project-dialog';
 import { MoveCollectionDialog } from '~/views-components/dialog-forms/move-collection-dialog';
+import { CollectionFilesUploadDialog } from '~/views-components/dialog-forms/collection-files-upload-dialog';
 
 
 const APP_BAR_HEIGHT = 100;
@@ -179,7 +179,7 @@ export const Workbench = withStyles(styles)(
                         <CopyCollectionDialog />
                         <MultipleFilesRemoveDialog />
                         <UpdateCollectionDialog />
-                        <UploadCollectionFilesDialog />
+                        <CollectionFilesUploadDialog />
                         <UpdateProjectDialog />
                         <MoveCollectionDialog />
                         <MoveProjectDialog />

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list