diff --git a/invokeai/frontend/web/src/common/components/IAIMantineSelect.tsx b/invokeai/frontend/web/src/common/components/IAIMantineSelect.tsx index fa9b0b6719..537ccf86be 100644 --- a/invokeai/frontend/web/src/common/components/IAIMantineSelect.tsx +++ b/invokeai/frontend/web/src/common/components/IAIMantineSelect.tsx @@ -9,7 +9,7 @@ export type IAISelectDataType = { tooltip?: string; }; -type IAISelectProps = Omit & { +export type IAISelectProps = Omit & { tooltip?: string; inputRef?: RefObject; label?: string; diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx index 2cdaea904f..6078ba4a68 100644 --- a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx @@ -4,7 +4,6 @@ import { makeToast } from 'app/components/Toaster'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import IAIButton from 'common/components/IAIButton'; import IAIMantineTextInput from 'common/components/IAIMantineInput'; -import IAIMantineSelect from 'common/components/IAIMantineSelect'; import { MODEL_TYPE_MAP } from 'features/parameters/types/constants'; import { selectIsBusy } from 'features/system/store/systemSelectors'; import { addToast } from 'features/system/store/systemSlice'; @@ -15,19 +14,10 @@ import { useUpdateMainModelsMutation, } from 'services/api/endpoints/models'; import { CheckpointModelConfig } from 'services/api/types'; +import BaseModelSelect from '../shared/BaseModelSelect'; +import ModelVariantSelect from '../shared/ModelVariantSelect'; import ModelConvert from './ModelConvert'; -const baseModelSelectData = [ - { value: 'sd-1', label: MODEL_TYPE_MAP['sd-1'] }, - { value: 'sd-2', label: MODEL_TYPE_MAP['sd-2'] }, -]; - -const variantSelectData = [ - { value: 'normal', label: 'Normal' }, - { value: 'inpaint', label: 'Inpaint' }, - { value: 'depth', label: 'Depth' }, -]; - type CheckpointModelEditProps = { model: CheckpointModelConfigEntity; }; @@ -80,7 +70,7 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) { ) ); }) - .catch((error) => { + .catch((_) => { checkpointEditForm.reset(); dispatch( addToast( @@ -132,14 +122,10 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) { label={t('modelManager.description')} {...checkpointEditForm.getInputProps('description')} /> - - { + .catch((_) => { diffusersEditForm.reset(); dispatch( addToast( @@ -122,16 +112,8 @@ export default function DiffusersModelEdit(props: DiffusersModelEditProps) { label={t('modelManager.description')} {...diffusersEditForm.getInputProps('description')} /> - - + + ; + +export default function BaseModelSelect(props: BaseModelSelectProps) { + const { ...rest } = props; + const { t } = useTranslation(); + + return ( + + ); +} diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/shared/ModelVariantSelect.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/shared/ModelVariantSelect.tsx new file mode 100644 index 0000000000..24f295fb73 --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/shared/ModelVariantSelect.tsx @@ -0,0 +1,26 @@ +import IAIMantineSelect, { + IAISelectDataType, + IAISelectProps, +} from 'common/components/IAIMantineSelect'; +import { useTranslation } from 'react-i18next'; + +const variantSelectData: IAISelectDataType[] = [ + { value: 'normal', label: 'Normal' }, + { value: 'inpaint', label: 'Inpaint' }, + { value: 'depth', label: 'Depth' }, +]; + +type VariantSelectProps = Omit; + +export default function ModelVariantSelect(props: VariantSelectProps) { + const { ...rest } = props; + const { t } = useTranslation(); + + return ( + + ); +}