diff --git a/src/Components/Blueprints/BlueprintsPagination.tsx b/src/Components/Blueprints/BlueprintsPagination.tsx index 12c4b9b2..c45fec53 100644 --- a/src/Components/Blueprints/BlueprintsPagination.tsx +++ b/src/Components/Blueprints/BlueprintsPagination.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { Pagination, PaginationVariant } from '@patternfly/react-core'; import { OnSetPage } from '@patternfly/react-core/dist/esm/components/Pagination/Pagination'; +import { useGetBlueprintsQuery } from '../../store/backendApi'; import { selectBlueprintSearchInput, selectLimit, @@ -11,10 +12,7 @@ import { setBlueprintsOffset, } from '../../store/BlueprintSlice'; import { useAppDispatch, useAppSelector } from '../../store/hooks'; -import { - useGetBlueprintsQuery, - GetBlueprintsApiArg, -} from '../../store/imageBuilderApi'; +import { GetBlueprintsApiArg } from '../../store/imageBuilderApi'; const BlueprintsPagination = () => { const blueprintSearchInput = useAppSelector(selectBlueprintSearchInput); diff --git a/src/Components/Blueprints/DeleteBlueprintModal.tsx b/src/Components/Blueprints/DeleteBlueprintModal.tsx index 4342a2ff..56a30fa7 100644 --- a/src/Components/Blueprints/DeleteBlueprintModal.tsx +++ b/src/Components/Blueprints/DeleteBlueprintModal.tsx @@ -8,6 +8,11 @@ import { } from '@patternfly/react-core'; import { PAGINATION_LIMIT, PAGINATION_OFFSET } from '../../constants'; +import { + backendApi, + useDeleteBlueprintMutation, + useGetBlueprintsQuery, +} from '../../store/backendApi'; import { selectBlueprintSearchInput, selectLimit, @@ -15,13 +20,8 @@ import { selectSelectedBlueprintId, setBlueprintId, } from '../../store/BlueprintSlice'; -import { imageBuilderApi } from '../../store/enhancedImageBuilderApi'; import { useAppDispatch, useAppSelector } from '../../store/hooks'; -import { - GetBlueprintsApiArg, - useDeleteBlueprintMutation, - useGetBlueprintsQuery, -} from '../../store/imageBuilderApi'; +import { GetBlueprintsApiArg } from '../../store/imageBuilderApi'; interface DeleteBlueprintModalProps { setShowDeleteModal: React.Dispatch>; @@ -62,7 +62,7 @@ export const DeleteBlueprintModal: React.FunctionComponent< setShowDeleteModal(false); await deleteBlueprint({ id: selectedBlueprintId }); dispatch(setBlueprintId(undefined)); - dispatch(imageBuilderApi.util.invalidateTags([{ type: 'Blueprints' }])); + dispatch(backendApi.util.invalidateTags([{ type: 'Blueprints' }])); } }; const onDeleteClose = () => { diff --git a/src/Components/ImagesTable/ImagesTableToolbar.tsx b/src/Components/ImagesTable/ImagesTableToolbar.tsx index 5b280f11..3ca71b4e 100644 --- a/src/Components/ImagesTable/ImagesTableToolbar.tsx +++ b/src/Components/ImagesTable/ImagesTableToolbar.tsx @@ -10,6 +10,7 @@ import { Title, } from '@patternfly/react-core'; +import { useGetBlueprintsQuery } from '../../store/backendApi'; import { selectSelectedBlueprintId, selectBlueprintSearchInput, @@ -18,7 +19,6 @@ import { import { useAppSelector } from '../../store/hooks'; import { BlueprintItem, - useGetBlueprintsQuery, useGetBlueprintComposesQuery, Distributions, GetBlueprintComposesApiArg, diff --git a/src/Components/ImagesTable/Instance.tsx b/src/Components/ImagesTable/Instance.tsx index cbe9a24c..651c3bba 100644 --- a/src/Components/ImagesTable/Instance.tsx +++ b/src/Components/ImagesTable/Instance.tsx @@ -26,6 +26,7 @@ import { MODAL_ANCHOR, SEARCH_INPUT, } from '../../constants'; +import { useGetBlueprintsQuery } from '../../store/backendApi'; import { selectSelectedBlueprintId, selectBlueprintSearchInput, @@ -33,7 +34,6 @@ import { import { useAppSelector } from '../../store/hooks'; import { BlueprintItem, - useGetBlueprintsQuery, ComposesResponseItem, ComposeStatus, ImageTypes, diff --git a/src/store/backendApi.ts b/src/store/backendApi.ts index 98292433..1a156415 100644 --- a/src/store/backendApi.ts +++ b/src/store/backendApi.ts @@ -1,6 +1,22 @@ -import { useGetBlueprintsQuery as useCockpitGetBlueprintsQuery } from './cockpitApi'; -import { useGetBlueprintsQuery as useImageBuilderGetBlueprintsQuery } from './imageBuilderApi'; +import { + useGetBlueprintsQuery as useCockpitGetBlueprintsQuery, + useDeleteBlueprintMutation as useCockpitDeleteMutation, +} from './cockpitApi'; +import { cockpitApi } from './enhancedCockpitApi'; +import { imageBuilderApi } from './enhancedImageBuilderApi'; +import { + useGetBlueprintsQuery as useImageBuilderGetBlueprintsQuery, + useDeleteBlueprintMutation as useImageBuilderDeleteMutation, +} from './imageBuilderApi'; export const useGetBlueprintsQuery = process.env.IS_ON_PREMISE ? useCockpitGetBlueprintsQuery : useImageBuilderGetBlueprintsQuery; + +export const useDeleteBlueprintMutation = process.env.IS_ON_PREMISE + ? useCockpitDeleteMutation + : useImageBuilderDeleteMutation; + +export const backendApi = process.env.IS_ON_PREMISE + ? cockpitApi + : imageBuilderApi;