update collections create and update (forms and dialogs)
authorJanicki Artur <artur.janicki@contractors.roche.com>
Fri, 24 Aug 2018 09:44:43 +0000 (11:44 +0200)
committerJanicki Artur <artur.janicki@contractors.roche.com>
Fri, 24 Aug 2018 09:44:43 +0000 (11:44 +0200)
Feature #14103

Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki@contractors.roche.com>

src/store/collections/collection-create-actions.ts
src/store/collections/collection-update-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/root-project-action-set.ts
src/views-components/dialog-create/dialog-collection-create.tsx
src/views-components/dialog-forms/create-collection-dialog.ts
src/views/workbench/workbench.tsx

index 66f5ab8cbdfcd042460a8d0cc1841c2383176629..2c339f2867402c827f67873ec2c8877ec3e061ca 100644 (file)
@@ -19,9 +19,9 @@ export interface CollectionCreateFormDialogData {
     files: File[];
 }
 
-export const COLLECTION_CREATE_FORM_NAME = "collectionCreateDialog";
+export const COLLECTION_CREATE_FORM_NAME = "collectionCreateFormName";
 
-export const openCreateModal = () =>
+export const openCollectionCreateDialog = () =>
     (dispatch: Dispatch) => {
         dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_CREATE_FORM_NAME, data: {} }));
     };
@@ -44,7 +44,6 @@ export const createCollection = (collection: Partial<CollectionResource>) =>
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_CREATE_FORM_NAME }));
             dispatch(reset(COLLECTION_CREATE_FORM_NAME));
-            // return newCollection;
         } catch (e) {
             const error = getCommonResourceServiceError(e);
             if (error === CommonResourceServiceError.UNIQUE_VIOLATION) {
index 4c4ad3bf711f290571e41f66546a3a55f23551a5..27c3bfced5dae28c5f2eb66e93cdb23088b0ba22 100644 (file)
@@ -22,9 +22,9 @@ export interface CollectionUpdateFormDialogData {
     description: string;
 }
 
-export const COLLECTION_UPDATE_FORM_NAME = 'collectionUpdateDialog';
+export const COLLECTION_UPDATE_FORM_NAME = 'collectionUpdateFormName';
 
-export const openUpdateModal = (resource: ContextMenuResource) =>
+export const openCollectionUpdateDialog = (resource: ContextMenuResource) =>
     (dispatch: Dispatch) => {
         dispatch(initialize(COLLECTION_UPDATE_FORM_NAME, resource));
         dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_UPDATE_FORM_NAME, data: {} }));
index 65bb84b1d6ac0db89e7a3f3d8ce5dca0df409ad2..fab4a8055a53ed8d435257f7364d9bc18f5ae67d 100644 (file)
@@ -6,7 +6,7 @@ import { ContextMenuActionSet } from "../context-menu-action-set";
 import { ToggleFavoriteAction } from "../actions/favorite-action";
 import { toggleFavorite } from "~/store/favorites/favorites-actions";
 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, ProvenanceGraphIcon, AdvancedIcon, RemoveIcon } from "~/components/icon/icon";
-import { openUpdateModal } from "~/store/collections/collection-update-actions";
+import { openCollectionUpdateDialog } from "~/store/collections/collection-update-actions";
 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
 import { openMoveCollectionDialog } from '~/store/move-collection-dialog/move-collection-dialog';
 import { openProjectCopyDialog } from "~/store/project-copy-project-dialog/project-copy-project-dialog";
