Spaces:
Building
Building
Update flare-ui/src/app/dialogs/intent-edit-dialog/intent-edit-dialog.component.ts
Browse files
flare-ui/src/app/dialogs/intent-edit-dialog/intent-edit-dialog.component.ts
CHANGED
@@ -127,13 +127,8 @@ export default class IntentEditDialogComponent implements OnInit {
|
|
127 |
return this.form.get('examples') as FormArray;
|
128 |
}
|
129 |
|
130 |
-
get parameters() {
|
131 |
-
|
132 |
-
if (!paramsArray) {
|
133 |
-
// Form henüz hazır değilse boş array döndür
|
134 |
-
return this.fb.array([]);
|
135 |
-
}
|
136 |
-
return paramsArray;
|
137 |
}
|
138 |
|
139 |
addExample() {
|
@@ -149,19 +144,22 @@ export default class IntentEditDialogComponent implements OnInit {
|
|
149 |
}
|
150 |
|
151 |
addParameter() {
|
152 |
-
this.
|
|
|
153 |
}
|
154 |
-
|
155 |
removeParameter(index: number) {
|
156 |
this.parameters.removeAt(index);
|
157 |
}
|
158 |
|
159 |
moveParameter(index: number, direction: 'up' | 'down') {
|
|
|
160 |
const newIndex = direction === 'up' ? index - 1 : index + 1;
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
|
|
165 |
}
|
166 |
}
|
167 |
|
|
|
127 |
return this.form.get('examples') as FormArray;
|
128 |
}
|
129 |
|
130 |
+
get parameters(): FormArray {
|
131 |
+
return this.form.get('parameters') as FormArray || this.fb.array([]);
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
addExample() {
|
|
|
144 |
}
|
145 |
|
146 |
addParameter() {
|
147 |
+
const parametersArray = this.form.get('parameters') as FormArray;
|
148 |
+
parametersArray.push(this.createParameterFormGroup());
|
149 |
}
|
150 |
+
|
151 |
removeParameter(index: number) {
|
152 |
this.parameters.removeAt(index);
|
153 |
}
|
154 |
|
155 |
moveParameter(index: number, direction: 'up' | 'down') {
|
156 |
+
const parametersArray = this.form.get('parameters') as FormArray;
|
157 |
const newIndex = direction === 'up' ? index - 1 : index + 1;
|
158 |
+
|
159 |
+
if (newIndex >= 0 && newIndex < parametersArray.length) {
|
160 |
+
const param = parametersArray.at(index);
|
161 |
+
parametersArray.removeAt(index);
|
162 |
+
parametersArray.insert(newIndex, param);
|
163 |
}
|
164 |
}
|
165 |
|