16622: Tweak icon & titles
[arvados.git] / src / views-components / context-menu / action-sets / project-action-set.ts
index 9b8ced5663037596646b1d1598ebd8eb6bc74d80..c0b925c2ce49eab712926577a6abfe169eff38dd 100644 (file)
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { ContextMenuActionSet } from "../context-menu-action-set";
-import { NewProjectIcon, RenameIcon, CopyIcon, MoveToIcon, DetailsIcon, AdvancedIcon } from '~/components/icon/icon';
+import { NewProjectIcon, RenameIcon, MoveToIcon, DetailsIcon, AdvancedIcon, OpenIcon, Link } from '~/components/icon/icon';
 import { ToggleFavoriteAction } from "../actions/favorite-action";
 import { toggleFavorite } from "~/store/favorites/favorites-actions";
 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
@@ -12,36 +12,16 @@ import { openProjectCreateDialog } from '~/store/projects/project-create-actions
 import { openProjectUpdateDialog } from '~/store/projects/project-update-actions';
 import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
 import { toggleProjectTrashed } from "~/store/trash/trash-actions";
-import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
 import { ShareIcon } from '~/components/icon/icon';
 import { openSharingDialog } from "~/store/sharing-dialog/sharing-dialog-actions";
 import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
 import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
+import { copyToClipboardAction, openInNewTabAction } from "~/store/open-in-new-tab/open-in-new-tab.actions";
 
-export const projectActionSet: ContextMenuActionSet = [[
-    {
-        icon: NewProjectIcon,
-        name: "New project",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openProjectCreateDialog(resource.uuid));
-        }
-    },
-    {
-        icon: RenameIcon,
-        name: "Edit project",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openProjectUpdateDialog(resource));
-        }
-    },
-    {
-        icon: ShareIcon,
-        name: "Share",
-        execute: (dispatch, { uuid }) => {
-            dispatch<any>(openSharingDialog(uuid));
-        }
-    },
+export const readOnlyProjectActionSet: ContextMenuActionSet = [[
     {
         component: ToggleFavoriteAction,
+        name: 'ToggleFavoriteAction',
         execute: (dispatch, resource) => {
             dispatch<any>(toggleFavorite(resource)).then(() => {
                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
@@ -49,23 +29,17 @@ export const projectActionSet: ContextMenuActionSet = [[
         }
     },
     {
-        component: ToggleTrashAction,
-        execute: (dispatch, resource) => {
-            dispatch<any>(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!));
-        }
-    },
-    {
-        icon: MoveToIcon,
-        name: "Move to",
+        icon: OpenIcon,
+        name: "Open in new tab",
         execute: (dispatch, resource) => {
-            dispatch<any>(openMoveProjectDialog(resource));
+            dispatch<any>(openInNewTabAction(resource));
         }
     },
     {
-        icon: CopyIcon,
-        name: "Copy to project",
+        icon: Link,
+        name: "Copy to clipboard",
         execute: (dispatch, resource) => {
-            // add code
+            dispatch<any>(copyToClipboardAction(resource));
         }
     },
     {
@@ -83,3 +57,44 @@ export const projectActionSet: ContextMenuActionSet = [[
         }
     },
 ]];
+
+export const projectActionSet: ContextMenuActionSet = [
+    [
+        ...readOnlyProjectActionSet.reduce((prev, next) => prev.concat(next), []),
+        {
+            icon: NewProjectIcon,
+            name: "New project",
+            execute: (dispatch, resource) => {
+                dispatch<any>(openProjectCreateDialog(resource.uuid));
+            }
+        },
+        {
+            icon: RenameIcon,
+            name: "Edit project",
+            execute: (dispatch, resource) => {
+                dispatch<any>(openProjectUpdateDialog(resource));
+            }
+        },
+        {
+            icon: ShareIcon,
+            name: "Share",
+            execute: (dispatch, { uuid }) => {
+                dispatch<any>(openSharingDialog(uuid));
+            }
+        },
+        {
+            icon: MoveToIcon,
+            name: "Move to",
+            execute: (dispatch, resource) => {
+                dispatch<any>(openMoveProjectDialog(resource));
+            }
+        },
+        {
+            component: ToggleTrashAction,
+            name: 'ToggleTrashAction',
+            execute: (dispatch, resource) => {
+                dispatch<any>(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!));
+            }
+        },
+    ]
+];