Skip to content

Commit 9581b45

Browse files
committed
feat: add toggle functionality for K8s driver configuration in build infra form
1 parent 995080f commit 9581b45

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Pages/GlobalConfigurations/BuildInfra/UseBuildInfraForm.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ const useBuildInfraForm = ({
284284
name,
285285
editProfile,
286286
handleSuccessRedirection,
287-
canConfigureUseK8sDriver,
287+
canConfigureUseK8sDriver = false,
288288
}: UseBuildInfraFormProps): UseBuildInfraFormResponseType => {
289289
const fromCreateView = !name
290290

@@ -336,6 +336,11 @@ const useBuildInfraForm = ({
336336
const lastSavedConfiguration = profileResponse.profile.configurations[targetPlatform] || currentConfiguration
337337

338338
switch (action) {
339+
case BuildInfraProfileInputActionType.TOGGLE_USE_K8S_DRIVER: {
340+
currentInput.useK8sDriver = !currentInput.useK8sDriver
341+
break
342+
}
343+
339344
case BuildInfraMetaConfigTypes.DESCRIPTION: {
340345
const { value } = data
341346
currentInput.description = value

src/Pages/GlobalConfigurations/BuildInfra/types.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export interface UseBuildInfraFormProps {
264264
/**
265265
* @default - false
266266
*/
267-
canConfigureUseK8sDriver: boolean
267+
canConfigureUseK8sDriver?: boolean
268268
}
269269

270270
export interface GetBuildInfraProfileType extends Pick<UseBuildInfraFormProps, 'canConfigureUseK8sDriver'> {
@@ -327,6 +327,7 @@ interface NumericBuildInfraConfigPayloadType {
327327

328328
export enum BuildInfraProfileInputActionType {
329329
ADD_TARGET_PLATFORM = 'add_target_platform',
330+
TOGGLE_USE_K8S_DRIVER = 'toggle_use_k8s_driver',
330331
REMOVE_TARGET_PLATFORM = 'remove_target_platform',
331332
RENAME_TARGET_PLATFORM = 'rename_target_platform',
332333
RESTORE_PROFILE_CONFIG_SNAPSHOT = 'restore_profile_config_snapshot',
@@ -341,6 +342,10 @@ export enum BuildInfraProfileInputActionType {
341342
}
342343

343344
export type HandleProfileInputChangeType =
345+
| {
346+
action: BuildInfraProfileInputActionType.TOGGLE_USE_K8S_DRIVER
347+
data?: never
348+
}
344349
| {
345350
action: NumericBuildInfraConfigTypes
346351
data: ProfileInputDispatchDataType & NumericBuildInfraConfigPayloadType

0 commit comments

Comments
 (0)