Skip to content

Commit 78337ba

Browse files
committed
fix(arc-saas): changes in data of features
changes in data of features
1 parent 3f9e523 commit 78337ba

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

projects/saas-ui/src/app/main/components/add-plan/add-plan.component.html

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,11 @@ <h3>Plan Configuration</h3>
204204
placeholder="{{ feature.name }}"
205205
/>
206206
<!-- for conditional metadata handling -->
207-
<select
208-
*ngIf="feature.metadata"
207+
208+
<!-- <select
209+
*ngIf="
210+
feature.metadata && feature.metadata.length > 0
211+
"
209212
[formControlName]="feature.key"
210213
>
211214
<option
@@ -214,7 +217,27 @@ <h3>Plan Configuration</h3>
214217
>
215218
{{ option }}
216219
</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 -->
218241
<input
219242
*ngIf="!feature.metadata && feature.type === 'string'"
220243
nbInput

projects/saas-ui/src/app/main/components/add-plan/add-plan.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,11 @@ export class AddPlanComponent implements OnInit {
376376
this.featureOption = res;
377377
// error handling
378378
this.featureOption.forEach(feature => {
379-
if (feature.metadata) {
379+
if (typeof feature.metadata === 'string') {
380380
feature.metadata = feature.metadata.split(',');
381381
}
382382
});
383+
console.log(this.featureOption);
383384
this.createFeatureControls();
384385
});
385386
}

projects/saas-ui/src/app/shared/models/feature.model.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
import {AnyObject} from '@project-lib/core/api';
12
import {FeatureValues} from './feature-values.model';
23

34
export class Features {
5+
[x: string]: any;
46
id?: string;
57
name: string;
68
description: string;
79
key: string;
810
type: 'boolean' | 'number' | 'string' | 'object';
9-
defaultValue: any;
11+
defaultValue: number;
12+
metadata?: any;
1013
value?: FeatureValues;
1114
constructor(data?: Partial<Features>) {
1215
this.id = data?.id;
@@ -16,5 +19,6 @@ export class Features {
1619
this.type = data.type;
1720
this.defaultValue = data.defaultValue;
1821
this.value = data.value;
22+
this.metadata = data?.metadata;
1923
}
2024
}

0 commit comments

Comments
 (0)