From 48e1a0c2178e271c3d637e86bb7e06547fc28b0d Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:46:20 +1100 Subject: [PATCH] fix(ui): remove sync models functionality The backend functionality was removed in the previous couple commits. Removing the frontend endpoints and components. --- .../SyncModels/SyncModelsButton.tsx | 33 --------------- .../SyncModels/SyncModelsIconButton.tsx | 33 --------------- .../components/SyncModels/useSyncModels.ts | 40 ------------------- .../modelManagerV2/subpanels/ModelManager.tsx | 5 +-- .../inputs/MainModelFieldInputComponent.tsx | 2 - .../RefinerModelFieldInputComponent.tsx | 2 - .../SDXLMainModelFieldInputComponent.tsx | 2 - .../inputs/VAEModelFieldInputComponent.tsx | 2 - .../GenerationSettingsAccordion.tsx | 2 - .../web/src/services/api/endpoints/models.ts | 10 ----- 10 files changed, 1 insertion(+), 130 deletions(-) delete mode 100644 invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/SyncModelsButton.tsx delete mode 100644 invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/SyncModelsIconButton.tsx delete mode 100644 invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/useSyncModels.ts diff --git a/invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/SyncModelsButton.tsx b/invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/SyncModelsButton.tsx deleted file mode 100644 index e8d1c0117b..0000000000 --- a/invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/SyncModelsButton.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import type { ButtonProps } from '@invoke-ai/ui-library'; -import { Button } from '@invoke-ai/ui-library'; -import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus'; -import { memo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { PiArrowsClockwiseBold } from 'react-icons/pi'; - -import { useSyncModels } from './useSyncModels'; - -export const SyncModelsButton = memo((props: Omit) => { - const { t } = useTranslation(); - const { syncModels, isLoading } = useSyncModels(); - const isSyncModelEnabled = useFeatureStatus('syncModels').isFeatureEnabled; - - if (!isSyncModelEnabled) { - return null; - } - - return ( - - ); -}); - -SyncModelsButton.displayName = 'SyncModelsButton'; diff --git a/invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/SyncModelsIconButton.tsx b/invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/SyncModelsIconButton.tsx deleted file mode 100644 index 986a99bd0b..0000000000 --- a/invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/SyncModelsIconButton.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import type { IconButtonProps } from '@invoke-ai/ui-library'; -import { IconButton } from '@invoke-ai/ui-library'; -import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus'; -import { memo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { PiArrowsClockwiseBold } from 'react-icons/pi'; - -import { useSyncModels } from './useSyncModels'; - -export const SyncModelsIconButton = memo((props: Omit) => { - const { t } = useTranslation(); - const { syncModels, isLoading } = useSyncModels(); - const isSyncModelEnabled = useFeatureStatus('syncModels').isFeatureEnabled; - - if (!isSyncModelEnabled) { - return null; - } - - return ( - } - tooltip={t('modelManager.syncModels')} - aria-label={t('modelManager.syncModels')} - isLoading={isLoading} - onClick={syncModels} - size="sm" - variant="ghost" - {...props} - /> - ); -}); - -SyncModelsIconButton.displayName = 'SyncModelsIconButton'; diff --git a/invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/useSyncModels.ts b/invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/useSyncModels.ts deleted file mode 100644 index 3ccaba66a5..0000000000 --- a/invokeai/frontend/web/src/features/modelManagerV2/components/SyncModels/useSyncModels.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { useAppDispatch } from 'app/store/storeHooks'; -import { addToast } from 'features/system/store/systemSlice'; -import { makeToast } from 'features/system/util/makeToast'; -import { useCallback } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useSyncModelsMutation } from 'services/api/endpoints/models'; - -export const useSyncModels = () => { - const dispatch = useAppDispatch(); - const { t } = useTranslation(); - const [_syncModels, { isLoading }] = useSyncModelsMutation(); - const syncModels = useCallback(() => { - _syncModels() - .unwrap() - .then((_) => { - dispatch( - addToast( - makeToast({ - title: `${t('modelManager.modelsSynced')}`, - status: 'success', - }) - ) - ); - }) - .catch((error) => { - if (error) { - dispatch( - addToast( - makeToast({ - title: `${t('modelManager.modelSyncFailed')}`, - status: 'error', - }) - ) - ); - } - }); - }, [dispatch, _syncModels, t]); - - return { syncModels, isLoading }; -}; diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManager.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManager.tsx index ed75f86078..dbe02392db 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManager.tsx +++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManager.tsx @@ -1,6 +1,5 @@ -import { Button, Flex, Heading, Spacer } from '@invoke-ai/ui-library'; +import { Button, Flex, Heading } from '@invoke-ai/ui-library'; import { useAppDispatch } from 'app/store/storeHooks'; -import { SyncModelsButton } from 'features/modelManagerV2/components/SyncModels/SyncModelsButton'; import { setSelectedModelKey } from 'features/modelManagerV2/store/modelManagerV2Slice'; import { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; @@ -20,8 +19,6 @@ export const ModelManager = () => { {t('common.modelManager')} - - diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/MainModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/MainModelFieldInputComponent.tsx index 2a84347b7e..520e4cfe81 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/MainModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/MainModelFieldInputComponent.tsx @@ -1,7 +1,6 @@ import { Combobox, Flex, FormControl } from '@invoke-ai/ui-library'; import { useAppDispatch } from 'app/store/storeHooks'; import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; -import { SyncModelsIconButton } from 'features/modelManagerV2/components/SyncModels/SyncModelsIconButton'; import { fieldMainModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { MainModelFieldInputInstance, MainModelFieldInputTemplate } from 'features/nodes/types/field'; import { memo, useCallback } from 'react'; @@ -49,7 +48,6 @@ const MainModelFieldInputComponent = (props: Props) => { noOptionsMessage={noOptionsMessage} /> - ); }; diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/RefinerModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/RefinerModelFieldInputComponent.tsx index c9d42dad8e..3812b322a6 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/RefinerModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/RefinerModelFieldInputComponent.tsx @@ -1,7 +1,6 @@ import { Combobox, Flex, FormControl } from '@invoke-ai/ui-library'; import { useAppDispatch } from 'app/store/storeHooks'; import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; -import { SyncModelsIconButton } from 'features/modelManagerV2/components/SyncModels/SyncModelsIconButton'; import { fieldRefinerModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { SDXLRefinerModelFieldInputInstance, @@ -52,7 +51,6 @@ const RefinerModelFieldInputComponent = (props: Props) => { noOptionsMessage={noOptionsMessage} /> - ); }; diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SDXLMainModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SDXLMainModelFieldInputComponent.tsx index 5d3c584d4b..1074c64665 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SDXLMainModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SDXLMainModelFieldInputComponent.tsx @@ -1,7 +1,6 @@ import { Combobox, Flex, FormControl } from '@invoke-ai/ui-library'; import { useAppDispatch } from 'app/store/storeHooks'; import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; -import { SyncModelsIconButton } from 'features/modelManagerV2/components/SyncModels/SyncModelsIconButton'; import { fieldMainModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { SDXLMainModelFieldInputInstance, SDXLMainModelFieldInputTemplate } from 'features/nodes/types/field'; import { memo, useCallback } from 'react'; @@ -49,7 +48,6 @@ const SDXLMainModelFieldInputComponent = (props: Props) => { noOptionsMessage={noOptionsMessage} /> - ); }; diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/VAEModelFieldInputComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/VAEModelFieldInputComponent.tsx index d10712d15d..33fd33384a 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/VAEModelFieldInputComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/VAEModelFieldInputComponent.tsx @@ -1,7 +1,6 @@ import { Combobox, Flex, FormControl } from '@invoke-ai/ui-library'; import { useAppDispatch } from 'app/store/storeHooks'; import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; -import { SyncModelsIconButton } from 'features/modelManagerV2/components/SyncModels/SyncModelsIconButton'; import { fieldVaeModelValueChanged } from 'features/nodes/store/nodesSlice'; import type { VAEModelFieldInputInstance, VAEModelFieldInputTemplate } from 'features/nodes/types/field'; import { memo, useCallback } from 'react'; @@ -49,7 +48,6 @@ const VAEModelFieldInputComponent = (props: Props) => { noOptionsMessage={noOptionsMessage} /> - ); }; diff --git a/invokeai/frontend/web/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx b/invokeai/frontend/web/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx index 66a72c4b02..84f2e868cc 100644 --- a/invokeai/frontend/web/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx +++ b/invokeai/frontend/web/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx @@ -6,7 +6,6 @@ import { useAppSelector } from 'app/store/storeHooks'; import { LoRAList } from 'features/lora/components/LoRAList'; import LoRASelect from 'features/lora/components/LoRASelect'; import { selectLoraSlice } from 'features/lora/store/loraSlice'; -import { SyncModelsIconButton } from 'features/modelManagerV2/components/SyncModels/SyncModelsIconButton'; import ParamCFGScale from 'features/parameters/components/Core/ParamCFGScale'; import ParamScheduler from 'features/parameters/components/Core/ParamScheduler'; import ParamSteps from 'features/parameters/components/Core/ParamSteps'; @@ -60,7 +59,6 @@ export const GenerationSettingsAccordion = memo(() => { - diff --git a/invokeai/frontend/web/src/services/api/endpoints/models.ts b/invokeai/frontend/web/src/services/api/endpoints/models.ts index d9d2863a7b..492b812e0f 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/models.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/models.ts @@ -188,15 +188,6 @@ export const modelsApi = api.injectEndpoints({ }, serializeQueryArgs: ({ queryArgs }) => `${queryArgs.name}.${queryArgs.base}.${queryArgs.type}`, }), - syncModels: build.mutation({ - query: () => { - return { - url: buildModelsUrl('sync'), - method: 'PATCH', - }; - }, - invalidatesTags: [{ type: 'ModelConfig', id: LIST_TAG }], - }), scanFolder: build.query({ query: (arg) => { const folderQueryStr = arg ? queryString.stringify(arg, {}) : ''; @@ -278,7 +269,6 @@ export const { useUpdateModelImageMutation, useInstallModelMutation, useConvertModelMutation, - useSyncModelsMutation, useLazyScanFolderQuery, useLazyGetHuggingFaceModelsQuery, useListModelInstallsQuery,