21128: basic collection actioons good Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa...
authorLisa Knox <lisaknox83@gmail.com>
Mon, 4 Dec 2023 17:49:30 +0000 (12:49 -0500)
committerLisa Knox <lisaknox83@gmail.com>
Mon, 4 Dec 2023 17:49:30 +0000 (12:49 -0500)
src/store/trash/trash-actions.ts
src/views-components/multiselect-toolbar/ms-collection-action-set.ts
src/views-components/multiselect-toolbar/ms-menu-actions.ts
src/views-components/multiselect-toolbar/ms-project-action-set.ts

index 50ac31c8f92d9ebbaab00a0915a11f22970aff66..d6f0d9a73d2618fea1d6a18cad1281c0b99ee826 100644 (file)
@@ -77,6 +77,8 @@ export const toggleCollectionTrashed =
         async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
             let errorMessage = "";
             let successMessage = "";
+            console.log('hi')
+            dispatch<any>(addDisabledButton(MultiSelectMenuActionNames.ADD_TO_TRASH))
             try {
                 if (isTrashed) {
                     const { location } = getState().router;
index 3afe15568efbbdece0afefa737c5f5c75cc635d5..d9ad017b7e74f265d3a1a6647b3dfa2078e069b6 100644 (file)
@@ -2,43 +2,66 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { MoveToIcon, CopyIcon } from "components/icon/icon";
+import { MoveToIcon, CopyIcon, RenameIcon } from "components/icon/icon";
 import { openMoveCollectionDialog } from "store/collections/collection-move-actions";
 import { openCollectionCopyDialog, openMultiCollectionCopyDialog } from "store/collections/collection-copy-actions";
 import { toggleCollectionTrashed } from "store/trash/trash-actions";
 import { ContextMenuResource } from "store/context-menu/context-menu-actions";
-import { MultiSelectMenuActionSet, MultiSelectMenuActionNames } from "./ms-menu-actions";
+import { msCommonActionSet, MultiSelectMenuActionSet, MultiSelectMenuActionNames, MultiSelectMenuAction } from "./ms-menu-actions";
 import { TrashIcon } from "components/icon/icon";
+import { openCollectionUpdateDialog } from "store/collections/collection-update-actions";
+
+const { MAKE_A_COPY, MOVE_TO, ADD_TO_TRASH, EDIT_COLLECTION } = MultiSelectMenuActionNames;
+
+const msCopyCollection: MultiSelectMenuAction = {
+    name: MultiSelectMenuActionNames.MAKE_A_COPY,
+    icon: CopyIcon,
+    hasAlts: false,
+    isForMulti: true,
+    execute: (dispatch, [...resources]) => {
+        if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
+        else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
+    },
+}
+
+const msMoveCollection: MultiSelectMenuAction = {
+    name: MultiSelectMenuActionNames.MOVE_TO,
+    icon: MoveToIcon,
+    hasAlts: false,
+    isForMulti: true,
+    execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
+}
+
+const msToggleTrashAction: MultiSelectMenuAction = {
+    name: MultiSelectMenuActionNames.ADD_TO_TRASH,
+    icon: TrashIcon,
+    isForMulti: true,
+    hasAlts: false,
+    execute: (dispatch, resources: ContextMenuResource[]) => {
+        for (const resource of [...resources]) {
+            dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
+        }
+    },
+}
+
+const msEditCollection: MultiSelectMenuAction = {
+    icon: RenameIcon,
+    hasAlts: false,
+    isForMulti: false,
+    name: "Edit collection",
+    execute: (dispatch, resources) => {
+        dispatch<any>(openCollectionUpdateDialog(resources[0]));
+    },
+}
 
 export const msCollectionActionSet: MultiSelectMenuActionSet = [
     [
-        {
-            name: MultiSelectMenuActionNames.MAKE_A_COPY,
-            icon: CopyIcon,
-            hasAlts: false,
-            isForMulti: true,
-            execute: (dispatch, [...resources]) => {
-                if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
-                else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
-            },
-        },
-        {
-            name: MultiSelectMenuActionNames.MOVE_TO,
-            icon: MoveToIcon,
-            hasAlts: false,
-            isForMulti: true,
-            execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
-        },
-        {
-            name: MultiSelectMenuActionNames.ADD_TO_TRASH,
-            icon: TrashIcon,
-            isForMulti: true,
-            hasAlts: false,
-            execute: (dispatch, resources: ContextMenuResource[]) => {
-                for (const resource of [...resources]) {
-                    dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
-                }
-            },
-        },
+        ...msCommonActionSet,
+        msCopyCollection,
+        msMoveCollection,
+        msToggleTrashAction,
+        msEditCollection
     ],
 ];
+
+//edit collection
\ No newline at end of file
index b01a5e1733ea06878bb2146d5f5be40708ddebe8..1734644c5d4f6f3b9225c3f9e6665762a865af3a 100644 (file)
@@ -28,7 +28,8 @@ export enum MultiSelectMenuActionNames {
     COPY_AND_RERUN_PROCESS = 'Copy and re-run process',
     COPY_TO_CLIPBOARD = 'Copy to clipboard',
     DELETE_WORKFLOW = 'Delete Worflow',
-    EDIT_PPROJECT = 'Edit project',
+    EDIT_COLLECTION = 'Edit collection',
+    EDIT_PROJECT = 'Edit project',
     FREEZE_PROJECT = 'Freeze Project',
     MAKE_A_COPY = 'Make a copy',
     MOVE_TO = 'Move to',
index a7c97bc9e5c15ead46386ae33b26d88da766c2cb..245fb708fa8915e102562769c321d959391910f9 100644 (file)
@@ -25,7 +25,7 @@ const {
     VIEW_DETAILS,
     API_DETAILS,
     OPEN_W_3RD_PARTY_CLIENT,
-    EDIT_PPROJECT,
+    EDIT_PROJECT,
     SHARE,
     MOVE_TO,
     ADD_TO_TRASH,
@@ -34,7 +34,7 @@ const {
 } = MultiSelectMenuActionNames;
 
 const msEditProjectAction = {
-    name: EDIT_PPROJECT,
+    name: EDIT_PROJECT,
     icon: RenameIcon,
     hasAlts: false,
     isForMulti: false,
@@ -115,7 +115,7 @@ export const msProjectActionFilter = new Set<string>([
     ADD_TO_TRASH,
     API_DETAILS,
     COPY_TO_CLIPBOARD,
-    EDIT_PPROJECT,
+    EDIT_PROJECT,
     FREEZE_PROJECT,
     MOVE_TO,
     NEW_PROJECT,
@@ -126,4 +126,4 @@ export const msProjectActionFilter = new Set<string>([
 ]);
 export const msReadOnlyProjectActionFilter = new Set<string>([ADD_TO_FAVORITES, API_DETAILS, COPY_TO_CLIPBOARD, OPEN_IN_NEW_TAB, OPEN_W_3RD_PARTY_CLIENT, VIEW_DETAILS,]);
 export const msFrozenProjectActionFilter = new Set<string>([ADD_TO_FAVORITES, API_DETAILS, COPY_TO_CLIPBOARD, OPEN_IN_NEW_TAB, OPEN_W_3RD_PARTY_CLIENT, VIEW_DETAILS, SHARE, FREEZE_PROJECT])
-export const msFilterGroupActionFilter = new Set<string>([ADD_TO_FAVORITES, API_DETAILS, COPY_TO_CLIPBOARD, OPEN_IN_NEW_TAB, OPEN_W_3RD_PARTY_CLIENT, VIEW_DETAILS, SHARE, ADD_TO_TRASH, EDIT_PPROJECT, MOVE_TO])
+export const msFilterGroupActionFilter = new Set<string>([ADD_TO_FAVORITES, API_DETAILS, COPY_TO_CLIPBOARD, OPEN_IN_NEW_TAB, OPEN_W_3RD_PARTY_CLIENT, VIEW_DETAILS, SHARE, ADD_TO_TRASH, EDIT_PROJECT, MOVE_TO])