import { defaults } from 'lodash' ; import React from 'react' ; import type { IStage , IStageConfigProps } from '@spinnaker/core' ; import { FormikStageConfig } from '@spinnaker/core' ; import { PatchManifestStageForm } from './PatchManifestStageForm' ; import { ManifestSource } from '../../../manifest/ManifestSource' ; export class PatchManifestStageConfig extends React . Component < IStageConfigProps > { private readonly stage : IStage ; public constructor ( props ) { super ( props ) ; defaults ( props . stage , { app : props . application . name , source : ManifestSource . TEXT , options : { record : true , mergeStrategy : 'strategic' , } , cloudProvider : 'kubernetes' , } ) ; defaults ( props . stage . options , { mergeStrategy : props . stage . options . strategy , } ) ; delete props . stage . options . strategy ; if ( props . stage . patchBody && ! Array . isArray ( props . stage . patchBody ) ) { props . stage . patchBody = [ props . stage . patchBody ] ; } this . stage = props . stage ; } public render ( ) { return ( < FormikStageConfig { ... this . props } stage = { this . stage } onChange = { this . props . updateStage } render = { ( props ) => < PatchManifestStageForm { ... props } stageFieldUpdated = { this . props . stageFieldUpdated } / > } />); } }