Merge branch '17289-dir-download-action-removal'
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / collection-files-item-action-set.ts
index b900d1864dd3490710cb39a061caff1b548417cb..c8f70b0f73103f41004c6ae11bb2b4320e0d9519 100644 (file)
@@ -7,25 +7,36 @@ import { RemoveIcon, RenameIcon } from "~/components/icon/icon";
 import { DownloadCollectionFileAction } from "../actions/download-collection-file-action";
 import { openFileRemoveDialog, openRenameFileDialog } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
 import { CollectionFileViewerAction } from '~/views-components/context-menu/actions/collection-file-viewer-action';
+import { CollectionCopyToClipboardAction } from "../actions/collection-copy-to-clipboard-action";
 
-
-export const readOnlyCollectionFilesItemActionSet: ContextMenuActionSet = [[
+export const readOnlyCollectionDirectoryItemActionSet: ContextMenuActionSet = [[
     {
-        component: DownloadCollectionFileAction,
-        execute: () => { return; }
+        component: CollectionFileViewerAction,
+        execute: () => { return; },
     },
     {
-        component: CollectionFileViewerAction,
+        component: CollectionCopyToClipboardAction,
         execute: () => { return; },
     }
 ]];
 
-export const collectionFilesItemActionSet: ContextMenuActionSet = readOnlyCollectionFilesItemActionSet.concat([[
+export const readOnlyCollectionFileItemActionSet: ContextMenuActionSet = [[
+    {
+        component: DownloadCollectionFileAction,
+        execute: () => { return; }
+    },
+    ...readOnlyCollectionDirectoryItemActionSet.reduce((prev, next) => prev.concat(next), []),
+]];
+
+const writableActionSet: ContextMenuActionSet = [[
     {
         name: "Rename",
         icon: RenameIcon,
         execute: (dispatch, resource) => {
-            dispatch<any>(openRenameFileDialog({ name: resource.name, id: resource.uuid }));
+            dispatch<any>(openRenameFileDialog({
+                name: resource.name,
+                id: resource.uuid,
+                path: resource.uuid.split('/').slice(1).join('/') }));
         }
     },
     {
@@ -35,4 +46,8 @@ export const collectionFilesItemActionSet: ContextMenuActionSet = readOnlyCollec
             dispatch<any>(openFileRemoveDialog(resource.uuid));
         }
     }
-]]);
\ No newline at end of file
+]];
+
+export const collectionDirectoryItemActionSet: ContextMenuActionSet = readOnlyCollectionDirectoryItemActionSet.concat(writableActionSet);
+
+export const collectionFileItemActionSet: ContextMenuActionSet = readOnlyCollectionFileItemActionSet.concat(writableActionSet);
\ No newline at end of file