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 Brandon Rising
parent 34b9ab3674
commit d802900abe
4 changed files with 105 additions and 99 deletions

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long