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<any>(resetPickerProjectTree());
dispatch<any>(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<any>(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<any>(resetPickerProjectTree());
dispatch<any>(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<any>(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<CollectionResource>(resource.uuid)(getState().resources);
try {
storageClassesDesired?: string[];
properties?: { [key: string]: string | string[] };
isMulti?: boolean;
- isSingle?: boolean;
+ fromContextMenu?: boolean;
};
export const isKeyboardClick = (event: React.MouseEvent<HTMLElement>) => event.nativeEvent.detail === 0;
name: string;
uuid: string;
ownerUuid: string;
- isSingle?: boolean;
+ fromContextMenu?: boolean;
}
name: string;
uuid: string;
ownerUuid: string;
- isSingle?: boolean;
+ fromContextMenu?: boolean;
}
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);
(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);
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);
}
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<any>(
collectionCopyActions.copyCollection({
...copyToProject,
name: newName,
- isSingle: collectionsToCopy.length === 1 ? true : data.isSingle,
+ fromContextMenu: collectionsToCopy.length === 1 ? true : data.fromContextMenu,
})
);
if (copyToProject && collection) {
(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);
(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);
type GroupContentsHandler = UnionOf<typeof groupContentsHandlers>;
-type CollectionCopyResource = Resource & { name: string; isSingle: boolean };
+type CollectionCopyResource = Resource & { name: string; fromContextMenu: boolean };
type MoveableResource = Resource & { name: string };
icon: CopyIcon,
name: "Make a copy",
execute: (dispatch, resources) => {
- if (resources[0].isSingle || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
+ if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
},
},
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);
}
);
icon: CopyIcon,
name: "Make a copy",
execute: (dispatch, [...resources]) => {
- if (resources[0].isSingle || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
+ if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
},
},