From 68310a9457bebd449cf0b5540b34d269f0e03476 Mon Sep 17 00:00:00 2001 From: Michal Gold Date: Mon, 7 Oct 2024 11:52:39 +0300 Subject: [PATCH] add getArchitectures to cockpit --- .../steps/ImageOutput/TargetEnvironment.tsx | 6 ++---- src/store/cockpitApi.ts | 10 +++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Components/CreateImageWizard/steps/ImageOutput/TargetEnvironment.tsx b/src/Components/CreateImageWizard/steps/ImageOutput/TargetEnvironment.tsx index 8cafd2400..e090d7c0b 100644 --- a/src/Components/CreateImageWizard/steps/ImageOutput/TargetEnvironment.tsx +++ b/src/Components/CreateImageWizard/steps/ImageOutput/TargetEnvironment.tsx @@ -17,10 +17,8 @@ import { HelpIcon } from '@patternfly/react-icons'; import { useGetFeatureFlag } from 'getFeatureFlag'; import { useAppSelector, useAppDispatch } from '../../../../store/hooks'; -import { - ImageTypes, - useGetArchitecturesQuery, -} from '../../../../store/imageBuilderApi'; +import { useGetArchitecturesQuery } from 'api'; +import { ImageTypes } from '../../../../store/imageBuilderApi'; import { provisioningApi } from '../../../../store/provisioningApi'; import { addImageType, diff --git a/src/store/cockpitApi.ts b/src/store/cockpitApi.ts index 6bf955b27..7c6e82107 100644 --- a/src/store/cockpitApi.ts +++ b/src/store/cockpitApi.ts @@ -1,5 +1,7 @@ import { emptyCockpitApi as api } from './emptyCockpitApi'; import { + GetArchitecturesApiArg, + GetArchitecturesApiResponse, GetBlueprintsApiArg, GetBlueprintsApiResponse, } from './imageBuilderApi'; @@ -7,6 +9,12 @@ import { // Injects API endpoints into the service for querying blueprints export const blueprintsReducer = api.injectEndpoints({ endpoints: (build) => ({ + getArchitectures: build.query< + GetArchitecturesApiResponse, + GetArchitecturesApiArg + >({ + query: (queryArg) => ({ url: `/architectures/${queryArg.distribution}` }), + }), getBlueprints: build.query({ query: (queryArg) => ({ url: `/blueprints`, @@ -21,4 +29,4 @@ export const blueprintsReducer = api.injectEndpoints({ }), }); -export const { useGetBlueprintsQuery } = blueprintsReducer; +export const { useGetBlueprintsQuery, useGetArchitecturesQuery } = blueprintsReducer;