From 10b9e9c98e462aea29b2c56fac24d8789363a81a Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Tue, 7 Jul 2020 18:13:02 +0300 Subject: [PATCH 1/2] LwM2M: Back - add command "/3/0/5" - trigger client --- .../app/shared/components/json-object-edit.component.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/shared/components/json-object-edit.component.ts b/ui-ngx/src/app/shared/components/json-object-edit.component.ts index ba68a5090d..5720b92e1e 100644 --- a/ui-ngx/src/app/shared/components/json-object-edit.component.ts +++ b/ui-ngx/src/app/shared/components/json-object-edit.component.ts @@ -194,19 +194,19 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va } beautifyJSON() { - const res = JSON.stringify(this.modelValue, null, 2); if (this.jsonEditor) { + const res = JSON.stringify(this.modelValue, null, 2); this.jsonEditor.setValue(res ? res : '', -1); + this.updateView(); } - this.updateView(); } minifyJSON() { - const res = JSON.stringify(this.modelValue); if (this.jsonEditor) { + const res = JSON.stringify(this.modelValue); this.jsonEditor.setValue(res ? res : '', -1); + this.updateView(); } - this.updateView(); } writeValue(value: any): void { @@ -254,6 +254,7 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va this.objectValid = !this.required; this.validationError = this.required ? 'Json object is required.' : ''; } + this.modelValue = data; this.propagateChange(data); } } From 82668c9da23b6f92a45ff973afa07aae3b684371 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Wed, 8 Jul 2020 11:55:47 +0300 Subject: [PATCH 2/2] fix bug Json edit dialog: add validate --- .../src/app/shared/components/json-object-edit.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/shared/components/json-object-edit.component.ts b/ui-ngx/src/app/shared/components/json-object-edit.component.ts index 5720b92e1e..e8ae19519d 100644 --- a/ui-ngx/src/app/shared/components/json-object-edit.component.ts +++ b/ui-ngx/src/app/shared/components/json-object-edit.component.ts @@ -194,7 +194,7 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va } beautifyJSON() { - if (this.jsonEditor) { + if (this.jsonEditor && this.objectValid) { const res = JSON.stringify(this.modelValue, null, 2); this.jsonEditor.setValue(res ? res : '', -1); this.updateView(); @@ -202,7 +202,7 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va } minifyJSON() { - if (this.jsonEditor) { + if (this.jsonEditor && this.objectValid) { const res = JSON.stringify(this.modelValue); this.jsonEditor.setValue(res ? res : '', -1); this.updateView();