Also, removed duplicated code about context menus.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>
import { collectionFilesItemActionSet, readOnlyCollectionFilesItemActionSet } from '~/views-components/context-menu/action-sets/collection-files-item-action-set';
import { collectionFilesNotSelectedActionSet } from '~/views-components/context-menu/action-sets/collection-files-not-selected-action-set';
import { collectionActionSet, readOnlyCollectionActionSet } from '~/views-components/context-menu/action-sets/collection-action-set';
-import { collectionResourceActionSet } from '~/views-components/context-menu/action-sets/collection-resource-action-set';
import { processActionSet } from '~/views-components/context-menu/action-sets/process-action-set';
import { loadWorkbench } from '~/store/workbench/workbench-actions';
import { Routes } from '~/routes/routes';
addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActionSet);
addMenuActionSet(ContextMenuKind.READONLY_COLLECTION_FILES_ITEM, readOnlyCollectionFilesItemActionSet);
addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
-addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
addMenuActionSet(ContextMenuKind.READONLY_COLLECTION, readOnlyCollectionActionSet);
addMenuActionSet(ContextMenuKind.TRASHED_COLLECTION, trashedCollectionActionSet);
addMenuActionSet(ContextMenuKind.PROCESS, processActionSet);
expect(result).toEqual(ContextMenuKind.COLLECTION_ADMIN);
});
- it('should return ContextMenuKind.COLLECTION_RESOURCE', () => {
+ it('should return ContextMenuKind.COLLECTION', () => {
// given
const isAdmin = false;
const isEditable = true;
const result = resourceKindToContextMenuKind(uuid, isAdmin, isEditable);
// then
- expect(result).toEqual(ContextMenuKind.COLLECTION_RESOURCE);
+ expect(result).toEqual(ContextMenuKind.COLLECTION);
});
it('should return ContextMenuKind.READONLY_COLLECTION', () => {
const kind = extractUuidKind(uuid);
switch (kind) {
case ResourceKind.PROJECT:
- return !isAdmin ?
- isEditable ? ContextMenuKind.PROJECT : ContextMenuKind.READONLY_PROJECT :
- ContextMenuKind.PROJECT_ADMIN;
+ return !isAdmin
+ ? isEditable
+ ? ContextMenuKind.PROJECT
+ : ContextMenuKind.READONLY_PROJECT
+ : ContextMenuKind.PROJECT_ADMIN;
case ResourceKind.COLLECTION:
- return !isAdmin ?
- isEditable ? ContextMenuKind.COLLECTION_RESOURCE : ContextMenuKind.READONLY_COLLECTION :
- ContextMenuKind.COLLECTION_ADMIN;
+ return !isAdmin
+ ? isEditable
+ ? ContextMenuKind.COLLECTION
+ : ContextMenuKind.READONLY_COLLECTION
+ : ContextMenuKind.COLLECTION_ADMIN;
case ResourceKind.PROCESS:
- return !isAdmin ? ContextMenuKind.PROCESS_RESOURCE : ContextMenuKind.PROCESS_ADMIN;
+ return !isAdmin
+ ? ContextMenuKind.PROCESS_RESOURCE
+ : ContextMenuKind.PROCESS_ADMIN;
case ResourceKind.USER:
return ContextMenuKind.ROOT_PROJECT;
case ResourceKind.LINK:
},
{
icon: CopyIcon,
- name: "Copy to project",
+ name: "Make a copy",
execute: (dispatch, resource) => {
dispatch<any>(openCollectionCopyDialog(resource));
}
},
{
icon: CopyIcon,
- name: "Copy to project",
+ name: "Make a copy",
execute: (dispatch, resource) => {
dispatch<any>(openCollectionCopyDialog(resource));
}
dispatch<any>(toggleDetailsPanel());
}
},
- // {
- // icon: ProvenanceGraphIcon,
- // name: "Provenance graph",
- // execute: (dispatch, resource) => {
- // // add code
- // }
- // },
{
icon: AdvancedIcon,
name: "Advanced",
dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
}
},
- // {
- // icon: RemoveIcon,
- // name: "Remove",
- // execute: (dispatch, resource) => {
- // // add code
- // }
- // }
]];
+++ /dev/null
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { ContextMenuActionSet } from "../context-menu-action-set";
-import { ToggleFavoriteAction } from "../actions/favorite-action";
-import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
-import { toggleFavorite } from "~/store/favorites/favorites-actions";
-import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, AdvancedIcon } 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 { 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';
-
-export const collectionResourceActionSet: ContextMenuActionSet = [[
- {
- icon: RenameIcon,
- name: "Edit collection",
- execute: (dispatch, resource) => {
- dispatch<any>(openCollectionUpdateDialog(resource));
- }
- },
- {
- icon: ShareIcon,
- name: "Share",
- execute: (dispatch, { uuid }) => {
- dispatch<any>(openSharingDialog(uuid));
- }
- },
- {
- component: ToggleFavoriteAction,
- execute: (dispatch, resource) => {
- dispatch<any>(toggleFavorite(resource)).then(() => {
- dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
- });
- }
- },
- {
- icon: MoveToIcon,
- name: "Move to",
- execute: (dispatch, resource) => {
- dispatch<any>(openMoveCollectionDialog(resource));
- }
- },
- {
- icon: CopyIcon,
- name: "Copy to project",
- 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));
- }
- },
- {
- component: ToggleTrashAction,
- execute: (dispatch, resource) => {
- dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
- }
- },
- // {
- // icon: RemoveIcon,
- // name: "Remove",
- // execute: (dispatch, resource) => {
- // // add code
- // }
- // }
-]];
COLLECTION_FILES_NOT_SELECTED = "CollectionFilesNotSelected",
COLLECTION = 'Collection',
COLLECTION_ADMIN = 'CollectionAdmin',
- COLLECTION_RESOURCE = 'CollectionResource',
READONLY_COLLECTION = 'ReadOnlyCollection',
TRASHED_COLLECTION = 'TrashedCollection',
PROCESS = "Process",