refs #14276 Merge branch 'origin/14276-structured-search-service-part2'
[arvados-workbench2.git] / src / store / collections / collection-create-actions.ts
index 05249b458fcdb1e01f872c2a7350e3e804992ef5..b05945c189b8a84422dee3c574a0a932783f778f 100644 (file)
@@ -11,7 +11,7 @@ import { getCommonResourceServiceError, CommonResourceServiceError } from "~/ser
 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 { isNotProjectItem } from '~/store/projects/project-create-actions';
+import { isItemNotInProject, isProjectOrRunProcessRoute } from '~/store/projects/project-create-actions';
 
 export interface CollectionCreateFormDialogData {
     ownerUuid: string;
@@ -23,7 +23,9 @@ export const COLLECTION_CREATE_FORM_NAME = "collectionCreateFormName";
 
 export const openCollectionCreateDialog = (ownerUuid: string) =>
     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        if (isNotProjectItem) {
+        const router = getState();
+        const properties = getState().properties;
+        if (isItemNotInProject(properties) || !isProjectOrRunProcessRoute(router)) {
             const userUuid = getState().auth.user!.uuid;
             dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { userUuid }));
         } else {