diff --git a/src/utils/getState.js b/src/utils/getState.js index 9055a7f04..5051c9087 100644 --- a/src/utils/getState.js +++ b/src/utils/getState.js @@ -21,7 +21,7 @@ such restriction. import { isEmpty } from 'lodash' import { FUNCTION_INITIALIZED_STATE, FUNCTIONS_PAGE, JOBS_MONITORING_WORKFLOWS_TAB } from '../constants' -const getState = (state, page, kind) => { +const getState = (state, page, kind, reason = '') => { const stateExists = !isEmpty(state) if (page === FUNCTIONS_PAGE) { @@ -33,9 +33,12 @@ const getState = (state, page, kind) => { }` } } else { + const commonLabel = state ? commonStateLabels(page === JOBS_MONITORING_WORKFLOWS_TAB)[state] : '' + const label = reason && commonLabel === 'Error' ? `${commonLabel}. Reason: ${reason}` : commonLabel + return { value: state ?? null, - label: state ? commonStateLabels(page === JOBS_MONITORING_WORKFLOWS_TAB)[state] : '', + label: label, className: `state${state ? '-' + state : ''}${kind ? '-' + kind : ''}` } } diff --git a/src/utils/parseJob.js b/src/utils/parseJob.js index 3945573a0..8bfa06eae 100644 --- a/src/utils/parseJob.js +++ b/src/utils/parseJob.js @@ -91,7 +91,7 @@ export const parseJob = (job, tab, customState, customError) => { results: job.status?.results || {}, resultsChips: parseKeyValues(job.status?.results || {}), startTime: new Date(job.status?.start_time), - state: getState(customState || job.status?.state, JOBS_PAGE, JOB_KIND_JOB), + state: getState(customState || job.status?.state, JOBS_PAGE, JOB_KIND_JOB, job.status?.reason), ui_run: job.status?.ui_url, uid: job.metadata.uid, updated: new Date(job.status?.last_update),