Skip to content

Commit c998dad

Browse files
[CYB-148] Proper Enter handling for adding values to multi-fields (#21)
1 parent 9b01ae9 commit c998dad

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/src/app/chain-page/components/custom-form/components/multi-input/multi-input.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
nz-input
2424
[formControl]="controls[i]"
2525
(keyup)="onChange(config)"
26+
(keyup.enter)="onAddClick()"
2627
/>
2728
<textarea
2829
*ngIf="config.type === 'textarea'"
@@ -39,6 +40,7 @@
3940
nzSize="small"
4041
nzType="primary"
4142
nzShape="circle"
43+
type="button"
4244
(click)="onAddClick()"
4345
*ngIf="i === 0 && config.multipleValues"
4446
title="Add field"
@@ -50,6 +52,7 @@
5052
nzDanger="true"
5153
nzShape="circle"
5254
nzSize="small"
55+
type="button"
5356
*ngIf="controls.length > 1"
5457
(click)="onRemoveFieldClick(controls[i], config)"
5558
title="Remove field"

flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/src/app/chain-page/components/custom-form/components/multi-input/multi-input.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ export class MultiInputComponent implements OnInit {
4444
}
4545

4646
onAddClick() {
47-
this.controls.push(
48-
new FormControl('')
49-
);
47+
if (this.config.multipleValues==true) {
48+
this.controls.push(
49+
new FormControl('')
50+
);
51+
}
5052
}
5153

5254
onChange(config: CustomFormConfig) {

0 commit comments

Comments
 (0)