ImageTable: use dynamic get blueprints hook
Export a dynamic query hook depending on which backend is being used (service or on-prem). This means we can just import a query from the new `backendApi` and it will work for both on-prem and the service.
This commit is contained in:
parent
f13ee49565
commit
41cdc7d553
4 changed files with 15 additions and 6 deletions
|
|
@ -25,6 +25,7 @@ import BlueprintCard from './BlueprintCard';
|
|||
import BlueprintsPagination from './BlueprintsPagination';
|
||||
|
||||
import { DEBOUNCED_SEARCH_WAIT_TIME } from '../../constants';
|
||||
import { useGetBlueprintsQuery } from '../../store/backendApi';
|
||||
import {
|
||||
selectBlueprintSearchInput,
|
||||
selectLimit,
|
||||
|
|
@ -36,10 +37,7 @@ import {
|
|||
} from '../../store/BlueprintSlice';
|
||||
import { imageBuilderApi } from '../../store/enhancedImageBuilderApi';
|
||||
import { useAppDispatch, useAppSelector } from '../../store/hooks';
|
||||
import {
|
||||
useGetBlueprintsQuery,
|
||||
BlueprintItem,
|
||||
} from '../../store/imageBuilderApi';
|
||||
import { BlueprintItem } from '../../store/imageBuilderApi';
|
||||
import { resolveRelPath } from '../../Utilities/path';
|
||||
|
||||
type blueprintSearchProps = {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import {
|
|||
selectImageTypes,
|
||||
selectRegistrationType,
|
||||
} from '../../../../store/wizardSlice';
|
||||
import { useFlag } from '../../../../Utilities/useGetEnvironment';
|
||||
|
||||
const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
|
||||
const { goToStepById } = useWizardContext();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import {
|
|||
OCI_STORAGE_EXPIRATION_TIME_IN_DAYS,
|
||||
STATUS_POLLING_INTERVAL,
|
||||
} from '../../constants';
|
||||
import { useGetBlueprintsQuery } from '../../store/backendApi';
|
||||
import {
|
||||
selectBlueprintSearchInput,
|
||||
selectBlueprintVersionFilter,
|
||||
|
|
@ -61,7 +62,6 @@ import {
|
|||
ComposesResponseItem,
|
||||
ComposeStatus,
|
||||
useGetBlueprintComposesQuery,
|
||||
useGetBlueprintsQuery,
|
||||
useGetComposesQuery,
|
||||
useGetComposeStatusQuery,
|
||||
} from '../../store/imageBuilderApi';
|
||||
|
|
@ -153,7 +153,11 @@ const ImagesTable = () => {
|
|||
);
|
||||
}
|
||||
|
||||
if (!isSuccess) {
|
||||
// TODO: the check for `IS_ON_PREMISE` should be removed when
|
||||
// we create query functions for the other endpoints. We're skipping
|
||||
// this check because the query request fails, since the `cockpitApi`
|
||||
// still doesn't know how to query the composes endpoint
|
||||
if (!process.env.IS_ON_PREMISE && !isSuccess) {
|
||||
if (isError) {
|
||||
return (
|
||||
<Alert variant="warning" title="Service unavailable">
|
||||
|
|
|
|||
6
src/store/backendApi.ts
Normal file
6
src/store/backendApi.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { useGetBlueprintsQuery as useCockpitGetBlueprintsQuery } from './cockpitApi';
|
||||
import { useGetBlueprintsQuery as useImageBuilderGetBlueprintsQuery } from './imageBuilderApi';
|
||||
|
||||
export const useGetBlueprintsQuery = process.env.IS_ON_PREMISE
|
||||
? useCockpitGetBlueprintsQuery
|
||||
: useImageBuilderGetBlueprintsQuery;
|
||||
Loading…
Add table
Add a link
Reference in a new issue