From 44ff0e7b4a08483315107bce3ce1d3d478a4d849 Mon Sep 17 00:00:00 2001 From: Mikhail Sidarkevich <42434528+chivekrodis@users.noreply.github.com> Date: Mon, 28 Mar 2022 11:18:30 +0300 Subject: [PATCH] EPMRPP-76232 || fix save comment for bulk operation, make decision modal (#3045) * EPMRPP-76232 || fix save comment for bulk operation * EPMRPP-76232 || code review fixes - 1 --- .../selectDefectManually.jsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/pages/inside/stepPage/modals/makeDecisionModal/tabs/selectDefectManually/selectDefectManually.jsx b/app/src/pages/inside/stepPage/modals/makeDecisionModal/tabs/selectDefectManually/selectDefectManually.jsx index 72b5f4e82d..ea616bfa3d 100644 --- a/app/src/pages/inside/stepPage/modals/makeDecisionModal/tabs/selectDefectManually/selectDefectManually.jsx +++ b/app/src/pages/inside/stepPage/modals/makeDecisionModal/tabs/selectDefectManually/selectDefectManually.jsx @@ -37,7 +37,12 @@ import { debugModeSelector } from 'controllers/launch'; import { SCREEN_SM_MAX, SCREEN_XS_MAX } from 'common/constants/screenSizeVariables'; import { TO_INVESTIGATE_LOCATOR_PREFIX } from 'common/constants/defectTypes'; import { InputCheckbox } from 'components/inputs/inputCheckbox'; -import { SELECT_DEFECT_MANUALLY } from '../../constants'; +import { + ADD_FOR_ALL, + NOT_CHANGED_FOR_ALL, + REPLACE_FOR_ALL, + SELECT_DEFECT_MANUALLY, +} from '../../constants'; import { messages } from '../../messages'; import { ActionButtonsBar } from './actionButtonsBar'; import styles from './selectDefectManually.scss'; @@ -88,6 +93,17 @@ export const SelectDefectManually = ({ }; const handleDefectCommentChange = (value) => { handleManualChange({ comment: value.trim() }); + if (isBulkOperation) { + const isValueEmpty = value.trim() === ''; + if (!source.issue.comment && !isValueEmpty) { + setModalState({ commentOption: ADD_FOR_ALL }); + } else if ( + isValueEmpty && + [ADD_FOR_ALL, REPLACE_FOR_ALL].includes(modalState.commentOption) + ) { + setModalState({ commentOption: NOT_CHANGED_FOR_ALL }); + } + } }; const getActionItems = () => {