store/cockpitApi: add create blueprint mutation
This commit is contained in:
parent
c104f30cd2
commit
94f24ce085
4 changed files with 27 additions and 5 deletions
|
|
@ -13,12 +13,12 @@ import {
|
|||
import useChrome from '@redhat-cloud-services/frontend-components/useChrome';
|
||||
|
||||
import { AMPLITUDE_MODULE_NAME } from '../../../../../constants';
|
||||
import { useCreateBlueprintMutation } from '../../../../../store/backendApi';
|
||||
import { setBlueprintId } from '../../../../../store/BlueprintSlice';
|
||||
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
useComposeBlueprintMutation,
|
||||
useCreateBlueprintMutation,
|
||||
} from '../../../../../store/imageBuilderApi';
|
||||
import { selectPackages } from '../../../../../store/wizardSlice';
|
||||
|
||||
|
|
|
|||
|
|
@ -15,10 +15,8 @@ import { useNavigate, useParams } from 'react-router-dom';
|
|||
import { CreateSaveAndBuildBtn, CreateSaveButton } from './CreateDropdown';
|
||||
import { EditSaveAndBuildBtn, EditSaveButton } from './EditDropdown';
|
||||
|
||||
import {
|
||||
useCreateBlueprintMutation,
|
||||
useUpdateBlueprintMutation,
|
||||
} from '../../../../../store/imageBuilderApi';
|
||||
import { useCreateBlueprintMutation } from '../../../../../store/backendApi';
|
||||
import { useUpdateBlueprintMutation } from '../../../../../store/imageBuilderApi';
|
||||
import { resolveRelPath } from '../../../../../Utilities/path';
|
||||
import { mapRequestFromState } from '../../../utilities/requestMapper';
|
||||
import { useIsBlueprintValid } from '../../../utilities/useValidation';
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ export const useLazyGetBlueprintsQuery = process.env.IS_ON_PREMISE
|
|||
? cockpitQueries.useLazyGetBlueprintsQuery
|
||||
: imageBuilderQueries.useLazyGetBlueprintsQuery;
|
||||
|
||||
export const useCreateBlueprintMutation = process.env.IS_ON_PREMISE
|
||||
? cockpitQueries.useCreateBlueprintMutation
|
||||
: imageBuilderQueries.useCreateBlueprintMutation;
|
||||
|
||||
export const useDeleteBlueprintMutation = process.env.IS_ON_PREMISE
|
||||
? cockpitQueries.useDeleteBlueprintMutation
|
||||
: imageBuilderQueries.useDeleteBlueprintMutation;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ import {
|
|||
GetOscapProfilesApiResponse,
|
||||
GetBlueprintApiResponse,
|
||||
GetBlueprintApiArg,
|
||||
CreateBlueprintApiResponse,
|
||||
CreateBlueprintApiArg,
|
||||
} from './imageBuilderApi';
|
||||
|
||||
import { mapOnPremToHosted } from '../Components/Blueprints/helpers/onPremToHostedBlueprintMapper';
|
||||
|
|
@ -183,6 +185,23 @@ export const cockpitApi = emptyCockpitApi.injectEndpoints({
|
|||
}
|
||||
},
|
||||
}),
|
||||
createBlueprint: builder.mutation<
|
||||
CreateBlueprintApiResponse,
|
||||
CreateBlueprintApiArg
|
||||
>({
|
||||
queryFn: async () => {
|
||||
// TODO: actually save the result to file
|
||||
try {
|
||||
return {
|
||||
data: {
|
||||
id: '',
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
return { error };
|
||||
}
|
||||
},
|
||||
}),
|
||||
deleteBlueprint: builder.mutation<
|
||||
DeleteBlueprintApiResponse,
|
||||
DeleteBlueprintApiArg
|
||||
|
|
@ -239,6 +258,7 @@ export const {
|
|||
useGetBlueprintQuery,
|
||||
useGetBlueprintsQuery,
|
||||
useLazyGetBlueprintsQuery,
|
||||
useCreateBlueprintMutation,
|
||||
useDeleteBlueprintMutation,
|
||||
useGetOscapProfilesQuery,
|
||||
useListSnapshotsByDateMutation,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue