X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/4d2ff0c66175bf47c5643e9500c2cc6d7caf8c8b..2e21cc7eeaecd3282d464c096549486b391c9461:/src/store/processes/process-update-actions.ts diff --git a/src/store/processes/process-update-actions.ts b/src/store/processes/process-update-actions.ts index 1d6d95bb..c7fd1b55 100644 --- a/src/store/processes/process-update-actions.ts +++ b/src/store/processes/process-update-actions.ts @@ -4,13 +4,13 @@ import { Dispatch } from "redux"; import { FormErrors, initialize, startSubmit, stopSubmit } from 'redux-form'; -import { RootState } from "~/store/store"; -import { dialogActions } from "~/store/dialog/dialog-actions"; -import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service"; -import { ServiceRepository } from "~/services/services"; -import { getProcess } from '~/store/processes/process'; -import { projectPanelActions } from '~/store/project-panel/project-panel-action'; -import { snackbarActions } from '~/store/snackbar/snackbar-actions'; +import { RootState } from "store/store"; +import { dialogActions } from "store/dialog/dialog-actions"; +import { getCommonResourceServiceError, CommonResourceServiceError } from "services/common-service/common-resource-service"; +import { ServiceRepository } from "services/services"; +import { getProcess } from 'store/processes/process'; +import { projectPanelActions } from 'store/project-panel/project-panel-action'; +import {snackbarActions, SnackbarKind} from 'store/snackbar/snackbar-actions'; export interface ProcessUpdateFormDialogData { uuid: string; @@ -27,7 +27,7 @@ export const openProcessUpdateDialog = (resource: ProcessUpdateFormDialogData) = dispatch(initialize(PROCESS_UPDATE_FORM_NAME, { ...resource, name: process.containerRequest.name })); dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_UPDATE_FORM_NAME, data: {} })); } else { - dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process not found', hideDuration: 2000 })); + dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process not found', hideDuration: 2000, kind: SnackbarKind.ERROR })); } }; @@ -41,11 +41,11 @@ export const updateProcess = (resource: ProcessUpdateFormDialogData) => return updatedProcess; } catch (e) { const error = getCommonResourceServiceError(e); - if (error === CommonResourceServiceError.UNIQUE_VIOLATION) { + if (error === CommonResourceServiceError.UNIQUE_NAME_VIOLATION) { dispatch(stopSubmit(PROCESS_UPDATE_FORM_NAME, { name: 'Process with the same name already exists.' } as FormErrors)); } else { dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_UPDATE_FORM_NAME })); - dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not update the process.', hideDuration: 2000 })); + dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not update the process.', hideDuration: 2000, kind: SnackbarKind.ERROR })); } return; }