From 15469ba0284ac7d26de058cff4ae4e6ce6abc74f Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Tue, 17 Oct 2023 10:18:06 -0400 Subject: [PATCH] 15768: changed isSingle to fromContextMenu for clarity Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- src/store/collections/collection-copy-actions.ts | 10 +++++----- src/store/context-menu/context-menu-actions.ts | 2 +- src/store/copy-dialog/copy-dialog.ts | 2 +- src/store/move-to-dialog/move-to-dialog.ts | 2 +- src/store/processes/processes-actions.ts | 2 +- src/store/workbench/workbench-actions.ts | 14 +++++++------- .../action-sets/collection-action-set.ts | 2 +- src/views-components/context-menu/context-menu.tsx | 2 +- .../ms-collection-action-set.ts | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/store/collections/collection-copy-actions.ts b/src/store/collections/collection-copy-actions.ts index 9386fe3c..c332ef5f 100644 --- a/src/store/collections/collection-copy-actions.ts +++ b/src/store/collections/collection-copy-actions.ts @@ -19,25 +19,25 @@ import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions"; export const COLLECTION_COPY_FORM_NAME = "collectionCopyFormName"; export const COLLECTION_MULTI_COPY_FORM_NAME = "collectionMultiCopyFormName"; -export const openCollectionCopyDialog = (resource: { name: string; uuid: string; isSingle?: boolean }) => (dispatch: Dispatch) => { +export const openCollectionCopyDialog = (resource: { name: string; uuid: string; fromContextMenu?: boolean }) => (dispatch: Dispatch) => { dispatch(resetPickerProjectTree()); dispatch(initProjectsTreePicker(COLLECTION_COPY_FORM_NAME)); - const initialData: CopyFormDialogData = { name: `Copy of: ${resource.name}`, ownerUuid: "", uuid: resource.uuid, isSingle: resource.isSingle }; + const initialData: CopyFormDialogData = { name: `Copy of: ${resource.name}`, ownerUuid: "", uuid: resource.uuid, fromContextMenu: resource.fromContextMenu }; dispatch(initialize(COLLECTION_COPY_FORM_NAME, initialData)); dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_COPY_FORM_NAME, data: {} })); }; -export const openMultiCollectionCopyDialog = (resource: { name: string; uuid: string; isSingle?: boolean }) => (dispatch: Dispatch) => { +export const openMultiCollectionCopyDialog = (resource: { name: string; uuid: string; fromContextMenu?: boolean }) => (dispatch: Dispatch) => { dispatch(resetPickerProjectTree()); dispatch(initProjectsTreePicker(COLLECTION_MULTI_COPY_FORM_NAME)); - const initialData: CopyFormDialogData = { name: `Copy of: ${resource.name}`, ownerUuid: "", uuid: resource.uuid, isSingle: resource.isSingle }; + const initialData: CopyFormDialogData = { name: `Copy of: ${resource.name}`, ownerUuid: "", uuid: resource.uuid, fromContextMenu: resource.fromContextMenu }; dispatch(initialize(COLLECTION_MULTI_COPY_FORM_NAME, initialData)); dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_MULTI_COPY_FORM_NAME, data: {} })); }; export const copyCollection = (resource: CopyFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - const formName = resource.isSingle ? COLLECTION_COPY_FORM_NAME : COLLECTION_MULTI_COPY_FORM_NAME; + const formName = resource.fromContextMenu ? COLLECTION_COPY_FORM_NAME : COLLECTION_MULTI_COPY_FORM_NAME; dispatch(startSubmit(formName)); let collection = getResource(resource.uuid)(getState().resources); try { diff --git a/src/store/context-menu/context-menu-actions.ts b/src/store/context-menu/context-menu-actions.ts index da6dac5d..f846d25b 100644 --- a/src/store/context-menu/context-menu-actions.ts +++ b/src/store/context-menu/context-menu-actions.ts @@ -48,7 +48,7 @@ export type ContextMenuResource = { storageClassesDesired?: string[]; properties?: { [key: string]: string | string[] }; isMulti?: boolean; - isSingle?: boolean; + fromContextMenu?: boolean; }; export const isKeyboardClick = (event: React.MouseEvent) => event.nativeEvent.detail === 0; diff --git a/src/store/copy-dialog/copy-dialog.ts b/src/store/copy-dialog/copy-dialog.ts index af4d7ace..dfae5c2c 100644 --- a/src/store/copy-dialog/copy-dialog.ts +++ b/src/store/copy-dialog/copy-dialog.ts @@ -6,5 +6,5 @@ export interface CopyFormDialogData { name: string; uuid: string; ownerUuid: string; - isSingle?: boolean; + fromContextMenu?: boolean; } diff --git a/src/store/move-to-dialog/move-to-dialog.ts b/src/store/move-to-dialog/move-to-dialog.ts index 12f2e858..e58f3984 100644 --- a/src/store/move-to-dialog/move-to-dialog.ts +++ b/src/store/move-to-dialog/move-to-dialog.ts @@ -6,5 +6,5 @@ export interface MoveToFormDialogData { name: string; uuid: string; ownerUuid: string; - isSingle?: boolean; + fromContextMenu?: boolean; } diff --git a/src/store/processes/processes-actions.ts b/src/store/processes/processes-actions.ts index 1b9d725e..eadb05e5 100644 --- a/src/store/processes/processes-actions.ts +++ b/src/store/processes/processes-actions.ts @@ -316,7 +316,7 @@ export const removeProcessPermanently = (uuid: string) => async (dispatch: Dispa const resource = getState().dialog.removeProcessDialog.data.resource; const checkedList = getState().multiselect.checkedList; - const uuidsToRemove: string[] = resource.isSingle ? [resource.uuid] : selectedToArray(checkedList); + const uuidsToRemove: string[] = resource.fromContextMenu ? [resource.uuid] : selectedToArray(checkedList); //if no items in checkedlist, default to normal context menu behavior if (!uuidsToRemove.length) uuidsToRemove.push(uuid); diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts index bf21bd3f..956fa3d9 100644 --- a/src/store/workbench/workbench-actions.ts +++ b/src/store/workbench/workbench-actions.ts @@ -279,7 +279,7 @@ export const moveProject = (data: MoveToFormDialogData, isSecondaryMove = false) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const checkedList = getState().multiselect.checkedList; - const uuidsToMove: string[] = data.isSingle ? [data.uuid] : selectedToArray(checkedList); + const uuidsToMove: string[] = data.fromContextMenu ? [data.uuid] : selectedToArray(checkedList); //if no items in checkedlist default to normal context menu behavior if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid); @@ -423,7 +423,7 @@ export const createCollection = (data: collectionCreateActions.CollectionCreateF export const copyCollection = (data: CopyFormDialogData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const checkedList = getState().multiselect.checkedList; - const uuidsToCopy: string[] = data.isSingle ? [data.uuid] : selectedToArray(checkedList); + const uuidsToCopy: string[] = data.fromContextMenu ? [data.uuid] : selectedToArray(checkedList); //if no items in checkedlist && no items passed in, default to normal context menu behavior if (!uuidsToCopy.length) uuidsToCopy.push(data.uuid); @@ -437,13 +437,13 @@ export const copyCollection = (data: CopyFormDialogData) => async (dispatch: Dis } async function copySingleCollection(copyToProject: CollectionCopyResource) { - const newName = data.isSingle || collectionsToCopy.length === 1 ? data.name : `Copy of: ${copyToProject.name}`; + const newName = data.fromContextMenu || collectionsToCopy.length === 1 ? data.name : `Copy of: ${copyToProject.name}`; try { const collection = await dispatch( collectionCopyActions.copyCollection({ ...copyToProject, name: newName, - isSingle: collectionsToCopy.length === 1 ? true : data.isSingle, + fromContextMenu: collectionsToCopy.length === 1 ? true : data.fromContextMenu, }) ); if (copyToProject && collection) { @@ -475,7 +475,7 @@ export const moveCollection = (data: MoveToFormDialogData, isSecondaryMove = false) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const checkedList = getState().multiselect.checkedList; - const uuidsToMove: string[] = data.isSingle ? [data.uuid] : selectedToArray(checkedList); + const uuidsToMove: string[] = data.fromContextMenu ? [data.uuid] : selectedToArray(checkedList); //if no items in checkedlist && no items passed in, default to normal context menu behavior if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid); @@ -597,7 +597,7 @@ export const moveProcess = (data: MoveToFormDialogData, isSecondaryMove = false) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const checkedList = getState().multiselect.checkedList; - const uuidsToMove: string[] = data.isSingle ? [data.uuid] : selectedToArray(checkedList); + const uuidsToMove: string[] = data.fromContextMenu ? [data.uuid] : selectedToArray(checkedList); //if no items in checkedlist && no items passed in, default to normal context menu behavior if (!isSecondaryMove && !uuidsToMove.length) uuidsToMove.push(data.uuid); @@ -831,7 +831,7 @@ const groupContentsHandlers = unionize(groupContentsHandlersRecord); type GroupContentsHandler = UnionOf; -type CollectionCopyResource = Resource & { name: string; isSingle: boolean }; +type CollectionCopyResource = Resource & { name: string; fromContextMenu: boolean }; type MoveableResource = Resource & { name: string }; diff --git a/src/views-components/context-menu/action-sets/collection-action-set.ts b/src/views-components/context-menu/action-sets/collection-action-set.ts index 2b343001..95aec9c7 100644 --- a/src/views-components/context-menu/action-sets/collection-action-set.ts +++ b/src/views-components/context-menu/action-sets/collection-action-set.ts @@ -65,7 +65,7 @@ const commonActionSet: ContextMenuActionSet = [ icon: CopyIcon, name: "Make a copy", execute: (dispatch, resources) => { - if (resources[0].isSingle || resources.length === 1) dispatch(openCollectionCopyDialog(resources[0])); + if (resources[0].fromContextMenu || resources.length === 1) dispatch(openCollectionCopyDialog(resources[0])); else dispatch(openMultiCollectionCopyDialog(resources[0])); }, }, diff --git a/src/views-components/context-menu/context-menu.tsx b/src/views-components/context-menu/context-menu.tsx index 8cb3394a..157d4a72 100644 --- a/src/views-components/context-menu/context-menu.tsx +++ b/src/views-components/context-menu/context-menu.tsx @@ -52,7 +52,7 @@ const mapDispatchToProps = (dispatch: Dispatch): ActionProps => ({ const handleItemClick = memoize( (resource: DataProps["resource"], onItemClick: ActionProps["onItemClick"]): ContextMenuProps["onItemClick"] => item => { - onItemClick(item, { ...resource, isSingle: true } as ContextMenuResource); + onItemClick(item, { ...resource, fromContextMenu: true } as ContextMenuResource); } ); diff --git a/src/views-components/multiselect-toolbar/ms-collection-action-set.ts b/src/views-components/multiselect-toolbar/ms-collection-action-set.ts index 3f6b2c38..b0a2a1b0 100644 --- a/src/views-components/multiselect-toolbar/ms-collection-action-set.ts +++ b/src/views-components/multiselect-toolbar/ms-collection-action-set.ts @@ -16,7 +16,7 @@ export const msCollectionActionSet: ContextMenuActionSet = [ icon: CopyIcon, name: "Make a copy", execute: (dispatch, [...resources]) => { - if (resources[0].isSingle || resources.length === 1) dispatch(openCollectionCopyDialog(resources[0])); + if (resources[0].fromContextMenu || resources.length === 1) dispatch(openCollectionCopyDialog(resources[0])); else dispatch(openMultiCollectionCopyDialog(resources[0])); }, }, -- 2.30.2