21128: created ms-menu-action-set and moved name consts into it Arvados-DCO-1.1-Signe...
[arvados-workbench2.git] / src / views-components / multiselect-toolbar / ms-project-action-set.ts
index b4d12951f8797bb404f775fc3da546fff9cb2196..61e89b1c63918e304b613ec158302b6b7ec5be02 100644 (file)
@@ -2,19 +2,24 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { ContextMenuActionItemSet } from "views-components/context-menu/context-menu-action-set";
+import { MultiSelectMenuAction, MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-action-set";
 import { MoveToIcon, Link } from "components/icon/icon";
 import { openMoveProjectDialog } from "store/projects/project-move-actions";
-import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action";
 import { toggleProjectTrashed } from "store/trash/trash-actions";
 import { copyToClipboardAction } from "store/open-in-new-tab/open-in-new-tab.actions";
-import { ToggleFavoriteAction } from "views-components/context-menu/actions/favorite-action";
 import { toggleFavorite } from "store/favorites/favorites-actions";
 import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action";
+import { AddFavoriteIcon, RemoveFavoriteIcon } from "components/icon/icon";
+import { RestoreFromTrashIcon, TrashIcon } from "components/icon/icon";
+
+
 
 export const msToggleFavoriteAction = {
-    component: ToggleFavoriteAction,
-    name: "ToggleFavoriteAction",
+    name: MultiSelectMenuActionNames.TOGGLE_FAVORITE_ACTION,
+    defaultText: 'Add to Favorites',
+    altText: 'Remove from Favorites',
+    icon: AddFavoriteIcon,
+    altIcon: RemoveFavoriteIcon,
     execute: (dispatch, resources) => {
         dispatch(toggleFavorite(resources[0])).then(() => {
             dispatch(favoritePanelActions.REQUEST_ITEMS());
@@ -24,7 +29,7 @@ export const msToggleFavoriteAction = {
 
 export const msCopyToClipboardMenuAction = {
     icon: Link,
-    name: "Copy to clipboard",
+    name: MultiSelectMenuActionNames.COPY_TO_CLIPBOARD,
     execute: (dispatch, resources) => {
         dispatch(copyToClipboardAction(resources));
     },
@@ -32,15 +37,18 @@ export const msCopyToClipboardMenuAction = {
 
 export const msMoveToAction = {
     icon: MoveToIcon,
-    name: "Move to",
+    name: MultiSelectMenuActionNames.MOVE_TO,
     execute: (dispatch, resource) => {
         dispatch(openMoveProjectDialog(resource[0]));
     },
 };
 
 export const msToggleTrashAction = {
-    component: ToggleTrashAction,
-    name: "ToggleTrashAction",
+    name: MultiSelectMenuActionNames.TOGGLE_TRASH_ACTION,
+    defaultText: 'Add to Trash',
+    altText: 'Restore from Trash',
+    icon: TrashIcon,
+    altIcon: RestoreFromTrashIcon,
     execute: (dispatch, resources) => {
         for (const resource of [...resources]) {
             dispatch(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!, resources.length > 1));
@@ -48,4 +56,4 @@ export const msToggleTrashAction = {
     },
 };
 
-export const msProjectActionSet: ContextMenuActionItemSet = [[msToggleFavoriteAction, msCopyToClipboardMenuAction, msMoveToAction, msToggleTrashAction]]
+export const msProjectActionSet: MultiSelectMenuAction[][] = [[msCopyToClipboardMenuAction, msMoveToAction, msToggleTrashAction, msToggleFavoriteAction]];