From a4257a0f91ce403f09c01a89e982e5e336a0f033 Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Wed, 11 Oct 2023 17:05:11 -0400 Subject: [PATCH] 15768: integration tests pass locally Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- .../context-menu/context-menu-actions.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/store/context-menu/context-menu-actions.ts b/src/store/context-menu/context-menu-actions.ts index 71da498f59..da6dac5db0 100644 --- a/src/store/context-menu/context-menu-actions.ts +++ b/src/store/context-menu/context-menu-actions.ts @@ -23,6 +23,7 @@ import { GroupContentsResource } from "services/groups-service/groups-service"; import { LinkResource } from "models/link"; import { resourceIsFrozen } from "common/frozen-resources"; import { ProjectResource } from "models/project"; +import { filterCollectionFilesBySelection } from "store/collection-panel/collection-panel-files/collection-panel-files-state"; export const contextMenuActions = unionize({ OPEN_CONTEXT_MENU: ofType<{ position: ContextMenuPosition; resource: ContextMenuResource }>(), @@ -68,7 +69,8 @@ export const openContextMenu = (event: React.MouseEvent, resource: export const openCollectionFilesContextMenu = (event: React.MouseEvent, isWritable: boolean) => (dispatch: Dispatch, getState: () => RootState) => { - const isCollectionFileSelected = JSON.stringify(getState().collectionPanelFiles).includes('"selected":true'); + const selectedCount = filterCollectionFilesBySelection(getState().collectionPanelFiles, true).length; + const multiple = selectedCount > 1; dispatch( openContextMenu(event, { name: "", @@ -76,11 +78,16 @@ export const openCollectionFilesContextMenu = ownerUuid: "", description: "", kind: ResourceKind.COLLECTION, - menuKind: isCollectionFileSelected - ? isWritable - ? ContextMenuKind.COLLECTION_FILES - : ContextMenuKind.READONLY_COLLECTION_FILES - : ContextMenuKind.COLLECTION_FILES_NOT_SELECTED, + menuKind: + selectedCount > 0 + ? isWritable + ? multiple + ? ContextMenuKind.COLLECTION_FILES_MULTIPLE + : ContextMenuKind.COLLECTION_FILES + : multiple + ? ContextMenuKind.READONLY_COLLECTION_FILES_MULTIPLE + : ContextMenuKind.READONLY_COLLECTION_FILES + : ContextMenuKind.COLLECTION_FILES_NOT_SELECTED, }) ); }; -- 2.30.2