Merge branch '17782-react-scripts-ts-migration' into main. Closes #17782
[arvados-workbench2.git] / src / store / collections / collection-create-actions.ts
index 39565f1d43b095c22470926e4f3d0f4d98f6c151..0b73e6f151a7419393f1ac4bcead66c8bba19cd5 100644 (file)
@@ -4,17 +4,17 @@
 
 import { Dispatch } from "redux";
 import { reset, startSubmit, stopSubmit, initialize, FormErrors } from 'redux-form';
-import { RootState } from '~/store/store';
-import { getUserUuid } from "~/common/getuser";
-import { dialogActions } from "~/store/dialog/dialog-actions";
-import { ServiceRepository } from '~/services/services';
-import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service";
+import { RootState } from 'store/store';
+import { getUserUuid } from "common/getuser";
+import { dialogActions } from "store/dialog/dialog-actions";
+import { ServiceRepository } from 'services/services';
+import { getCommonResourceServiceError, CommonResourceServiceError } from "services/common-service/common-resource-service";
 import { uploadCollectionFiles } from './collection-upload-actions';
-import { fileUploaderActions } from '~/store/file-uploader/file-uploader-actions';
-import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
-import { isItemNotInProject, isProjectOrRunProcessRoute } from '~/store/projects/project-create-actions';
-import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
-import { CollectionResource } from "~/models/collection";
+import { fileUploaderActions } from 'store/file-uploader/file-uploader-actions';
+import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
+import { isProjectOrRunProcessRoute } from 'store/projects/project-create-actions';
+import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
+import { CollectionResource } from "models/collection";
 
 export interface CollectionCreateFormDialogData {
     ownerUuid: string;
@@ -26,12 +26,11 @@ export const COLLECTION_CREATE_FORM_NAME = "collectionCreateFormName";
 
 export const openCollectionCreateDialog = (ownerUuid: string) =>
     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        const router = getState();
-        const properties = getState().properties;
-        if (isItemNotInProject(properties) || !isProjectOrRunProcessRoute(router)) {
+        const { router } = getState();
+        if (!isProjectOrRunProcessRoute(router)) {
             const userUuid = getUserUuid(getState());
             if (!userUuid) { return; }
-            dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { userUuid }));
+            dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { ownerUuid: userUuid }));
         } else {
             dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { ownerUuid }));
         }