@@ -178,7 +178,7 @@ export class AddPlanComponent implements OnInit {
178178 break ;
179179 case 'number' :
180180 control = new FormControl (
181- feature . defaultValue ,
181+ feature . defaultValue || 0 ,
182182 Validators . pattern ( / [ 0 - 9 ] / ) ,
183183 ) ;
184184 break ;
@@ -251,27 +251,22 @@ export class AddPlanComponent implements OnInit {
251251
252252 const featuresGroup = this . addPlanForm . get ( 'features' ) as FormGroup ;
253253 const selectedFeatures = featuresGroup
254- ? Object . keys ( featuresGroup . controls )
255- . filter (
256- key =>
257- featuresGroup . get ( key ) ?. value !== null &&
258- featuresGroup . get ( key ) ?. value !== '' ,
259- )
260- . reduce (
261- ( acc , key ) => {
262- const feature = this . featureValue . features . find (
263- f => ( f as any ) . key === key ,
264- ) ;
265- if ( feature ) {
266- acc [ feature . id ] = {
267- id : ( feature . value as any ) . id ,
268- value : featuresGroup . get ( key ) ?. value ,
269- } ;
270- }
271- return acc ;
272- } ,
273- { } as { [ key : string ] : any } ,
274- )
254+ ? Object . keys ( featuresGroup . controls ) . reduce (
255+ ( acc , key ) => {
256+ const feature = this . featureValue . features . find (
257+ f => ( f as any ) . key === key ,
258+ ) ;
259+ if ( feature ) {
260+ const featureVal = featuresGroup . get ( key ) ?. value ;
261+ acc [ feature . id ] = {
262+ id : ( feature . value as any ) ?. id ,
263+ value : featureVal || feature . defaultValue || '' ,
264+ } ;
265+ }
266+ return acc ;
267+ } ,
268+ { } as { [ key : string ] : any } ,
269+ )
275270 : { } ;
276271 const generalDetailsData = {
277272 name : domainData . name ,
@@ -317,6 +312,7 @@ export class AddPlanComponent implements OnInit {
317312 console . error ( 'Form is invalid' ) ;
318313 }
319314 }
315+
320316 onTierChange ( selectedTier : string ) : void {
321317 this . showStorageSize =
322318 selectedTier === 'STANDARD' || selectedTier === 'PREMIUM' ;
0 commit comments