X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/59b24ea9a90ba60563316a5c2ad4c7ce8a8c423d..6e4b23e9a99ab64e25c60a128e6beb4fa8636374:/src/views-components/dialog-upload/dialog-collection-files-upload.tsx

diff --git a/src/views-components/dialog-upload/dialog-collection-files-upload.tsx b/src/views-components/dialog-upload/dialog-collection-files-upload.tsx
index 35c1ed6d..f65bdabf 100644
--- a/src/views-components/dialog-upload/dialog-collection-files-upload.tsx
+++ b/src/views-components/dialog-upload/dialog-collection-files-upload.tsx
@@ -2,30 +2,46 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import 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 '~/views-components/file-uploader/file-uploader';
-
+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 'views-components/file-uploader/file-uploader';
+import { WarningCollection } from 'components/warning-collection/warning-collection';
+import { fileUploaderActions } from 'store/file-uploader/file-uploader-actions';
+import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions';
 
 type DialogCollectionFilesUploadProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
 
-export const DialogCollectionFilesUpload = (props: DialogCollectionFilesUploadProps) =>
-    <FormDialog
+export const DialogCollectionFilesUpload = (props: DialogCollectionFilesUploadProps) => {
+
+    return <FormDialog
         dialogTitle='Upload data'
         formFields={UploadCollectionFilesFields}
         submitLabel='Upload data'
+        doNotDisableCancel
+        cancelCallback={() => {
+            const { submitting, dispatch } = (props as any);
+
+            if (submitting) {
+                dispatch(progressIndicatorActions.STOP_WORKING('uploadCollectionFilesDialog'));
+                dispatch(fileUploaderActions.CANCEL_FILES_UPLOAD());
+                dispatch(fileUploaderActions.CLEAR_UPLOAD());
+            }
+        }}
         {...props}
     />;
+}
 
-const UploadCollectionFilesFields = () =>
+const UploadCollectionFilesFields = () => <>
     <Field
         name='files'
         validate={FILES_FIELD_VALIDATION}
-        component={FileUploaderField} />;
+        component={FileUploaderField} />
+    <WarningCollection text="Uploading new files will change content address." />
+</>;
 
 const FILES_FIELD_VALIDATION = [require];
 
