File tree Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -204,8 +204,11 @@ <h3>Plan Configuration</h3>
204
204
placeholder ="{{ feature.name }} "
205
205
/>
206
206
<!-- for conditional metadata handling -->
207
- < select
208
- *ngIf ="feature.metadata "
207
+
208
+ <!-- <select
209
+ *ngIf="
210
+ feature.metadata && feature.metadata.length > 0
211
+ "
209
212
[formControlName]="feature.key"
210
213
>
211
214
<option
@@ -214,7 +217,27 @@ <h3>Plan Configuration</h3>
214
217
>
215
218
{{ option }}
216
219
</option>
217
- </ select >
220
+ </select> -->
221
+ < div class ="select ">
222
+ < nb-select
223
+ *ngIf ="
224
+ feature.metadata && feature.metadata.length > 0
225
+ "
226
+ class ="dropdown-wrapper "
227
+ placeholder ="Select IDP "
228
+ status ="basic "
229
+ [formControlName] ="feature.key "
230
+ >
231
+ < nb-option
232
+ *ngFor ="let option of feature.metadata "
233
+ [value] ="option "
234
+ >
235
+ {{ option }}
236
+ </ nb-option >
237
+ </ nb-select >
238
+ </ div >
239
+
240
+ <!-- For string input when metadata is empty -->
218
241
< input
219
242
*ngIf ="!feature.metadata && feature.type === 'string' "
220
243
nbInput
Original file line number Diff line number Diff line change @@ -376,10 +376,11 @@ export class AddPlanComponent implements OnInit {
376
376
this . featureOption = res ;
377
377
// error handling
378
378
this . featureOption . forEach ( feature => {
379
- if ( feature . metadata ) {
379
+ if ( typeof feature . metadata === 'string' ) {
380
380
feature . metadata = feature . metadata . split ( ',' ) ;
381
381
}
382
382
} ) ;
383
+ console . log ( this . featureOption ) ;
383
384
this . createFeatureControls ( ) ;
384
385
} ) ;
385
386
}
Original file line number Diff line number Diff line change
1
+ import { AnyObject } from '@project-lib/core/api' ;
1
2
import { FeatureValues } from './feature-values.model' ;
2
3
3
4
export class Features {
5
+ [ x : string ] : any ;
4
6
id ?: string ;
5
7
name : string ;
6
8
description : string ;
7
9
key : string ;
8
10
type : 'boolean' | 'number' | 'string' | 'object' ;
9
- defaultValue : any ;
11
+ defaultValue : number ;
12
+ metadata ?: any ;
10
13
value ?: FeatureValues ;
11
14
constructor ( data ?: Partial < Features > ) {
12
15
this . id = data ?. id ;
@@ -16,5 +19,6 @@ export class Features {
16
19
this . type = data . type ;
17
20
this . defaultValue = data . defaultValue ;
18
21
this . value = data . value ;
22
+ this . metadata = data ?. metadata ;
19
23
}
20
24
}
You can’t perform that action at this time.
0 commit comments