@@ -178,7 +178,7 @@ export class AddPlanComponent implements OnInit {
178
178
break ;
179
179
case 'number' :
180
180
control = new FormControl (
181
- feature . defaultValue ,
181
+ feature . defaultValue || 0 ,
182
182
Validators . pattern ( / [ 0 - 9 ] / ) ,
183
183
) ;
184
184
break ;
@@ -251,27 +251,22 @@ export class AddPlanComponent implements OnInit {
251
251
252
252
const featuresGroup = this . addPlanForm . get ( 'features' ) as FormGroup ;
253
253
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
+ )
275
270
: { } ;
276
271
const generalDetailsData = {
277
272
name : domainData . name ,
@@ -317,6 +312,7 @@ export class AddPlanComponent implements OnInit {
317
312
console . error ( 'Form is invalid' ) ;
318
313
}
319
314
}
315
+
320
316
onTierChange ( selectedTier : string ) : void {
321
317
this . showStorageSize =
322
318
selectedTier === 'STANDARD' || selectedTier === 'PREMIUM' ;
0 commit comments