Skip to content

Commit 3f9e523

Browse files
committed
feat(arc-saas): adding new feature named identity feature
adding new feature named identity feature
1 parent af46d61 commit 3f9e523

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,25 +189,40 @@ <h3>Plan Configuration</h3>
189189
>
190190
<div class="feature-details">
191191
<span class="feature-name">{{ feature.name }}</span>
192+
<!-- for boolean -->
192193
<div class="feature-input">
193194
<nb-toggle
194195
*ngIf="feature.type === 'boolean'"
195196
[formControlName]="feature.key"
196197
></nb-toggle>
198+
<!-- for number -->
197199
<input
198200
*ngIf="feature.type === 'number'"
199201
nbInput
200202
type="number"
201203
[formControlName]="feature.key"
202204
placeholder="{{ feature.name }}"
203205
/>
206+
<!-- for conditional metadata handling -->
207+
<select
208+
*ngIf="feature.metadata"
209+
[formControlName]="feature.key"
210+
>
211+
<option
212+
*ngFor="let option of feature.metadata"
213+
[value]="option"
214+
>
215+
{{ option }}
216+
</option>
217+
</select>
204218
<input
205-
*ngIf="feature.type === 'string'"
219+
*ngIf="!feature.metadata && feature.type === 'string'"
206220
nbInput
207221
type="text"
208222
[formControlName]="feature.key"
209223
placeholder="{{ feature.name }}"
210224
/>
225+
<!-- for object -->
211226
<textarea
212227
*ngIf="feature.value_type === 'object'"
213228
nbInput
@@ -232,7 +247,7 @@ <h3>Plan Configuration</h3>
232247
>
233248
Cancel
234249
</button>
235-
250+
236251
<button
237252
nbButton
238253
size="medium"

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export class AddPlanComponent implements OnInit {
183183
);
184184
break;
185185
case 'string':
186-
control = new FormControl();
186+
control = new FormControl(feature.defaultValue || '');
187187
break;
188188
case 'object':
189189
control = new FormControl();
@@ -374,6 +374,12 @@ export class AddPlanComponent implements OnInit {
374374
getFeatures() {
375375
this.featureListService.getFeatures().subscribe(res => {
376376
this.featureOption = res;
377+
// error handling
378+
this.featureOption.forEach(feature => {
379+
if (feature.metadata) {
380+
feature.metadata = feature.metadata.split(',');
381+
}
382+
});
377383
this.createFeatureControls();
378384
});
379385
}

0 commit comments

Comments
 (0)