From: Michal Klobukowski Date: Tue, 28 Aug 2018 12:24:16 +0000 (+0200) Subject: Update const name X-Git-Tag: 1.3.0~131^2~1 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/9f4bca6531631fc5ed21435f31db36720d58512b?hp=d37d39ad8825b03c39915e1258e294abcf0c3b6a Update const name Feature #14119 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- diff --git a/src/store/collections/collection-partial-copy-actions.ts b/src/store/collections/collection-partial-copy-actions.ts index cba23abb..f0dd2780 100644 --- a/src/store/collections/collection-partial-copy-actions.ts +++ b/src/store/collections/collection-partial-copy-actions.ts @@ -12,7 +12,7 @@ import { filterCollectionFilesBySelection } from '../collection-panel/collection import { snackbarActions } from '~/store/snackbar/snackbar-actions'; import { getCommonResourceServiceError, CommonResourceServiceError } from '~/common/api/common-resource-service'; -export const COLLECTION_PARTIAL_COPY_DIALOG = 'COLLECTION_PARTIAL_COPY_DIALOG'; +export const COLLECTION_PARTIAL_COPY_FORM_NAME = 'COLLECTION_PARTIAL_COPY_DIALOG'; export interface CollectionPartialCopyFormData { name: string; @@ -29,15 +29,15 @@ export const openCollectionPartialCopyDialog = () => description: currentCollection.description, projectUuid: '' }; - dispatch(initialize(COLLECTION_PARTIAL_COPY_DIALOG, initialData)); + dispatch(initialize(COLLECTION_PARTIAL_COPY_FORM_NAME, initialData)); dispatch(resetPickerProjectTree()); - dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY_DIALOG, data: {} })); + dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY_FORM_NAME, data: {} })); } }; export const doCollectionPartialCopy = ({ name, description, projectUuid }: CollectionPartialCopyFormData) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - dispatch(startSubmit(COLLECTION_PARTIAL_COPY_DIALOG)); + dispatch(startSubmit(COLLECTION_PARTIAL_COPY_FORM_NAME)); const state = getState(); const currentCollection = state.collectionPanel.item; if (currentCollection) { @@ -53,17 +53,17 @@ export const doCollectionPartialCopy = ({ name, description, projectUuid }: Coll const newCollection = await services.collectionService.create(collectionCopy); const paths = filterCollectionFilesBySelection(state.collectionPanelFiles, false).map(file => file.id); await services.collectionService.deleteFiles(newCollection.uuid, paths); - dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_DIALOG })); + dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_FORM_NAME })); dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'New collection created.', hideDuration: 2000 })); } catch (e) { const error = getCommonResourceServiceError(e); if (error === CommonResourceServiceError.UNIQUE_VIOLATION) { - dispatch(stopSubmit(COLLECTION_PARTIAL_COPY_DIALOG, { name: 'Collection with this name already exists.' })); + dispatch(stopSubmit(COLLECTION_PARTIAL_COPY_FORM_NAME, { name: 'Collection with this name already exists.' })); } else if (error === CommonResourceServiceError.UNKNOWN) { - dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_DIALOG })); + dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_FORM_NAME })); dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not create a copy of collection', hideDuration: 2000 })); } else { - dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_DIALOG })); + dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_PARTIAL_COPY_FORM_NAME })); dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Collection has been copied but may contain incorrect files.', hideDuration: 2000 })); } } diff --git a/src/views-components/dialog-forms/collection-partial-copy-dialog.ts b/src/views-components/dialog-forms/collection-partial-copy-dialog.ts index 33f6c257..801f62c8 100644 --- a/src/views-components/dialog-forms/collection-partial-copy-dialog.ts +++ b/src/views-components/dialog-forms/collection-partial-copy-dialog.ts @@ -5,14 +5,14 @@ import { compose } from "redux"; import { reduxForm } from 'redux-form'; import { withDialog, } from '~/store/dialog/with-dialog'; -import { CollectionPartialCopyFormData, doCollectionPartialCopy, COLLECTION_PARTIAL_COPY_DIALOG } from '~/store/collections/collection-partial-copy-actions'; +import { CollectionPartialCopyFormData, doCollectionPartialCopy, COLLECTION_PARTIAL_COPY_FORM_NAME } from '~/store/collections/collection-partial-copy-actions'; import { CollectionPartialCopyDialog as Dialog } from "~/views-components/dialog-copy/collection-partial-copy-dialog"; export const CollectionPartialCopyDialog = compose( - withDialog(COLLECTION_PARTIAL_COPY_DIALOG), + withDialog(COLLECTION_PARTIAL_COPY_FORM_NAME), reduxForm({ - form: COLLECTION_PARTIAL_COPY_DIALOG, + form: COLLECTION_PARTIAL_COPY_FORM_NAME, onSubmit: (data: CollectionPartialCopyFormData, dispatch) => { dispatch(doCollectionPartialCopy(data)); }