17782: Fixes absolute import paths from '~/somedir/...' to 'somedir/...'
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / collection-files-item-action-set.ts
index 4c6874c6ae296411710a9c864459e369773ec968..4cb9ebda4c02a4c421a6aa9f44bd92cf05255b84 100644 (file)
@@ -3,29 +3,40 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { ContextMenuActionSet } from "../context-menu-action-set";
-import { RenameIcon, RemoveIcon } from "~/components/icon/icon";
+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 { 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