15768: fixed dialog not closing on single collection copy Arvados-DCO-1.1-Signed...
authorLisa Knox <lisaknox83@gmail.com>
Sun, 17 Sep 2023 21:07:07 +0000 (17:07 -0400)
committerLisa Knox <lisaknox83@gmail.com>
Sun, 17 Sep 2023 21:07:07 +0000 (17:07 -0400)
src/store/collections/collection-copy-actions.ts
src/store/open-in-new-tab/open-in-new-tab.actions.ts
src/store/workbench/workbench-actions.ts
src/views-components/context-menu/action-sets/api-client-authorization-action-set.ts
src/views-components/context-menu/action-sets/collection-action-set.ts
src/views-components/multiselect-toolbar/ms-collection-action-set.ts

index d4e647f86219af4f6e03c730f2817660a6b8c75b..e454712a77555437a0e0e60c43bb020539e084bd 100644 (file)
@@ -19,6 +19,7 @@ export const COLLECTION_COPY_FORM_NAME = "collectionCopyFormName";
 export const COLLECTION_MULTI_COPY_FORM_NAME = "collectionMultiCopyFormName";
 
 export const openCollectionCopyDialog = (resource: { name: string; uuid: string; isSingle?: boolean }) => (dispatch: Dispatch) => {
+    console.log(resource);
     dispatch<any>(resetPickerProjectTree());
     dispatch<any>(initProjectsTreePicker(COLLECTION_COPY_FORM_NAME));
     const initialData: CopyFormDialogData = { name: `Copy of: ${resource.name}`, ownerUuid: "", uuid: resource.uuid, isSingle: resource.isSingle };
@@ -36,6 +37,7 @@ export const openMultiCollectionCopyDialog = (resource: { name: string; uuid: st
 
 export const copyCollection =
     (resource: CopyFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        console.log("COPYCOLL", resource);
         const formName = resource.isSingle ? COLLECTION_COPY_FORM_NAME : COLLECTION_MULTI_COPY_FORM_NAME;
         dispatch(startSubmit(formName));
         let collection = getResource<CollectionResource>(resource.uuid)(getState().resources);
index 6a1ec643a619c6b473c750b4575ad7856c502fa8..7c6c2bb3a964c78192a06896e79885a825bf82de 100644 (file)
@@ -23,11 +23,11 @@ export const copyToClipboardAction = (resources: Array<any>) => (dispatch: Dispa
 
     let output = "";
 
-    resources.forEach(resource => {
+    for (const resource of [...resources]) {
         let url = getNavUrl(resource.uuid, getState().auth, false);
         if (url[0] === "/") url = `${window.location.origin}${url}`;
-        output += output.length ? `, ${url}` : url;
-    });
+        output += output.length ? `,${url}` : url;
+    }
 
     if (output.length) {
         const wasCopied = copy(output);
index 3d580915b392615a2ebf088ebe992a957c72e880..95db8c4fca2fe0b545447b3904170e093b0bb735 100644 (file)
@@ -444,7 +444,11 @@ export const copyCollection = (data: CopyFormDialogData) => async (dispatch: Dis
         const newName = data.isSingle ? data.name : `Copy of: ${copyToProject.name}`;
         try {
             const collection = await dispatch<any>(
-                collectionCopyActions.copyCollection({ ...copyToProject, name: newName, isSingle: data.isSingle })
+                collectionCopyActions.copyCollection({
+                    ...copyToProject,
+                    name: newName,
+                    isSingle: collectionsToCopy.length === 1 ? true : data.isSingle,
+                })
             );
             if (copyToProject && collection) {
                 await dispatch<any>(reloadProjectMatchingUuid([copyToProject.uuid]));
index 001bae4f8fef57f1fd3317372dff799b815e7dc0..0d3bebb12efc98d852ec8d80dc37942be5e73049 100644 (file)
@@ -5,32 +5,38 @@
 import {
     openApiClientAuthorizationAttributesDialog,
     openApiClientAuthorizationRemoveDialog,
-} from 'store/api-client-authorizations/api-client-authorizations-actions';
-import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab';
-import { ContextMenuActionSet } from 'views-components/context-menu/context-menu-action-set';
-import { AdvancedIcon, RemoveIcon, AttributesIcon } from 'components/icon/icon';
+} from "store/api-client-authorizations/api-client-authorizations-actions";
+import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab";
+import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set";
+import { AdvancedIcon, RemoveIcon, AttributesIcon } from "components/icon/icon";
 
 export const apiClientAuthorizationActionSet: ContextMenuActionSet = [
     [
         {
-            name: 'Attributes',
+            name: "Attributes",
             icon: AttributesIcon,
             execute: (dispatch, resources) => {
-                resources.forEach(({ uuid }) => dispatch<any>(openApiClientAuthorizationAttributesDialog(uuid)));
+                for (const resource of [...resources]) {
+                    dispatch<any>(openApiClientAuthorizationAttributesDialog(resource.uuid));
+                }
             },
         },
         {
-            name: 'API Details',
+            name: "API Details",
             icon: AdvancedIcon,
             execute: (dispatch, resources) => {
-                resources.forEach(({ uuid }) => dispatch<any>(openAdvancedTabDialog(uuid)));
+                for (const resource of [...resources]) {
+                    dispatch<any>(openAdvancedTabDialog(resource.uuid));
+                }
             },
         },
         {
-            name: 'Remove',
+            name: "Remove",
             icon: RemoveIcon,
             execute: (dispatch, resources) => {
-                resources.forEach(({ uuid }) => dispatch<any>(openApiClientAuthorizationRemoveDialog(uuid)));
+                for (const resource of [...resources]) {
+                    dispatch<any>(openApiClientAuthorizationRemoveDialog(resource.uuid));
+                }
             },
         },
     ],
index 86c850f08f717db536769e2c87a62428ea6a0292..e7a34ec307b802d4665431157ea1cc07a5f292d3 100644 (file)
@@ -38,14 +38,13 @@ const toggleFavoriteAction: ContextMenuAction = {
     component: ToggleFavoriteAction,
     name: "ToggleFavoriteAction",
     execute: (dispatch, resources) => {
-        resources.forEach(resource =>
+        for (const resource of [...resources]) {
             dispatch<any>(toggleFavorite(resource)).then(() => {
                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
-            })
-        );
+            });
+        }
     },
 };
-
 const commonActionSet: ContextMenuActionSet = [
     [
         {
@@ -81,7 +80,7 @@ const commonActionSet: ContextMenuActionSet = [
             icon: AdvancedIcon,
             name: "API Details",
             execute: (dispatch, resources) => {
-                resources.forEach(resource => dispatch<any>(openAdvancedTabDialog(resource.uuid)));
+                dispatch<any>(openAdvancedTabDialog(resources[0].uuid));
             },
         },
     ],
@@ -95,7 +94,7 @@ export const readOnlyCollectionActionSet: ContextMenuActionSet = [
             icon: FolderSharedIcon,
             name: "Open with 3rd party client",
             execute: (dispatch, resources) => {
-                resources.forEach(resource => dispatch<any>(openWebDavS3InfoDialog(resource.uuid)));
+                dispatch<any>(openWebDavS3InfoDialog(resources[0].uuid));
             },
         },
     ],
@@ -108,14 +107,14 @@ export const collectionActionSet: ContextMenuActionSet = [
             icon: RenameIcon,
             name: "Edit collection",
             execute: (dispatch, resources) => {
-                resources.forEach(resource => dispatch<any>(openCollectionUpdateDialog(resource)));
+                dispatch<any>(openCollectionUpdateDialog(resources[0]));
             },
         },
         {
             icon: ShareIcon,
             name: "Share",
             execute: (dispatch, resources) => {
-                resources.forEach(({ uuid }) => dispatch<any>(openSharingDialog(uuid)));
+                dispatch<any>(openSharingDialog(resources[0].uuid));
             },
         },
         {
@@ -142,11 +141,11 @@ export const collectionAdminActionSet: ContextMenuActionSet = [
             component: TogglePublicFavoriteAction,
             name: "TogglePublicFavoriteAction",
             execute: (dispatch, resources) => {
-                resources.forEach(resource =>
+                for (const resource of resources) {
                     dispatch<any>(togglePublicFavorite(resource)).then(() => {
                         dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
-                    })
-                );
+                    });
+                }
             },
         },
     ],
index f6d7e7122b93166aa9bf3e98e35511efff93d131..77215470ddd090b0fe354d47ae1c4ecf4665e6e3 100644 (file)
@@ -15,7 +15,8 @@ export const msCollectionActionSet: ContextMenuActionSet = [
         {
             icon: CopyIcon,
             name: "Make a copy",
-            execute: (dispatch, resources) => {
+            execute: (dispatch, [...resources]) => {
+                console.log(resources);
                 if (resources[0].isSingle || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
                 else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
             },