15768: first step in revamp: imported context menu actions and got them to work for...
[arvados.git] / src / views-components / context-menu / action-sets / collection-action-set.ts
index 4a6c910b5f3b5b9f4b9720e360f60369fff948fd..5b170f6707b7b697fe0e21df6a793ac04b7c4e36 100644 (file)
@@ -2,12 +2,9 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import {
-    ContextMenuAction,
-    ContextMenuActionSet
-} from "../context-menu-action-set";
-import { ToggleFavoriteAction } from "../actions/favorite-action";
-import { toggleFavorite } from "~/store/favorites/favorites-actions";
+import { ContextMenuAction, ContextMenuActionSet } from '../context-menu-action-set';
+import { ToggleFavoriteAction } from '../actions/favorite-action';
+import { toggleFavorite } from 'store/favorites/favorites-actions';
 import {
     RenameIcon,
     ShareIcon,
@@ -17,22 +14,24 @@ import {
     AdvancedIcon,
     OpenIcon,
     Link,
-    RestoreVersionIcon
-} from "~/components/icon/icon";
-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 { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
-import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
-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";
-import { openRestoreCollectionVersionDialog } from "~/store/collections/collection-version-actions";
-import { TogglePublicFavoriteAction } from "../actions/public-favorite-action";
-import { togglePublicFavorite } from "~/store/public-favorites/public-favorites-actions";
-import { publicFavoritePanelActions } from "~/store/public-favorites-panel/public-favorites-action";
+    RestoreVersionIcon,
+    FolderSharedIcon,
+} from 'components/icon/icon';
+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 { openWebDavS3InfoDialog } from 'store/collections/collection-info-actions';
+import { ToggleTrashAction } from 'views-components/context-menu/actions/trash-action';
+import { toggleCollectionTrashed } from 'store/trash/trash-actions';
+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';
+import { openRestoreCollectionVersionDialog } from 'store/collections/collection-version-actions';
+import { TogglePublicFavoriteAction } from '../actions/public-favorite-action';
+import { togglePublicFavorite } from 'store/public-favorites/public-favorites-actions';
+import { publicFavoritePanelActions } from 'store/public-favorites-panel/public-favorites-action';
 
 const toggleFavoriteAction: ContextMenuAction = {
     component: ToggleFavoriteAction,
@@ -41,83 +40,93 @@ const toggleFavoriteAction: ContextMenuAction = {
         dispatch<any>(toggleFavorite(resource)).then(() => {
             dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
         });
-    }
-};
-
-const commonActionSet: ContextMenuActionSet = [[
-    {
-        icon: OpenIcon,
-        name: "Open in new tab",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openInNewTabAction(resource));
-        }
-    },
-    {
-        icon: Link,
-        name: "Copy to clipboard",
-        execute: (dispatch, resource) => {
-            dispatch<any>(copyToClipboardAction(resource));
-        }
     },
-    {
-        icon: CopyIcon,
-        name: "Make a copy",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openCollectionCopyDialog(resource));
-        }
+};
 
-    },
-    {
-        icon: DetailsIcon,
-        name: "View details",
-        execute: dispatch => {
-            dispatch<any>(toggleDetailsPanel());
-        }
-    },
-    {
-        icon: AdvancedIcon,
-        name: "Advanced",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openAdvancedTabDialog(resource.uuid));
-        }
-    },
-]];
+const commonActionSet: ContextMenuActionSet = [
+    [
+        {
+            icon: OpenIcon,
+            name: 'Open in new tab',
+            execute: (dispatch, resource) => {
+                dispatch<any>(openInNewTabAction(resource));
+            },
+        },
+        {
+            icon: Link,
+            name: 'Copy to clipboard',
+            execute: (dispatch, resource) => {
+                dispatch<any>(copyToClipboardAction(resource));
+            },
+        },
+        {
+            icon: CopyIcon,
+            name: 'Make a copy',
+            execute: (dispatch, resource) => {
+                dispatch<any>(openCollectionCopyDialog(resource));
+            },
+        },
+        {
+            icon: DetailsIcon,
+            name: 'View details',
+            execute: (dispatch) => {
+                dispatch<any>(toggleDetailsPanel());
+            },
+        },
+        {
+            icon: AdvancedIcon,
+            name: 'API Details',
+            execute: (dispatch, resource) => {
+                dispatch<any>(openAdvancedTabDialog(resource.uuid));
+            },
+        },
+    ],
+];
 
-export const readOnlyCollectionActionSet: ContextMenuActionSet = [[
-    ...commonActionSet.reduce((prev, next) => prev.concat(next), []),
-    toggleFavoriteAction,
-]];
+export const readOnlyCollectionActionSet: ContextMenuActionSet = [
+    [
+        ...commonActionSet.reduce((prev, next) => prev.concat(next), []),
+        toggleFavoriteAction,
+        {
+            icon: FolderSharedIcon,
+            name: 'Open with 3rd party client',
+            execute: (dispatch, resource) => {
+                dispatch<any>(openWebDavS3InfoDialog(resource.uuid));
+            },
+        },
+    ],
+];
 
 export const collectionActionSet: ContextMenuActionSet = [
     [
         ...readOnlyCollectionActionSet.reduce((prev, next) => prev.concat(next), []),
         {
             icon: RenameIcon,
-            name: "Edit collection",
+            name: 'Edit collection',
             execute: (dispatch, resource) => {
                 dispatch<any>(openCollectionUpdateDialog(resource));
-            }
+            },
         },
         {
             icon: ShareIcon,
-            name: "Share",
+            name: 'Share',
             execute: (dispatch, { uuid }) => {
                 dispatch<any>(openSharingDialog(uuid));
-            }
+            },
         },
         {
             icon: MoveToIcon,
-            name: "Move to",
-            execute: (dispatch, resource) => dispatch<any>(openMoveCollectionDialog(resource))
+            name: 'Move to',
+            execute: (dispatch, resource) => dispatch<any>(openMoveCollectionDialog(resource)),
         },
         {
             component: ToggleTrashAction,
             name: 'ToggleTrashAction',
             execute: (dispatch, resource) => {
                 dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
-            }
+            },
         },
-    ]
+    ],
 ];
 
 export const collectionAdminActionSet: ContextMenuActionSet = [
@@ -130,9 +139,9 @@ export const collectionAdminActionSet: ContextMenuActionSet = [
                 dispatch<any>(togglePublicFavorite(resource)).then(() => {
                     dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
                 });
-            }
+            },
         },
-    ]
+    ],
 ];
 
 export const oldCollectionVersionActionSet: ContextMenuActionSet = [
@@ -143,7 +152,7 @@ export const oldCollectionVersionActionSet: ContextMenuActionSet = [
             name: 'Restore version',
             execute: (dispatch, { uuid }) => {
                 dispatch<any>(openRestoreCollectionVersionDialog(uuid));
-            }
+            },
         },
-    ]
-];
\ No newline at end of file
+    ],
+];