diff --git a/gui/src/components/ImageHistory.tsx b/gui/src/components/ImageHistory.tsx index 38d9e9bb..56f061a5 100644 --- a/gui/src/components/ImageHistory.tsx +++ b/gui/src/components/ImageHistory.tsx @@ -32,6 +32,7 @@ export function ImageHistory() { case JobStatus.SUCCESS: children.push([key, ]); break; + case JobStatus.UNKNOWN: case JobStatus.FAILED: children.push([key, ]); break; diff --git a/gui/src/components/card/ErrorCard.tsx b/gui/src/components/card/ErrorCard.tsx index 78b2698e..d9f3fb96 100644 --- a/gui/src/components/card/ErrorCard.tsx +++ b/gui/src/components/card/ErrorCard.tsx @@ -10,10 +10,10 @@ import { useStore } from 'zustand'; import { shallow } from 'zustand/shallow'; import { ClientContext, ConfigContext, OnnxState, StateContext } from '../../state/full.js'; -import { FailedJobResponse, RetryParams } from '../../types/api-v2.js'; +import { FailedJobResponse, JobStatus, RetryParams, UnknownJobResponse } from '../../types/api-v2.js'; export interface ErrorCardProps { - image: FailedJobResponse; + image: FailedJobResponse | UnknownJobResponse; retry: Maybe; } @@ -54,7 +54,7 @@ export function ErrorCard(props: ErrorCardProps) { {t('loading.progress', image.steps)}
- {image.error} + {getImageErrorReason(image)}
@@ -82,3 +82,11 @@ export function selectActions(state: OnnxState) { removeHistory: state.removeHistory, }; } + +export function getImageErrorReason(image: FailedJobResponse | UnknownJobResponse) { + if (image.status === JobStatus.FAILED) { + return image.error; + } + + return image.reason; +} diff --git a/gui/src/types/api-v2.ts b/gui/src/types/api-v2.ts index 875a84ee..1135a6a6 100644 --- a/gui/src/types/api-v2.ts +++ b/gui/src/types/api-v2.ts @@ -62,6 +62,20 @@ export interface BaseJobResponse { export interface CancelledJobResponse extends BaseJobResponse { status: JobStatus.CANCELLED; + + /** + * Error message to indicate if the job was cancelled by a client, admin, or the server. + */ + reason: string; +} + +export interface UnknownJobResponse extends BaseJobResponse { + status: JobStatus.UNKNOWN; + + /** + * Error message to indicate why the job was marked as unknown, if there are extenuating circumstances. + */ + reason: string; } /** @@ -157,7 +171,8 @@ export type JobResponse | PendingJobResponse | RunningJobResponse | FailedJobResponse - | SuccessJobResponse; + | SuccessJobResponse + | UnknownJobResponse; /** * Status response from the job endpoint, with parameters to retry the job if it fails.