requestMapper: add region to aws upload type
The on-prem backend needs the aws region in order to upload the ami target to aws. In order to do this, we use some specific cockpit types that contain the region field, meaning that requests to image-builder-crc should be unchanged. This is essentialy the wiring commit to get this functionality into the `/composes` endpoint for on-prem.
This commit is contained in:
parent
4339420cb8
commit
3a9e3aa200
3 changed files with 57 additions and 12 deletions
|
|
@ -22,6 +22,7 @@ import {
|
|||
useCreateBPWithNotification as useCreateBlueprintMutation,
|
||||
} from '../../../../../Hooks';
|
||||
import { setBlueprintId } from '../../../../../store/BlueprintSlice';
|
||||
import { CockpitCreateBlueprintRequest } from '../../../../../store/cockpit/types';
|
||||
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
|
|
@ -31,7 +32,9 @@ import { selectPackages } from '../../../../../store/wizardSlice';
|
|||
import { createAnalytics } from '../../../../../Utilities/analytics';
|
||||
|
||||
type CreateDropdownProps = {
|
||||
getBlueprintPayload: () => Promise<'' | CreateBlueprintRequest | undefined>;
|
||||
getBlueprintPayload: () => Promise<
|
||||
'' | CreateBlueprintRequest | CockpitCreateBlueprintRequest | undefined
|
||||
>;
|
||||
setIsOpen: (isOpen: boolean) => void;
|
||||
isDisabled: boolean;
|
||||
};
|
||||
|
|
@ -62,7 +65,11 @@ export const CreateSaveAndBuildBtn = ({
|
|||
setIsOpen(false);
|
||||
|
||||
if (!process.env.IS_ON_PREMISE && requestBody) {
|
||||
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
||||
const analyticsData = createAnalytics(
|
||||
requestBody as CreateBlueprintRequest,
|
||||
packages,
|
||||
isBeta
|
||||
);
|
||||
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Created`, {
|
||||
...analyticsData,
|
||||
type: 'createBlueprintAndBuildImages',
|
||||
|
|
@ -161,7 +168,11 @@ export const CreateSaveButton = ({
|
|||
setIsOpen(false);
|
||||
|
||||
if (!process.env.IS_ON_PREMISE && requestBody) {
|
||||
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
||||
const analyticsData = createAnalytics(
|
||||
requestBody as CreateBlueprintRequest,
|
||||
packages,
|
||||
isBeta
|
||||
);
|
||||
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Created`, {
|
||||
...analyticsData,
|
||||
type: 'createBlueprint',
|
||||
|
|
|
|||
|
|
@ -16,13 +16,16 @@ import {
|
|||
useComposeBPWithNotification as useComposeBlueprintMutation,
|
||||
useUpdateBPWithNotification as useUpdateBlueprintMutation,
|
||||
} from '../../../../../Hooks';
|
||||
import { CockpitCreateBlueprintRequest } from '../../../../../store/cockpit/types';
|
||||
import { useAppSelector } from '../../../../../store/hooks';
|
||||
import { CreateBlueprintRequest } from '../../../../../store/imageBuilderApi';
|
||||
import { selectPackages } from '../../../../../store/wizardSlice';
|
||||
import { createAnalytics } from '../../../../../Utilities/analytics';
|
||||
|
||||
type EditDropdownProps = {
|
||||
getBlueprintPayload: () => Promise<'' | CreateBlueprintRequest | undefined>;
|
||||
getBlueprintPayload: () => Promise<
|
||||
'' | CreateBlueprintRequest | CockpitCreateBlueprintRequest | undefined
|
||||
>;
|
||||
setIsOpen: (isOpen: boolean) => void;
|
||||
blueprintId: string;
|
||||
isDisabled: boolean;
|
||||
|
|
@ -54,7 +57,11 @@ export const EditSaveAndBuildBtn = ({
|
|||
const requestBody = await getBlueprintPayload();
|
||||
|
||||
if (!process.env.IS_ON_PREMISE && requestBody) {
|
||||
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
||||
const analyticsData = createAnalytics(
|
||||
requestBody as CreateBlueprintRequest,
|
||||
packages,
|
||||
isBeta
|
||||
);
|
||||
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Updated`, {
|
||||
...analyticsData,
|
||||
type: 'editBlueprintAndBuildImages',
|
||||
|
|
@ -111,7 +118,11 @@ export const EditSaveButton = ({
|
|||
const requestBody = await getBlueprintPayload();
|
||||
|
||||
if (!process.env.IS_ON_PREMISE && requestBody) {
|
||||
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
||||
const analyticsData = createAnalytics(
|
||||
requestBody as CreateBlueprintRequest,
|
||||
packages,
|
||||
isBeta
|
||||
);
|
||||
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Updated`, {
|
||||
...analyticsData,
|
||||
type: 'editBlueprint',
|
||||
|
|
@ -120,7 +131,10 @@ export const EditSaveButton = ({
|
|||
}
|
||||
setIsOpen(false);
|
||||
if (requestBody) {
|
||||
updateBlueprint({ id: blueprintId, createBlueprintRequest: requestBody });
|
||||
updateBlueprint({
|
||||
id: blueprintId,
|
||||
createBlueprintRequest: requestBody,
|
||||
});
|
||||
}
|
||||
};
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue