store/cockpitApi: getArchitectures endpoint
We were making a call to a dead endpoint to get the architectures. Instead, create a custom query function to return the list of architectures and image types.
This commit is contained in:
parent
6ca7edb949
commit
5988c42b6f
4 changed files with 40 additions and 11 deletions
|
|
@ -13,11 +13,9 @@ import {
|
|||
} from '@patternfly/react-core';
|
||||
import { HelpIcon } from '@patternfly/react-icons';
|
||||
|
||||
import { useGetArchitecturesQuery } from '../../../../store/backendApi';
|
||||
import { useAppSelector, useAppDispatch } from '../../../../store/hooks';
|
||||
import {
|
||||
ImageTypes,
|
||||
useGetArchitecturesQuery,
|
||||
} from '../../../../store/imageBuilderApi';
|
||||
import { ImageTypes } from '../../../../store/imageBuilderApi';
|
||||
import { provisioningApi } from '../../../../store/provisioningApi';
|
||||
import { rhsmApi } from '../../../../store/rhsmApi';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import {
|
|||
EPEL_9_REPO_DEFINITION,
|
||||
RH_ICON_SIZE,
|
||||
} from '../../../../constants';
|
||||
import { useGetArchitecturesQuery } from '../../../../store/backendApi';
|
||||
import {
|
||||
ApiRepositoryResponseRead,
|
||||
useCreateRepositoryMutation,
|
||||
|
|
@ -57,10 +58,7 @@ import {
|
|||
useSearchPackageGroupMutation,
|
||||
} from '../../../../store/contentSourcesApi';
|
||||
import { useAppSelector } from '../../../../store/hooks';
|
||||
import {
|
||||
Package,
|
||||
useGetArchitecturesQuery,
|
||||
} from '../../../../store/imageBuilderApi';
|
||||
import { Package } from '../../../../store/imageBuilderApi';
|
||||
import {
|
||||
selectArchitecture,
|
||||
selectPackages,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,20 @@
|
|||
import {
|
||||
useGetArchitecturesQuery as useCockpitGetArchitecturesQuery,
|
||||
useGetBlueprintsQuery as useCockpitGetBlueprintsQuery,
|
||||
useDeleteBlueprintMutation as useCockpitDeleteMutation,
|
||||
} from './cockpitApi';
|
||||
import { cockpitApi } from './enhancedCockpitApi';
|
||||
import { imageBuilderApi } from './enhancedImageBuilderApi';
|
||||
import {
|
||||
useGetArchitecturesQuery as useImageBuilderGetArchitecturesQuery,
|
||||
useGetBlueprintsQuery as useImageBuilderGetBlueprintsQuery,
|
||||
useDeleteBlueprintMutation as useImageBuilderDeleteMutation,
|
||||
} from './imageBuilderApi';
|
||||
|
||||
export const useGetArchitecturesQuery = process.env.IS_ON_PREMISE
|
||||
? useCockpitGetArchitecturesQuery
|
||||
: useImageBuilderGetArchitecturesQuery;
|
||||
|
||||
export const useGetBlueprintsQuery = process.env.IS_ON_PREMISE
|
||||
? useCockpitGetBlueprintsQuery
|
||||
: useImageBuilderGetBlueprintsQuery;
|
||||
|
|
|
|||
|
|
@ -39,9 +39,36 @@ export const cockpitApi = emptyCockpitApi.injectEndpoints({
|
|||
GetArchitecturesApiResponse,
|
||||
GetArchitecturesApiArg
|
||||
>({
|
||||
query: (queryArg) => ({
|
||||
url: `/architectures/${queryArg.distribution}`,
|
||||
}),
|
||||
queryFn: () => {
|
||||
// TODO: this is hardcoded for now, but we may need to query
|
||||
// the cloudapi endpoint on the composer socket to get the
|
||||
// available information
|
||||
return {
|
||||
data: [
|
||||
{
|
||||
arch: 'aarch64',
|
||||
image_types: ['aws', 'guest-image', 'image-installer'],
|
||||
repositories: [],
|
||||
},
|
||||
{
|
||||
arch: 'x86_64',
|
||||
image_types: [
|
||||
'aws',
|
||||
'gcp',
|
||||
'azure',
|
||||
'rhel-edge-commit',
|
||||
'rhel-edge-installer',
|
||||
'edge-commit',
|
||||
'edge-installer',
|
||||
'guest-image',
|
||||
'image-installer',
|
||||
'vsphere',
|
||||
],
|
||||
repositories: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
}),
|
||||
getBlueprints: builder.query<
|
||||
GetBlueprintsApiResponse,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue