moving, copying, renaming processes in final state
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / collection-action-set.ts
index 7d49e34c03a59078642ed2f68ebeeb3d02db016d..2dc2a92e582bd34d34f9e7e676e47814a0735286 100644 (file)
@@ -6,31 +6,32 @@ import { ContextMenuActionSet } from "../context-menu-action-set";
 import { ToggleFavoriteAction } from "../actions/favorite-action";
 import { toggleFavorite } from "~/store/favorites/favorites-actions";
 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, ProvenanceGraphIcon, AdvancedIcon, RemoveIcon } from "~/components/icon/icon";
-import { openUpdater } from "~/store/collections/updater/collection-updater-action";
+import { openCollectionUpdateDialog } from "~/store/collections/collection-update-actions";
 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
-import { openProjectCopyDialog } from "~/views-components/project-copy-dialog/project-copy-dialog";
-import { openMoveToDialog } from "../../move-to-dialog/move-to-dialog";
+import { openMoveCollectionDialog } from '~/store/collections/collection-move-actions';
+import { openCollectionCopyDialog } from "~/store/collections/collection-copy-actions";
+import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
+import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
+import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
+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';
 
 export const collectionActionSet: ContextMenuActionSet = [[
     {
         icon: RenameIcon,
         name: "Edit collection",
         execute: (dispatch, resource) => {
-            dispatch<any>(openUpdater(resource));
+            dispatch<any>(openCollectionUpdateDialog(resource));
         }
     },
     {
         icon: ShareIcon,
         name: "Share",
-        execute: (dispatch, resource) => {
-            // add code
+        execute: (dispatch, { uuid }) => {
+            dispatch<any>(openSharingDialog(uuid));
         }
     },
-    {
-        icon: MoveToIcon,
-        name: "Move to",
-        execute: dispatch => dispatch<any>(openMoveToDialog())
-    },
     {
         component: ToggleFavoriteAction,
         execute: (dispatch, resource) => {
@@ -40,38 +41,50 @@ export const collectionActionSet: ContextMenuActionSet = [[
         }
     },
     {
-        icon: CopyIcon,
-        name: "Copy to project",
+        component: ToggleTrashAction,
         execute: (dispatch, resource) => {
-            dispatch<any>(openProjectCopyDialog({name: resource.name, projectUuid: resource.uuid}));
+            dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
         }
     },
     {
-        icon: DetailsIcon,
-        name: "View details",
-        execute: (dispatch, resource) => {
-            // add code
-        }
+        icon: MoveToIcon,
+        name: "Move to",
+        execute: (dispatch, resource) => dispatch<any>(openMoveCollectionDialog(resource))
     },
     {
-        icon: ProvenanceGraphIcon,
-        name: "Provenance graph",
+        icon: CopyIcon,
+        name: "Copy to project",
         execute: (dispatch, resource) => {
-            // add code
+            dispatch<any>(openCollectionCopyDialog(resource));
         }
+
     },
     {
-        icon: AdvancedIcon,
-        name: "Advanced",
-        execute: (dispatch, resource) => {
-            // add code
+        icon: DetailsIcon,
+        name: "View details",
+        execute: dispatch => {
+            dispatch<any>(toggleDetailsPanel());
         }
     },
+    // {
+    //     icon: ProvenanceGraphIcon,
+    //     name: "Provenance graph",
+    //     execute: (dispatch, resource) => {
+    //         // add code
+    //     }
+    // },
     {
-        icon: RemoveIcon,
-        name: "Remove",
-        execute: (dispatch, resource) => {
-            // add code
+        icon: AdvancedIcon,
+        name: "Advanced",
+        execute: (dispatch, { uuid, ownerUuid }) => {
+            dispatch<any>(openAdvancedTabDialog(uuid, ownerUuid));
         }
     }
+    // {
+    //     icon: RemoveIcon,
+    //     name: "Remove",
+    //     execute: (dispatch, resource) => {
+    //         // add code
+    //     }
+    // }
 ]];