Browse Source

Added trim spaces for alarm comments

pull/11976/head
mpetrov 2 years ago
parent
commit
bd680efe81
  1. 2
      ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.html
  2. 12
      ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.ts

2
ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.html

@ -173,7 +173,7 @@
<button mat-icon-button <button mat-icon-button
type="button" type="button"
matSuffix matSuffix
*ngIf="getAlarmCommentFormControl().value" *ngIf="getAlarmCommentValue()"
(click)="saveComment()"> (click)="saveComment()">
<mat-icon color="primary"> <mat-icon color="primary">
send send

12
ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.ts

@ -156,7 +156,7 @@ export class AlarmCommentComponent implements OnInit {
} }
saveComment(): void { saveComment(): void {
const commentInputValue: string = this.getAlarmCommentFormControl().value; const commentInputValue: string = this.getAlarmCommentValue();
if (commentInputValue) { if (commentInputValue) {
const comment: AlarmComment = { const comment: AlarmComment = {
alarmId: { alarmId: {
@ -174,7 +174,7 @@ export class AlarmCommentComponent implements OnInit {
} }
saveEditedComment(commentId: string): void { saveEditedComment(commentId: string): void {
const commentEditInputValue: string = this.getAlarmCommentEditFormControl().value; const commentEditInputValue: string = this.getAlarmCommentEditValue();
if (commentEditInputValue) { if (commentEditInputValue) {
const editedComment: AlarmComment = this.getAlarmCommentById(commentId); const editedComment: AlarmComment = this.getAlarmCommentById(commentId);
editedComment.comment.text = commentEditInputValue; editedComment.comment.text = commentEditInputValue;
@ -277,6 +277,14 @@ export class AlarmCommentComponent implements OnInit {
return this.alarmCommentFormGroup.get('alarmCommentEdit'); return this.alarmCommentFormGroup.get('alarmCommentEdit');
} }
getAlarmCommentValue(): string {
return this.alarmCommentFormGroup.get('alarmComment').value.trim();
}
private getAlarmCommentEditValue(): string {
return this.alarmCommentFormGroup.get('alarmCommentEdit').value.trim();
}
private clearCommentInput(): void { private clearCommentInput(): void {
this.getAlarmCommentFormControl().patchValue(''); this.getAlarmCommentFormControl().patchValue('');
} }

Loading…
Cancel
Save