From 65cee2d29cdb17ff94ee6863502bbeb48d37acac Mon Sep 17 00:00:00 2001 From: ilan7empest Date: Thu, 5 Oct 2023 23:19:24 +0900 Subject: [PATCH 1/2] Fix [Jobs] missing error reason when job abort fails 1.5.x --- src/components/Jobs/jobs.util.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Jobs/jobs.util.js b/src/components/Jobs/jobs.util.js index dfd5b1347f..3e9c9d3c3f 100644 --- a/src/components/Jobs/jobs.util.js +++ b/src/components/Jobs/jobs.util.js @@ -32,6 +32,7 @@ import { SCHEDULE_TAB, JOB_KIND_SPARK } from '../../constants' +import { CONFLICT_ERROR_STATUS_CODE } from 'igz-controls/constants' import jobsActions from '../../actions/jobs' import { generateKeyValues } from '../../utils' import { setNotification } from '../../reducers/notificationReducer' @@ -259,10 +260,10 @@ export const handleAbortJob = ( }) ) }) - .catch(() => { + .catch(error => { dispatch( setNotification({ - status: 400, + status: error.response?.status || 400, id: Math.random(), retry: () => handleAbortJob( @@ -275,7 +276,10 @@ export const handleAbortJob = ( setConfirmData, dispatch ), - message: 'Aborting job failed' + message: + error.response?.status === CONFLICT_ERROR_STATUS_CODE && error.response?.data?.detail + ? error.response.data.detail + : 'Aborting job failed' }) ) }) From 354557beadbcc2c0799d87dd92b1afc30636a7d1 Mon Sep 17 00:00:00 2001 From: ilan7empest Date: Thu, 5 Oct 2023 23:43:28 +0900 Subject: [PATCH 2/2] Fix by code review --- src/components/Jobs/jobs.util.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/Jobs/jobs.util.js b/src/components/Jobs/jobs.util.js index 3e9c9d3c3f..d9cb9a1dcb 100644 --- a/src/components/Jobs/jobs.util.js +++ b/src/components/Jobs/jobs.util.js @@ -276,10 +276,7 @@ export const handleAbortJob = ( setConfirmData, dispatch ), - message: - error.response?.status === CONFLICT_ERROR_STATUS_CODE && error.response?.data?.detail - ? error.response.data.detail - : 'Aborting job failed' + message: error.response?.data?.detail || 'Aborting job failed' }) ) })