Skip to content

Commit

Permalink
EPMRPP-75925 || fix apply button on unique err page, make decision mo…
Browse files Browse the repository at this point in the history
…dal (#3038)

* EPMRPP-75925 || fix apply button on unique err page, make decision modal

* EPMRPP-75925 || code review fixes - 1
  • Loading branch information
chivekrodis authored and AmsterGet committed Mar 29, 2022
1 parent 44ff0e7 commit 34586ab
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,22 @@ const MakeDecision = ({ data }) => {
const [modalHasChanges, setModalHasChanges] = useState(false);
const [loadingMLSuggest, setLoadingMLSuggest] = useState(false);
useEffect(() => {
setModalHasChanges(
(isBulkOperation
? !!modalState.selectManualChoice.issue.issueType ||
!!modalState.selectManualChoice.issue.comment ||
modalState.commentOption !== NOT_CHANGED_FOR_ALL
: !isEqual(itemData.issue, modalState[ACTIVE_TAB_MAP[modalState.decisionType]].issue)) ||
!!modalState.issueActionType,
);
let hasChanges;
const newIssueData = modalState[ACTIVE_TAB_MAP[modalState.decisionType]].issue;
if (
isBulkOperation &&
(!isMLSuggestionsAvailable || modalState.decisionType === SELECT_DEFECT_MANUALLY)
) {
hasChanges =
!!modalState.selectManualChoice.issue.issueType ||
!!modalState.selectManualChoice.issue.comment ||
modalState.commentOption !== NOT_CHANGED_FOR_ALL;
} else if (isBulkOperation && isMLSuggestionsAvailable) {
hasChanges = modalState.currentTestItems.some((item) => !isEqual(item.issue, newIssueData));
} else {
hasChanges = !isEqual(itemData.issue, newIssueData);
}
setModalHasChanges(hasChanges || !!modalState.issueActionType);
}, [modalState]);

useEffect(() => {
Expand Down

0 comments on commit 34586ab

Please sign in to comment.