Merge pull request #3061 from thingsboard/json_dialog_fix
fix buf Json edit
This commit is contained in:
commit
61d96b94f2
@ -194,19 +194,19 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va
|
|||||||
}
|
}
|
||||||
|
|
||||||
beautifyJSON() {
|
beautifyJSON() {
|
||||||
const res = JSON.stringify(this.modelValue, null, 2);
|
if (this.jsonEditor && this.objectValid) {
|
||||||
if (this.jsonEditor) {
|
const res = JSON.stringify(this.modelValue, null, 2);
|
||||||
this.jsonEditor.setValue(res ? res : '', -1);
|
this.jsonEditor.setValue(res ? res : '', -1);
|
||||||
|
this.updateView();
|
||||||
}
|
}
|
||||||
this.updateView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
minifyJSON() {
|
minifyJSON() {
|
||||||
const res = JSON.stringify(this.modelValue);
|
if (this.jsonEditor && this.objectValid) {
|
||||||
if (this.jsonEditor) {
|
const res = JSON.stringify(this.modelValue);
|
||||||
this.jsonEditor.setValue(res ? res : '', -1);
|
this.jsonEditor.setValue(res ? res : '', -1);
|
||||||
|
this.updateView();
|
||||||
}
|
}
|
||||||
this.updateView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writeValue(value: any): void {
|
writeValue(value: any): void {
|
||||||
@ -254,6 +254,7 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va
|
|||||||
this.objectValid = !this.required;
|
this.objectValid = !this.required;
|
||||||
this.validationError = this.required ? 'Json object is required.' : '';
|
this.validationError = this.required ? 'Json object is required.' : '';
|
||||||
}
|
}
|
||||||
|
this.modelValue = data;
|
||||||
this.propagateChange(data);
|
this.propagateChange(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user