import { openCollectionUpdateDialog } from "store/collections/collection-update-actions";
import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action";
import { openMoveCollectionDialog } from "store/collections/collection-move-actions";
-import { openCollectionCopyDialog } from "store/collections/collection-copy-actions";
+import { openCollectionCopyDialog, openMultiCollectionCopyDialog } from "store/collections/collection-copy-actions";
import { openWebDavS3InfoDialog } from "store/collections/collection-info-actions";
import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action";
import { toggleCollectionTrashed } from "store/trash/trash-actions";
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 = [
[
{
icon: CopyIcon,
name: "Make a copy",
execute: (dispatch, resources) => {
- dispatch<any>(openCollectionCopyDialog(resources[0]));
+ if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
+ else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
},
},
{
icon: AdvancedIcon,
name: "API Details",
execute: (dispatch, resources) => {
- resources.forEach(resource => dispatch<any>(openAdvancedTabDialog(resource.uuid)));
+ dispatch<any>(openAdvancedTabDialog(resources[0].uuid));
},
},
],
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));
},
},
],
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));
},
},
{
component: ToggleTrashAction,
name: "ToggleTrashAction",
execute: (dispatch, resources: ContextMenuResource[]) => {
- resources.forEach(resource => dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!)));
+ for (const resource of [...resources]) {
+ dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
+ }
},
},
],
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());
- })
- );
+ });
+ }
},
},
],
icon: RestoreVersionIcon,
name: "Restore version",
execute: (dispatch, resources) => {
- resources.forEach(({ uuid }) => dispatch<any>(openRestoreCollectionVersionDialog(uuid)));
+ for (const resource of [...resources]) {
+ dispatch<any>(openRestoreCollectionVersionDialog(resource.uuid));
+ }
},
},
],