add error_reason to UI if import fails

This commit is contained in:
Mary Hipp 2024-02-23 10:41:58 -05:00 committed by psychedelicious
parent 53f0090197
commit 625c86ba9a
4 changed files with 105 additions and 99 deletions

View File

@ -46,13 +46,14 @@ export const addModelInstallEventListener = () => {
startAppListening({
actionCreator: socketModelInstallError,
effect: (action, { dispatch }) => {
const { id } = action.payload.data;
const { id, error_type } = action.payload.data;
dispatch(
modelsApi.util.updateQueryData('getModelImports', undefined, (draft) => {
const modelImport = draft.find((m) => m.id === id);
if (modelImport) {
modelImport.status = 'error';
modelImport.error_reason = error_type
}
return draft;
})

View File

@ -12,7 +12,7 @@ const STATUSES = {
cancelled: { colorScheme: 'orange', translationKey: 'queue.canceled' },
};
const ImportQueueBadge = ({ status, detail }: { status?: ModelInstallStatus; detail?: string }) => {
const ImportQueueBadge = ({ status, errorReason }: { status?: ModelInstallStatus; errorReason?: string | null }) => {
const { t } = useTranslation();
if (!status) {
@ -20,7 +20,7 @@ const ImportQueueBadge = ({ status, detail }: { status?: ModelInstallStatus; det
}
return (
<Tooltip label={detail}>
<Tooltip label={errorReason}>
<Badge colorScheme={STATUSES[status].colorScheme}>{t(STATUSES[status].translationKey)}</Badge>
</Tooltip>
);

View File

@ -116,7 +116,7 @@ export const ImportQueueItem = (props: ModelListItemProps) => {
</Tooltip>
</Flex>
<Box w="15%">
<ImportQueueBadge status={model.status} />
<ImportQueueBadge status={model.status} errorReason={model.error_reason} />
</Box>
<Box w="10%">

File diff suppressed because one or more lines are too long