@@ -16,7 +16,7 @@ export const collectionActionSet: ContextMenuActionSet = [[
         icon: RenameIcon,
         name: "Edit collection",
         execute: (dispatch, resource) => {
-            dispatch<any>(openUpdateModal(resource));
+            dispatch<any>(openCollectionUpdateDialog(resource));
         }
     },
     {
index ad99bb85de73164d2997a83d6b8d3a206e6b6a65..66838a96fd48787f268a6567da7ac7d482841591 100644 (file)
@@ -6,7 +6,7 @@ import { ContextMenuActionSet } from "../context-menu-action-set";
 import { ToggleFavoriteAction } from "../actions/favorite-action";
 import { toggleFavorite } from "~/store/favorites/favorites-actions";
 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "~/components/icon/icon";
-import { openUpdateModal } from "~/store/collections/collection-update-actions";
+import { openCollectionUpdateDialog } from "~/store/collections/collection-update-actions";
 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
 import { openMoveCollectionDialog } from '~/store/move-collection-dialog/move-collection-dialog';
 import { openProjectCopyDialog } from '~/store/project-copy-project-dialog/project-copy-project-dialog';
@@ -16,7 +16,7 @@ export const collectionResourceActionSet: ContextMenuActionSet = [[
         icon: RenameIcon,
         name: "Edit collection",
         execute: (dispatch, resource) => {
-            dispatch<any>(openUpdateModal(resource));
+            dispatch<any>(openCollectionUpdateDialog(resource));
         }
     },
     {
index 1adac00ffa5fea597752460d76f2b2a8d567fd8c..a5e2065afbe21bb0f2c796b5388e38f62c780194 100644 (file)
@@ -7,7 +7,7 @@ import { reset } from "redux-form";
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { projectActions } from "~/store/project/project-action";
 import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create";
-import { COLLECTION_CREATE_FORM_NAME, openCreateModal } from '~/store/collections/collection-create-actions';
+import { COLLECTION_CREATE_FORM_NAME, openCollectionCreateDialog } from '~/store/collections/collection-create-actions';
 import { NewProjectIcon, CollectionIcon } from "~/components/icon/icon";
 
 export const rootProjectActionSet: ContextMenuActionSet =  [[
@@ -24,7 +24,7 @@ export const rootProjectActionSet: ContextMenuActionSet =  [[
         name: "New Collection",
         execute: (dispatch, resource) => {
             dispatch(reset(COLLECTION_CREATE_FORM_NAME));
-            dispatch<any>(openCreateModal());
+            dispatch<any>(openCollectionCreateDialog());
         }
     }
 ]];
index 607835b0715ef1da1dffae6b31fec241e4247de7..5d3bfd85f7472a7c21ddf8455e4eddab53ad6f01 100644 (file)
@@ -6,8 +6,19 @@ import * as React from 'react';
 import { InjectedFormProps } from 'redux-form';
 import { WithDialogProps } from '~/store/dialog/with-dialog';
 import { CollectionCreateFormDialogData } from '~/store/collections/collection-create-actions';
+import { collectionUploaderActions, UploadFile } from "~/store/collections/uploader/collection-uploader-actions";
 import { FormDialog } from '~/components/form-dialog/form-dialog';
 import { CollectionNameField, CollectionDescriptionField } from '~/views-components/collection-form-fields/collection-form-fields';
+import { FileUpload } from '~/components/file-upload/file-upload';
+
+// interface DialogCollectionDataProps {
+//     open: boolean;
+//     handleSubmit: any;
+//     submitting: boolean;
+//     invalid: boolean;
+//     pristine: boolean;
+//     files: UploadFile[];
+// }
 
 type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
 
@@ -23,7 +34,7 @@ const CollectionAddFields = () => <span>
     <CollectionNameField />
     <CollectionDescriptionField />
     {/* <FileUpload
-        files={files}
+        files={this.props.files}
         disabled={busy}
         onDrop={files => this.props.dispatch(collectionUploaderActions.SET_UPLOAD_FILES(files))} /> */}
 </span>;
\ No newline at end of file
index 30c999ca037d67750a02f30a21086d0f5079ea83..d2699d8398b31cacbe6df8cf5535cf96291cfff8 100644 (file)
@@ -14,8 +14,9 @@ export const CreateCollectionDialog = compose(
     reduxForm<CollectionCreateFormDialogData>({
         form: COLLECTION_CREATE_FORM_NAME,
         onSubmit: (data, dispatch) => {
-            console.log('onSubmit: ', data);
             dispatch(addCollection(data));
         }
     })
-)(DialogCollectionCreate);
\ No newline at end of file
+)(DialogCollectionCreate);
+
+// onSubmit: (data: { name: string, description: string }, files: UploadFile[]) => void;
\ No newline at end of file
index 38de88b33470550d078ee82e0f966673ba46f29d..85c9b66ee20ddc41b0a56af2aca36c5b97bfea50 100644 (file)
@@ -37,10 +37,11 @@ import { favoritePanelActions } from '~/store/favorite-panel/favorite-panel-acti
 import { CollectionPanel } from '../collection-panel/collection-panel';
 import { loadCollection, loadCollectionTags } from '~/store/collection-panel/collection-panel-action';
 import { getCollectionUrl } from '~/models/collection';
-import { COLLECTION_CREATE_FORM_NAME, openCreateModal } from '~/store/collections/collection-create-actions';
+import { COLLECTION_CREATE_FORM_NAME, openCollectionCreateDialog } from '~/store/collections/collection-create-actions';
 import { CreateCollectionDialog } from '~/views-components/dialog-forms/create-collection-dialog';
 import { UpdateCollectionDialog } from '~/views-components/dialog-forms/update-collection-dialog';
 import { UpdateProjectDialog } from '~/views-components/update-project-dialog/update-project-dialog';
+import { ProjectPanel } from "~/views/project-panel/project-panel";
 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';
@@ -385,7 +386,7 @@ export const Workbench = withStyles(styles)(
 
             handleCollectionCreationDialogOpen = (itemUuid: string) => {
                 this.props.dispatch(reset(COLLECTION_CREATE_FORM_NAME));
-                this.props.dispatch<any>(openCreateModal());
+                this.props.dispatch<any>(openCollectionCreateDialog());
             }
 
             openContextMenu = (event: React.MouseEvent<HTMLElement>, resource: { name: string; uuid: string; description?: string; kind: ContextMenuKind; }) => {