diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json index 12d06ee224..f845250c8e 100644 --- a/invokeai/frontend/web/public/locales/en.json +++ b/invokeai/frontend/web/public/locales/en.json @@ -691,6 +691,7 @@ }, "modelManager": { "active": "active", + "addAll": "Add All", "addCheckpointModel": "Add Checkpoint / Safetensor Model", "addDifference": "Add Difference", "addDiffuserModel": "Add Diffusers", diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ImportQueue/ImportQueue.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ImportQueue/ImportQueue.tsx index cd2208c972..cf45f2c913 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ImportQueue/ImportQueue.tsx +++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ImportQueue/ImportQueue.tsx @@ -1,5 +1,6 @@ import { Box, Button, Flex, Text } from '@invoke-ai/ui-library'; import { useAppDispatch } from 'app/store/storeHooks'; +import ScrollableContent from 'common/components/OverlayScrollbars/ScrollableContent'; import { addToast } from 'features/system/store/systemSlice'; import { makeToast } from 'features/system/util/makeToast'; import { t } from 'i18next'; @@ -57,9 +58,11 @@ export const ImportQueue = () => { - - {data?.map((model) => )} - + + + {data?.map((model) => )} + + ); diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ImportQueue/ImportQueueItem.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ImportQueue/ImportQueueItem.tsx index fa13de0095..14bbe7daeb 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ImportQueue/ImportQueueItem.tsx +++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/ImportQueue/ImportQueueItem.tsx @@ -121,7 +121,7 @@ export const ImportQueueItem = (props: ModelListItemProps) => { - {(model.status === 'downloading' || model.status === 'waiting') && ( + {(model.status === 'downloading' || model.status === 'waiting' || model.status === 'running') && ( { const { t } = useTranslation(); const [searchTerm, setSearchTerm] = useState(''); + const dispatch = useAppDispatch(); + + const [importMainModel] = useImportMainModelsMutation(); const filteredResults = useMemo(() => { return results.filter((result) => { @@ -31,6 +46,38 @@ export const ScanModelsResults = ({ results }: ScanModelResultsProps) => { setSearchTerm(''); }, []); + const handleAddAll = useCallback(() => { + for (const result of filteredResults) { + if (result.is_installed) { + continue; + } + importMainModel({ source: result.path, config: undefined }) + .unwrap() + .then((_) => { + dispatch( + addToast( + makeToast({ + title: t('toast.modelAddedSimple'), + status: 'success', + }) + ) + ); + }) + .catch((error) => { + if (error) { + dispatch( + addToast( + makeToast({ + title: `${error.data.detail} `, + status: 'error', + }) + ) + ); + } + }); + } + }, [importMainModel, filteredResults, dispatch, t]); + return ( <> @@ -39,27 +86,32 @@ export const ScanModelsResults = ({ results }: ScanModelResultsProps) => { {t('modelManager.scanResults')} - - + + + + - {searchTerm && ( - - } - onClick={clearSearch} - /> - - )} - + {searchTerm && ( + + } + onClick={clearSearch} + /> + + )} + +