Skip to content

Commit

Permalink
Impl [Jobs] Add reason for job failure in UI next to the red status i…
Browse files Browse the repository at this point in the history
…ndicator (#2820)
  • Loading branch information
illia-prokopchuk authored Oct 14, 2024
1 parent 3d8bcb5 commit 3a70b6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/utils/getState.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 : ''}`
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/parseJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 3a70b6c

Please sign in to comment.