Skip to content

Commit 1290ca6

Browse files
committed
fix: make buildxDriverType optional and trim description in profile payload
1 parent 4da219d commit 1290ca6

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/Pages/GlobalConfigurations/BuildInfra/types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ interface BuildInfraProfileBaseDTO {
240240
/**
241241
* @default `BuildXDriverType.KUBERNETES`
242242
*/
243-
buildxDriverType: BuildXDriverType
243+
buildxDriverType?: BuildXDriverType
244244
}
245245

246246
export interface BuildInfraProfileBase extends Omit<BuildInfraProfileBaseDTO, 'buildxDriverType'> {

src/Pages/GlobalConfigurations/BuildInfra/utils.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ const getBaseProfileObject = ({
113113
profile,
114114
canConfigureUseK8sDriver,
115115
}: GetBaseProfileObjectParamsType): BuildInfraProfileBase => {
116-
const parsedUseK8sDriverValue = profile.buildxDriverType
116+
const parsedUseK8sDriverValue = profile?.buildxDriverType
117117
? profile.buildxDriverType === BuildXDriverType.KUBERNETES
118118
: true
119119
const useK8sDriver = canConfigureUseK8sDriver ? parsedUseK8sDriverValue : null
120120

121-
if (fromCreateView) {
121+
if (fromCreateView || !profile) {
122122
return {
123123
name: '',
124124
description: '',
@@ -131,7 +131,7 @@ const getBaseProfileObject = ({
131131
return {
132132
id: profile.id,
133133
name: profile.name,
134-
description: profile.description,
134+
description: profile.description?.trim(),
135135
type: profile.type,
136136
appCount: profile.appCount,
137137
useK8sDriver,
@@ -273,12 +273,11 @@ export const getTransformedBuildInfraProfileResponse = ({
273273
configurationUnits,
274274
fallbackPlatformConfigurationMap,
275275
profile: {
276-
...(profile &&
277-
getBaseProfileObject({
278-
fromCreateView,
279-
profile,
280-
canConfigureUseK8sDriver,
281-
})),
276+
...getBaseProfileObject({
277+
fromCreateView,
278+
profile,
279+
canConfigureUseK8sDriver,
280+
}),
282281
configurations,
283282
},
284283
}
@@ -334,7 +333,7 @@ export const getBuildInfraProfilePayload = (
334333

335334
const payload: BuildInfraProfileInfoDTO = {
336335
name: profileInput.name,
337-
description: profileInput.description,
336+
description: profileInput.description?.trim(),
338337
type: profileInput.type,
339338
configurations,
340339
...(canConfigureUseK8sDriver && {

0 commit comments

Comments
 (0)