});
cy.get('[data-cy=collection-files-panel-options-btn]').click();
- cy.get('[data-cy=context-menu]').contains('Create a new collection with selected').click();
+ cy.get('[data-cy=context-menu]').contains('Copy selected into new collection').click();
cy.get('[data-cy=form-dialog]').contains('Projects').click();
const allFiles = getNodeDescendants('')(tree).map(node => node.value);
const selectedDirectories = allFiles.filter(file => file.selected === selected && file.type === CollectionFileType.DIRECTORY);
const selectedFiles = allFiles.filter(file => file.selected === selected && !selectedDirectories.some(dir => dir.id === file.path));
- return [...selectedDirectories, ...selectedFiles];
+ return [...selectedDirectories, ...selectedFiles]
+ .filter((value, index, array) => (
+ array.indexOf(value) === index
+ ));
};
// SPDX-License-Identifier: AGPL-3.0
import { Dispatch } from 'redux';
-import { difference } from "lodash";
import { RootState } from 'store/store';
import { FormErrors, initialize, startSubmit, stopSubmit } from 'redux-form';
import { resetPickerProjectTree } from 'store/project-tree-picker/project-tree-picker-actions';
import { getCommonResourceServiceError, CommonResourceServiceError } from 'services/common-service/common-resource-service';
import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
import { initProjectsTreePicker } from "store/tree-picker/tree-picker-actions";
+import { updateResources } from 'store/resources/resources-actions';
export const COLLECTION_PARTIAL_COPY_FORM_NAME = 'COLLECTION_PARTIAL_COPY_DIALOG';
export const COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION = 'COLLECTION_PARTIAL_COPY_TO_SELECTED_DIALOG';
-export interface CollectionPartialCopyFormData {
+export interface CollectionPartialCopyToNewCollectionFormData {
name: string;
description: string;
projectUuid: string;
}
-export interface CollectionPartialCopyToSelectedCollectionFormData {
+export interface CollectionPartialCopyToExistingCollectionFormData {
collectionUuid: string;
}
-export const openCollectionPartialCopyDialog = () =>
+export const openCollectionPartialCopyToNewCollectionDialog = () =>
(dispatch: Dispatch, getState: () => RootState) => {
const currentCollection = getState().collectionPanel.item;
if (currentCollection) {
}
};
-export const copyCollectionPartial = ({ name, description, projectUuid }: CollectionPartialCopyFormData) =>
+export const copyCollectionPartialToNewCollection = ({ name, description, projectUuid }: CollectionPartialCopyToNewCollectionFormData) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch(startSubmit(COLLECTION_PARTIAL_COPY_FORM_NAME));
const state = getState();
}
};
-export const openCollectionPartialCopyToSelectedCollectionDialog = () =>
+export const openCollectionPartialCopyToExistingCollectionDialog = () =>
(dispatch: Dispatch, getState: () => RootState) => {
const currentCollection = getState().collectionPanel.item;
if (currentCollection) {
}
};
-export const copyCollectionPartialToSelectedCollection = ({ collectionUuid }: CollectionPartialCopyToSelectedCollectionFormData) =>
+export const copyCollectionPartialToExistingCollection = ({ collectionUuid }: CollectionPartialCopyToExistingCollectionFormData) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- dispatch(startSubmit(COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION));
const state = getState();
- const currentCollection = state.collectionPanel.item;
-
- if (currentCollection && !currentCollection.manifestText) {
- const fetchedCurrentCollection = await services.collectionService.get(currentCollection.uuid, undefined, ['manifestText']);
- currentCollection.manifestText = fetchedCurrentCollection.manifestText;
- currentCollection.unsignedManifestText = fetchedCurrentCollection.unsignedManifestText;
- }
+ // Get current collection
+ const sourceCollection = state.collectionPanel.item;
- if (currentCollection) {
+ if (sourceCollection) {
try {
+ dispatch(startSubmit(COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION));
dispatch(progressIndicatorActions.START_WORKING(COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION));
- const selectedCollection = await services.collectionService.get(collectionUuid);
- const paths = filterCollectionFilesBySelection(state.collectionPanelFiles, false).map(file => file.id);
- const pathsToRemove = paths.filter(path => {
- const a = path.split('/');
- const fileExistsInSelectedCollection = selectedCollection.manifestText.includes(a[1]);
- if (fileExistsInSelectedCollection) {
- return path;
- } else {
- return null;
- }
- });
- const diffPathToRemove = difference(paths, pathsToRemove);
- await services.collectionService.deleteFiles(selectedCollection.uuid, pathsToRemove.map(path => path.replace(currentCollection.uuid, collectionUuid)));
- const collectionWithDeletedFiles = await services.collectionService.get(collectionUuid, undefined, ['uuid', 'manifestText']);
- await services.collectionService.update(collectionUuid, { manifestText: `${collectionWithDeletedFiles.manifestText}${(currentCollection.manifestText ? currentCollection.manifestText : currentCollection.unsignedManifestText) || ''}` });
- await services.collectionService.deleteFiles(collectionWithDeletedFiles.uuid, diffPathToRemove.map(path => path.replace(currentCollection.uuid, collectionUuid)));
+ // Get selected files
+ const paths = filterCollectionFilesBySelection(state.collectionPanelFiles, true)
+ .map(file => file.id.replace(new RegExp(`(^${sourceCollection.uuid})`), ''));
+
+ // Copy files
+ const updatedCollection = await services.collectionService.copyFiles(sourceCollection.portableDataHash, paths, collectionUuid, '/', false);
+ dispatch(updateResources([updatedCollection]));
+
dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION }));
dispatch(snackbarActions.OPEN_SNACKBAR({
message: 'Files has been copied to selected collection.',
dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION));
}
}
- };
\ No newline at end of file
+ };
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { initialize, startSubmit } from "redux-form";
+import { CommonResourceServiceError, getCommonResourceServiceError } from "services/common-service/common-resource-service";
+import { ServiceRepository } from "services/services";
+import { filterCollectionFilesBySelection } from "store/collection-panel/collection-panel-files/collection-panel-files-state";
+import { dialogActions } from "store/dialog/dialog-actions";
+import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
+import { resetPickerProjectTree } from "store/project-tree-picker/project-tree-picker-actions";
+import { updateResources } from "store/resources/resources-actions";
+import { SnackbarKind, snackbarActions } from "store/snackbar/snackbar-actions";
+import { RootState } from "store/store";
+import { initProjectsTreePicker } from "store/tree-picker/tree-picker-actions";
+
+export const COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION = 'COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION_DIALOG';
+export const COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION = 'COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION_DIALOG';
+
+export interface CollectionPartialMoveToNewCollectionFormData {
+ name: string;
+ description: string;
+ projectUuid: string;
+}
+
+export interface CollectionPartialMoveToExistingCollectionFormData {
+ collectionUuid: string;
+}
+
+export const openCollectionPartialMoveToNewCollectionDialog = () =>
+ (dispatch: Dispatch, getState: () => RootState) => {
+ const currentCollection = getState().collectionPanel.item;
+ if (currentCollection) {
+ const initialData = {
+ name: `Files moved from: ${currentCollection.name}`,
+ description: currentCollection.description,
+ projectUuid: undefined
+ };
+ dispatch(initialize(COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION, initialData));
+ dispatch<any>(resetPickerProjectTree());
+ dispatch<any>(initProjectsTreePicker(COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION));
+ dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION, data: {} }));
+ }
+ };
+
+export const moveCollectionPartialToNewCollection = ({ name, description, projectUuid }: CollectionPartialMoveToNewCollectionFormData) =>
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const state = getState();
+ // Get current collection
+ const sourceCollection = state.collectionPanel.item;
+
+ if (sourceCollection) {
+ try {
+ dispatch(startSubmit(COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION));
+ dispatch(progressIndicatorActions.START_WORKING(COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION));
+
+ // Create new collection
+ const newCollection = await services.collectionService.create({
+ name,
+ description,
+ ownerUuid: projectUuid,
+ uuid: undefined,
+ });
+
+ // Get selected files
+ const paths = filterCollectionFilesBySelection(state.collectionPanelFiles, true)
+ .map(file => file.id.replace(new RegExp(`(^${sourceCollection.uuid})`), ''));
+
+ // Move files
+ const updatedCollection = await services.collectionService.moveFiles(sourceCollection.uuid, sourceCollection.portableDataHash, paths, newCollection.uuid, '/', false);
+ dispatch(updateResources([updatedCollection]));
+
+ dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION }));
+ dispatch(snackbarActions.OPEN_SNACKBAR({
+ message: 'Files have been moved to selected collection.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS
+ }));
+ dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION));
+ } catch (e) {
+ const error = getCommonResourceServiceError(e);
+ if (error === CommonResourceServiceError.UNKNOWN) {
+ dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION }));
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not move files to selected collection', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+ }
+ dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION));
+ }
+ }
+ };
+
+export const openCollectionPartialMoveToExistingCollectionDialog = () =>
+ (dispatch: Dispatch, getState: () => RootState) => {
+ const currentCollection = getState().collectionPanel.item;
+ if (currentCollection) {
+ const initialData = {
+ collectionUuid: ''
+ };
+ dispatch(initialize(COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION, initialData));
+ dispatch<any>(resetPickerProjectTree());
+ dispatch<any>(initProjectsTreePicker(COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION));
+ dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION, data: {} }));
+ }
+ };
+
+export const moveCollectionPartialToExistingCollection = ({ collectionUuid }: CollectionPartialMoveToExistingCollectionFormData) =>
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const state = getState();
+ // Get current collection
+ const sourceCollection = state.collectionPanel.item;
+
+ if (sourceCollection) {
+ try {
+ dispatch(startSubmit(COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION));
+ dispatch(progressIndicatorActions.START_WORKING(COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION));
+ // Get selected files
+ const paths = filterCollectionFilesBySelection(state.collectionPanelFiles, true)
+ .map(file => file.id.replace(new RegExp(`(^${sourceCollection.uuid})`), ''));
+
+ // Move files
+ const updatedCollection = await services.collectionService.moveFiles(sourceCollection.uuid, sourceCollection.portableDataHash, paths, collectionUuid, '/', false);
+ dispatch(updateResources([updatedCollection]));
+
+ dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION }));
+ dispatch(snackbarActions.OPEN_SNACKBAR({
+ message: 'Files have been moved to selected collection.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS
+ }));
+ dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION));
+ } catch (e) {
+ const error = getCommonResourceServiceError(e);
+ if (error === CommonResourceServiceError.UNKNOWN) {
+ dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION }));
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not copy this files to selected collection', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+ }
+ dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION));
+ }
+ }
+ };
import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set";
import { collectionPanelFilesAction, openMultipleFilesRemoveDialog } from "store/collection-panel/collection-panel-files/collection-panel-files-actions";
import {
- openCollectionPartialCopyDialog,
- // Disabled while addressing #18587
- // openCollectionPartialCopyToSelectedCollectionDialog
+ openCollectionPartialCopyToNewCollectionDialog,
+ openCollectionPartialCopyToExistingCollectionDialog
} from 'store/collections/collection-partial-copy-actions';
+import { openCollectionPartialMoveToExistingCollectionDialog, openCollectionPartialMoveToNewCollectionDialog } from "store/collections/collection-partial-move-actions";
// These action sets are used on the multi-select actions button.
export const readOnlyCollectionFilesActionSet: ContextMenuActionSet = [[
}
},
{
- name: "Create a new collection with selected",
+ name: "Copy selected into new collection",
execute: dispatch => {
- dispatch<any>(openCollectionPartialCopyDialog());
+ dispatch<any>(openCollectionPartialCopyToNewCollectionDialog());
}
},
- // Disabled while addressing #18587
- // {
- // name: "Copy selected into the collection",
- // execute: dispatch => {
- // dispatch<any>(openCollectionPartialCopyToSelectedCollectionDialog());
- // }
- // }
+ {
+ name: "Copy selected into existing collection",
+ execute: dispatch => {
+ dispatch<any>(openCollectionPartialCopyToExistingCollectionDialog());
+ }
+ }
]];
export const collectionFilesActionSet: ContextMenuActionSet = readOnlyCollectionFilesActionSet.concat([[
dispatch(openMultipleFilesRemoveDialog());
}
},
+ {
+ name: "Move selected into new collection",
+ execute: dispatch => {
+ dispatch<any>(openCollectionPartialMoveToNewCollectionDialog());
+ }
+ },
+ {
+ name: "Move selected into existing collection",
+ execute: dispatch => {
+ dispatch<any>(openCollectionPartialMoveToExistingCollectionDialog());
+ }
+ }
]]);
import { FormDialog } from 'components/form-dialog/form-dialog';
import { WithDialogProps } from 'store/dialog/with-dialog';
import { InjectedFormProps } from 'redux-form';
-import { CollectionPartialCopyToSelectedCollectionFormData } from 'store/collections/collection-partial-copy-actions';
+import { CollectionPartialCopyToExistingCollectionFormData } from 'store/collections/collection-partial-copy-actions';
import { PickerIdProp } from "store/tree-picker/picker-id";
import { CollectionPickerField } from 'views-components/form-fields/collection-form-fields';
-type DialogCollectionPartialCopyProps = WithDialogProps<string> & InjectedFormProps<CollectionPartialCopyToSelectedCollectionFormData>;
+type DialogCollectionPartialCopyProps = WithDialogProps<string> & InjectedFormProps<CollectionPartialCopyToExistingCollectionFormData>;
-export const DialogCollectionPartialCopyToSelectedCollection = (props: DialogCollectionPartialCopyProps & PickerIdProp) =>
+export const DialogCollectionPartialCopyToExistingCollection = (props: DialogCollectionPartialCopyProps & PickerIdProp) =>
<FormDialog
- dialogTitle='Choose collection'
+ dialogTitle='Copy to existing collection'
formFields={CollectionPartialCopyFields(props.pickerId)}
submitLabel='Copy files'
{...props}
/>;
-export const CollectionPartialCopyFields = memoize(
+const CollectionPartialCopyFields = memoize(
(pickerId: string) =>
() =>
<>
import { CollectionNameField, CollectionDescriptionField, CollectionProjectPickerField } from 'views-components/form-fields/collection-form-fields';
import { WithDialogProps } from 'store/dialog/with-dialog';
import { InjectedFormProps } from 'redux-form';
-import { CollectionPartialCopyFormData } from 'store/collections/collection-partial-copy-actions';
+import { CollectionPartialCopyToNewCollectionFormData } from 'store/collections/collection-partial-copy-actions';
import { PickerIdProp } from "store/tree-picker/picker-id";
-type DialogCollectionPartialCopyProps = WithDialogProps<string> & InjectedFormProps<CollectionPartialCopyFormData>;
+type DialogCollectionPartialCopyProps = WithDialogProps<string> & InjectedFormProps<CollectionPartialCopyToNewCollectionFormData>;
-export const DialogCollectionPartialCopy = (props: DialogCollectionPartialCopyProps & PickerIdProp) =>
+export const DialogCollectionPartialCopyToNewCollection = (props: DialogCollectionPartialCopyProps & PickerIdProp) =>
<FormDialog
- dialogTitle='Create a collection'
+ dialogTitle='Copy to new collection'
formFields={CollectionPartialCopyFields(props.pickerId)}
- submitLabel='Create a collection'
+ submitLabel='Create collection'
{...props}
/>;
-export const CollectionPartialCopyFields = memoize(
+const CollectionPartialCopyFields = memoize(
(pickerId: string) =>
() =>
<>
+++ /dev/null
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { compose } from "redux";
-import { reduxForm } from 'redux-form';
-import { withDialog, } from 'store/dialog/with-dialog';
-import { CollectionPartialCopyFormData, copyCollectionPartial, COLLECTION_PARTIAL_COPY_FORM_NAME } from 'store/collections/collection-partial-copy-actions';
-import { DialogCollectionPartialCopy } from "views-components/dialog-copy/dialog-collection-partial-copy";
-import { pickerId } from "store/tree-picker/picker-id";
-
-
-export const PartialCopyCollectionDialog = compose(
- withDialog(COLLECTION_PARTIAL_COPY_FORM_NAME),
- reduxForm<CollectionPartialCopyFormData>({
- form: COLLECTION_PARTIAL_COPY_FORM_NAME,
- onSubmit: (data, dispatch) => {
- dispatch(copyCollectionPartial(data));
- }
- }),
- pickerId(COLLECTION_PARTIAL_COPY_FORM_NAME),
-)(DialogCollectionPartialCopy);
\ No newline at end of file
import { compose } from "redux";
import { reduxForm } from 'redux-form';
import { withDialog, } from 'store/dialog/with-dialog';
-import { CollectionPartialCopyToSelectedCollectionFormData, copyCollectionPartialToSelectedCollection, COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION } from 'store/collections/collection-partial-copy-actions';
-import { DialogCollectionPartialCopyToSelectedCollection } from "views-components/dialog-copy/dialog-partial-copy-to-collection";
+import { CollectionPartialCopyToExistingCollectionFormData, copyCollectionPartialToExistingCollection, COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION } from 'store/collections/collection-partial-copy-actions';
+import { DialogCollectionPartialCopyToExistingCollection } from "views-components/dialog-copy/dialog-collection-partial-copy-to-existing-collection";
import { pickerId } from "store/tree-picker/picker-id";
-export const PartialCopyToCollectionDialog = compose(
+export const PartialCopyToExistingCollectionDialog = compose(
withDialog(COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION),
- reduxForm<CollectionPartialCopyToSelectedCollectionFormData>({
+ reduxForm<CollectionPartialCopyToExistingCollectionFormData>({
form: COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION,
onSubmit: (data, dispatch) => {
- dispatch(copyCollectionPartialToSelectedCollection(data));
+ dispatch(copyCollectionPartialToExistingCollection(data));
}
}),
pickerId(COLLECTION_PARTIAL_COPY_TO_SELECTED_COLLECTION),
-)(DialogCollectionPartialCopyToSelectedCollection);
\ No newline at end of file
+)(DialogCollectionPartialCopyToExistingCollection);
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { compose } from "redux";
+import { reduxForm } from 'redux-form';
+import { withDialog, } from 'store/dialog/with-dialog';
+import { CollectionPartialCopyToNewCollectionFormData, copyCollectionPartialToNewCollection, COLLECTION_PARTIAL_COPY_FORM_NAME } from 'store/collections/collection-partial-copy-actions';
+import { DialogCollectionPartialCopyToNewCollection } from "views-components/dialog-copy/dialog-collection-partial-copy-to-new-collection";
+import { pickerId } from "store/tree-picker/picker-id";
+
+export const PartialCopyToNewCollectionDialog = compose(
+ withDialog(COLLECTION_PARTIAL_COPY_FORM_NAME),
+ reduxForm<CollectionPartialCopyToNewCollectionFormData>({
+ form: COLLECTION_PARTIAL_COPY_FORM_NAME,
+ onSubmit: (data, dispatch) => {
+ dispatch(copyCollectionPartialToNewCollection(data));
+ }
+ }),
+ pickerId(COLLECTION_PARTIAL_COPY_FORM_NAME),
+)(DialogCollectionPartialCopyToNewCollection);
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { compose } from "redux";
+import { reduxForm } from 'redux-form';
+import { withDialog, } from 'store/dialog/with-dialog';
+import { COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION, CollectionPartialMoveToExistingCollectionFormData, moveCollectionPartialToExistingCollection } from "store/collections/collection-partial-move-actions";
+import { DialogCollectionPartialMoveToExistingCollection } from "views-components/dialog-move/dialog-collection-partial-move-to-existing-collection";
+import { pickerId } from "store/tree-picker/picker-id";
+
+export const PartialMoveToExistingCollectionDialog = compose(
+ withDialog(COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION),
+ reduxForm<CollectionPartialMoveToExistingCollectionFormData>({
+ form: COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION,
+ onSubmit: (data, dispatch) => {
+ dispatch(moveCollectionPartialToExistingCollection(data));
+ }
+ }),
+ pickerId(COLLECTION_PARTIAL_MOVE_TO_SELECTED_COLLECTION),
+)(DialogCollectionPartialMoveToExistingCollection);
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { compose } from "redux";
+import { reduxForm } from 'redux-form';
+import { withDialog, } from 'store/dialog/with-dialog';
+import { COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION, CollectionPartialMoveToNewCollectionFormData, moveCollectionPartialToNewCollection } from "store/collections/collection-partial-move-actions";
+import { DialogCollectionPartialMoveToNewCollection } from "views-components/dialog-move/dialog-collection-partial-move-to-new-collection";
+import { pickerId } from "store/tree-picker/picker-id";
+
+export const PartialMoveToNewCollectionDialog = compose(
+ withDialog(COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION),
+ reduxForm<CollectionPartialMoveToNewCollectionFormData>({
+ form: COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION,
+ onSubmit: (data, dispatch) => {
+ dispatch(moveCollectionPartialToNewCollection(data));
+ }
+ }),
+ pickerId(COLLECTION_PARTIAL_MOVE_TO_NEW_COLLECTION),
+)(DialogCollectionPartialMoveToNewCollection);
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import React from "react";
+import { memoize } from "lodash/fp";
+import { FormDialog } from 'components/form-dialog/form-dialog';
+import { WithDialogProps } from 'store/dialog/with-dialog';
+import { InjectedFormProps } from 'redux-form';
+import { CollectionPartialMoveToExistingCollectionFormData } from "store/collections/collection-partial-move-actions";
+import { PickerIdProp } from "store/tree-picker/picker-id";
+import { CollectionPickerField } from 'views-components/form-fields/collection-form-fields';
+
+type DialogCollectionPartialMoveProps = WithDialogProps<string> & InjectedFormProps<CollectionPartialMoveToExistingCollectionFormData>;
+
+export const DialogCollectionPartialMoveToExistingCollection = (props: DialogCollectionPartialMoveProps & PickerIdProp) =>
+ <FormDialog
+ dialogTitle='Move to existing collection'
+ formFields={CollectionPartialMoveFields(props.pickerId)}
+ submitLabel='Move files'
+ {...props}
+ />;
+
+const CollectionPartialMoveFields = memoize(
+ (pickerId: string) =>
+ () =>
+ <>
+ <CollectionPickerField {...{ pickerId }}/>
+ </>);
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import React from "react";
+import { memoize } from "lodash/fp";
+import { FormDialog } from 'components/form-dialog/form-dialog';
+import { CollectionNameField, CollectionDescriptionField, CollectionProjectPickerField } from 'views-components/form-fields/collection-form-fields';
+import { WithDialogProps } from 'store/dialog/with-dialog';
+import { InjectedFormProps } from 'redux-form';
+import { CollectionPartialMoveToNewCollectionFormData } from "store/collections/collection-partial-move-actions";
+import { PickerIdProp } from "store/tree-picker/picker-id";
+
+type DialogCollectionPartialMoveProps = WithDialogProps<string> & InjectedFormProps<CollectionPartialMoveToNewCollectionFormData>;
+
+export const DialogCollectionPartialMoveToNewCollection = (props: DialogCollectionPartialMoveProps & PickerIdProp) =>
+ <FormDialog
+ dialogTitle='Move to new collection'
+ formFields={CollectionPartialMoveFields(props.pickerId)}
+ submitLabel='Create collection'
+ {...props}
+ />;
+
+const CollectionPartialMoveFields = memoize(
+ (pickerId: string) =>
+ () =>
+ <>
+ <CollectionNameField />
+ <CollectionDescriptionField />
+ <CollectionProjectPickerField {...{ pickerId }} />
+ </>);
import { MoveProjectDialog } from 'views-components/dialog-forms/move-project-dialog';
import { MoveCollectionDialog } from 'views-components/dialog-forms/move-collection-dialog';
import { FilesUploadCollectionDialog } from 'views-components/dialog-forms/files-upload-collection-dialog';
-import { PartialCopyCollectionDialog } from 'views-components/dialog-forms/partial-copy-collection-dialog';
+import { PartialCopyToNewCollectionDialog } from 'views-components/dialog-forms/partial-copy-to-new-collection-dialog';
+import { PartialCopyToExistingCollectionDialog } from 'views-components/dialog-forms/partial-copy-to-existing-collection-dialog';
+import { PartialMoveToNewCollectionDialog } from 'views-components/dialog-forms/partial-move-to-new-collection-dialog';
+import { PartialMoveToExistingCollectionDialog } from 'views-components/dialog-forms/partial-move-to-existing-collection-dialog';
import { RemoveProcessDialog } from 'views-components/process-remove-dialog/process-remove-dialog';
import { MainContentBar } from 'views-components/main-content-bar/main-content-bar';
import { Grid } from '@material-ui/core';
import { GroupDetailsPanel } from 'views/group-details-panel/group-details-panel';
import { RemoveGroupMemberDialog } from 'views-components/groups-dialog/member-remove-dialog';
import { GroupMemberAttributesDialog } from 'views-components/groups-dialog/member-attributes-dialog';
-import { PartialCopyToCollectionDialog } from 'views-components/dialog-forms/partial-copy-to-collection-dialog';
import { PublicFavoritePanel } from 'views/public-favorites-panel/public-favorites-panel';
import { LinkAccountPanel } from 'views/link-account-panel/link-account-panel';
import { FedLogin } from './fed-login';
<MoveProjectDialog />
<MultipleFilesRemoveDialog />
<PublicKeyDialog />
- <PartialCopyCollectionDialog />
- <PartialCopyToCollectionDialog />
+ <PartialCopyToNewCollectionDialog />
+ <PartialCopyToExistingCollectionDialog />
+ <PartialMoveToNewCollectionDialog />
+ <PartialMoveToExistingCollectionDialog />
<ProcessInputDialog />
<RestoreCollectionVersionDialog />
<RemoveApiClientAuthorizationDialog />