thingsboard/ui-ngx/src/app/shared/components/json-object-edit.component.ts

295 lines
7.9 KiB
TypeScript
Raw Normal View History

2019-08-27 20:07:09 +03:00
///
2021-01-11 13:42:16 +02:00
/// Copyright © 2016-2021 The Thingsboard Authors
2019-08-27 20:07:09 +03:00
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
import { Component, ElementRef, forwardRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, Validator } from '@angular/forms';
2020-12-28 16:06:36 +02:00
import { Ace } from 'ace-builds';
2019-08-27 20:07:09 +03:00
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { ActionNotificationHide, ActionNotificationShow } from '@core/notification/notification.actions';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
2019-12-27 16:35:11 +02:00
import { CancelAnimationFrame, RafService } from '@core/services/raf.service';
2021-04-14 15:52:23 +03:00
import { guid, isUndefined, isDefinedAndNotNull, isLiteralObject } from '@core/utils';
import { ResizeObserver } from '@juggle/resize-observer';
2020-12-28 16:06:36 +02:00
import { getAce } from '@shared/models/ace/ace.models';
2019-08-27 20:07:09 +03:00
@Component({
selector: 'tb-json-object-edit',
templateUrl: './json-object-edit.component.html',
styleUrls: ['./json-object-edit.component.scss'],
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => JsonObjectEditComponent),
multi: true
},
{
provide: NG_VALIDATORS,
useExisting: forwardRef(() => JsonObjectEditComponent),
multi: true,
}
]
})
2019-12-27 16:35:11 +02:00
export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Validator, OnDestroy {
2019-08-27 20:07:09 +03:00
@ViewChild('jsonEditor', {static: true})
jsonEditorElmRef: ElementRef;
2020-12-28 16:06:36 +02:00
private jsonEditor: Ace.Editor;
2019-12-27 16:35:11 +02:00
private editorsResizeCaf: CancelAnimationFrame;
private editorResize$: ResizeObserver;
2019-08-27 20:07:09 +03:00
toastTargetId = `jsonObjectEditor-${guid()}`;
2019-08-27 20:07:09 +03:00
@Input() label: string;
@Input() disabled: boolean;
@Input() fillHeight: boolean;
Develop/lwm2m (#3826) * LwM2M - Start transport * LwM2M - Test endpoint * LwM2M - Test endpoint * LwM2M - Test add xml * LwM2M device registration * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M implementation * LwM2M - add to service telemetry and attribute * LwM2M add to service attribute and telemetry * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add transport.process * LwM2M - delete from yml tenantid, PSK -ok * LwM2M - yml del tenantId * LwM2M - add RPK * LwM2M - add connect only x509 certificate. Crate certificates in serverKeyStore.jks and clientKeyStore.jks * LwM2M - add no_sec * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add read JKS from file * LwM2M - add read JKS from file * LwM2M - add bootstrap cert * LwM2M - add bootstrap RPK * LwM2M - add bootstrap No_sec * LwM2M - cleaned the code * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - fix bug CoAP transport * LwM2M: UI - add Json to credentials * LwM2M: Back - add command "/3/0/5" - trigger client * LwM2M: fix bug Json edit dialog * LwM2M: fix bug Json edit dialog * lwm2m: fix bug Json edit dialog: add validate * lwm2m: UI add tabs * lwm2m: UI add tabs (cleaner) * lwm2m: add interface SecurityConfigModels * lwm2m: add interface SecurityConfigModels2 * lwm2m: change html * lwm2m: UI add bootstrap component * lwm2m: UI add bootstrap component with FormControl * lwm2m: UI add start Observe * lwm2m: UI - correct * lwm2m: UI - correct * lwm2m: UI - add Validator: BS RPK, X509 * lwm2m: UI - add Observe * lwm2m: UI - finish Observe * lwm2m: UI - fix bug config-service update identity * lwm2m: Bootstarp&Sewrver All config secure * lwm2m: Bootstarp&Sewrver All config secure for new Front format * lwm2m: Bootstarp&Sewrver Different config secure for new Front format * lwm2m: Add attributes Gui and Backend * lwm2m: Add attributes Gui and Backend final * lwm2m: Add telemetrys to Gui * lwm2m: Add Attribute & telemetry in Gui to instance * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry for mobile * lwm2m: Model folder * lwm2m: Ok on AWS: NoSec, PSK, X509 bad registration - RPK * lwm2m: KeyStore start only one * lwm2m: Server observe ok * lwm2m: Server fix bug finish session without remove * lwm2m: Server add function installValue * lwm2m: Server add function getAttrTelemetry to tingsboard * lwm2m: Server add function installValue * lwm2m: Server add function update Telemetry, Attr from observe * lwm2m: Server add comments * lwm2m: Server add session listener * lwm2m: Server add onGetChangeCredentials with analyze * lwm2m: Server add onGetChangeCredentials with analyze Onserve add * lwm2m: Server: updated algorithm for analyzing dynamic changes in attributes / telemetry / observation * lwm2m: fix bug: "ngx-flowchart" compile * lwm2m: get value resource OPAQUE - byte [] to HexString * lwm2m: change path to base * lwm2m: fix bug COAP & lwm2m * Lwm2m_3_2: back: cleaner, test bootstrap-ok front: restore * Lwm2m_3_2: back: del SynchronousRegistrationListener.java * Lwm2m_3_2: front: start profile lwm2m UI * Lwm2m_3_2: front&back: add to profile lwm2m (api, getModels...) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (2) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (3) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (4) * Lwm2m_3_2: front: add update change bootstrapConfig and save to config json * Lwm2m_3_2: update after merge master * lwm2m: fix bug proto * lwm2m: fix bug in yml keyStore.jks * lwm2m: fix bug tests * lwm2m: front: add nameThingsboard * lwm2m: fix bug Autowired lwm2mContext, caseCamel * lwm2m: back-end^ start api /lwm2m/deviceProfile/bootstrap * lwm2m: back-end: add method read models from resources * lwm2m: back-end/front: add and finish api bootstrapConfig * lwm2m: back-end: add decode profile * lwm2m: back-end: add new bin in transport api * lwm2m: add microservice lwm2m and docker lwm2m. * lwm2m: add microservice lwm2m and docker lwm2m (fix bug) * lwm2m: front: start fix bug disabled resources * lwm2m: master to lwm2m merge, front add change attribute, telemetry * lwm2m: front PR * lwm2m: front add sort keyName to Json on the start * lwm2m: front add instances * lwm2m: front add/del instances FormGrp Value * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m # Conflicts: # common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java # common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/SessionMsgListener.java # ui-ngx/src/app/modules/home/components/home-components.module.ts * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m * lwm2m: Front: del sort after add/del instance * lwm2m: Front: fix bug reindex FormArray after update * Lwm2m: Front fix bug add/del instans * Lwm2m: Front finish1 profile * Lwm2m: Back add profile to ModelClient * Lwm2m: Back add form profile sent thingsboard: attr/tel/observe * Lwm2m: Back -> fix bug: serverKeyStore.jks] Unable to load KeyStore files server * Lwm2m: Back -> fix bug: onRegistered an unReg * Lwm2m: Back -> add updateProfiles * Lwm2m: Back -> add updateDevice and updateProfile dynamic * Lwm2m: Back -> error if CoapCode not access * Lwm2m: Front -> clear credential * Lwm2m: Front -> credential fix bug button "save" * Lwm2m: Back -> add telemetry logLwm2m Co-authored-by: nickAS21 <nick@avalr.com.ua>
2020-12-09 17:13:11 +02:00
@Input() editorStyle: { [klass: string]: any };
2021-01-19 19:36:57 +02:00
@Input() sort: (key: string, value: any) => any;
2019-10-24 19:52:19 +03:00
2019-08-27 20:07:09 +03:00
private requiredValue: boolean;
Develop/lwm2m (#3826) * LwM2M - Start transport * LwM2M - Test endpoint * LwM2M - Test endpoint * LwM2M - Test add xml * LwM2M device registration * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M implementation * LwM2M - add to service telemetry and attribute * LwM2M add to service attribute and telemetry * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add transport.process * LwM2M - delete from yml tenantid, PSK -ok * LwM2M - yml del tenantId * LwM2M - add RPK * LwM2M - add connect only x509 certificate. Crate certificates in serverKeyStore.jks and clientKeyStore.jks * LwM2M - add no_sec * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add read JKS from file * LwM2M - add read JKS from file * LwM2M - add bootstrap cert * LwM2M - add bootstrap RPK * LwM2M - add bootstrap No_sec * LwM2M - cleaned the code * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - fix bug CoAP transport * LwM2M: UI - add Json to credentials * LwM2M: Back - add command "/3/0/5" - trigger client * LwM2M: fix bug Json edit dialog * LwM2M: fix bug Json edit dialog * lwm2m: fix bug Json edit dialog: add validate * lwm2m: UI add tabs * lwm2m: UI add tabs (cleaner) * lwm2m: add interface SecurityConfigModels * lwm2m: add interface SecurityConfigModels2 * lwm2m: change html * lwm2m: UI add bootstrap component * lwm2m: UI add bootstrap component with FormControl * lwm2m: UI add start Observe * lwm2m: UI - correct * lwm2m: UI - correct * lwm2m: UI - add Validator: BS RPK, X509 * lwm2m: UI - add Observe * lwm2m: UI - finish Observe * lwm2m: UI - fix bug config-service update identity * lwm2m: Bootstarp&Sewrver All config secure * lwm2m: Bootstarp&Sewrver All config secure for new Front format * lwm2m: Bootstarp&Sewrver Different config secure for new Front format * lwm2m: Add attributes Gui and Backend * lwm2m: Add attributes Gui and Backend final * lwm2m: Add telemetrys to Gui * lwm2m: Add Attribute & telemetry in Gui to instance * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry for mobile * lwm2m: Model folder * lwm2m: Ok on AWS: NoSec, PSK, X509 bad registration - RPK * lwm2m: KeyStore start only one * lwm2m: Server observe ok * lwm2m: Server fix bug finish session without remove * lwm2m: Server add function installValue * lwm2m: Server add function getAttrTelemetry to tingsboard * lwm2m: Server add function installValue * lwm2m: Server add function update Telemetry, Attr from observe * lwm2m: Server add comments * lwm2m: Server add session listener * lwm2m: Server add onGetChangeCredentials with analyze * lwm2m: Server add onGetChangeCredentials with analyze Onserve add * lwm2m: Server: updated algorithm for analyzing dynamic changes in attributes / telemetry / observation * lwm2m: fix bug: "ngx-flowchart" compile * lwm2m: get value resource OPAQUE - byte [] to HexString * lwm2m: change path to base * lwm2m: fix bug COAP & lwm2m * Lwm2m_3_2: back: cleaner, test bootstrap-ok front: restore * Lwm2m_3_2: back: del SynchronousRegistrationListener.java * Lwm2m_3_2: front: start profile lwm2m UI * Lwm2m_3_2: front&back: add to profile lwm2m (api, getModels...) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (2) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (3) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (4) * Lwm2m_3_2: front: add update change bootstrapConfig and save to config json * Lwm2m_3_2: update after merge master * lwm2m: fix bug proto * lwm2m: fix bug in yml keyStore.jks * lwm2m: fix bug tests * lwm2m: front: add nameThingsboard * lwm2m: fix bug Autowired lwm2mContext, caseCamel * lwm2m: back-end^ start api /lwm2m/deviceProfile/bootstrap * lwm2m: back-end: add method read models from resources * lwm2m: back-end/front: add and finish api bootstrapConfig * lwm2m: back-end: add decode profile * lwm2m: back-end: add new bin in transport api * lwm2m: add microservice lwm2m and docker lwm2m. * lwm2m: add microservice lwm2m and docker lwm2m (fix bug) * lwm2m: front: start fix bug disabled resources * lwm2m: master to lwm2m merge, front add change attribute, telemetry * lwm2m: front PR * lwm2m: front add sort keyName to Json on the start * lwm2m: front add instances * lwm2m: front add/del instances FormGrp Value * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m # Conflicts: # common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java # common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/SessionMsgListener.java # ui-ngx/src/app/modules/home/components/home-components.module.ts * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m * lwm2m: Front: del sort after add/del instance * lwm2m: Front: fix bug reindex FormArray after update * Lwm2m: Front fix bug add/del instans * Lwm2m: Front finish1 profile * Lwm2m: Back add profile to ModelClient * Lwm2m: Back add form profile sent thingsboard: attr/tel/observe * Lwm2m: Back -> fix bug: serverKeyStore.jks] Unable to load KeyStore files server * Lwm2m: Back -> fix bug: onRegistered an unReg * Lwm2m: Back -> add updateProfiles * Lwm2m: Back -> add updateDevice and updateProfile dynamic * Lwm2m: Back -> error if CoapCode not access * Lwm2m: Front -> clear credential * Lwm2m: Front -> credential fix bug button "save" * Lwm2m: Back -> add telemetry logLwm2m Co-authored-by: nickAS21 <nick@avalr.com.ua>
2020-12-09 17:13:11 +02:00
2019-08-27 20:07:09 +03:00
get required(): boolean {
return this.requiredValue;
}
Develop/lwm2m (#3826) * LwM2M - Start transport * LwM2M - Test endpoint * LwM2M - Test endpoint * LwM2M - Test add xml * LwM2M device registration * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M implementation * LwM2M - add to service telemetry and attribute * LwM2M add to service attribute and telemetry * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add transport.process * LwM2M - delete from yml tenantid, PSK -ok * LwM2M - yml del tenantId * LwM2M - add RPK * LwM2M - add connect only x509 certificate. Crate certificates in serverKeyStore.jks and clientKeyStore.jks * LwM2M - add no_sec * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add read JKS from file * LwM2M - add read JKS from file * LwM2M - add bootstrap cert * LwM2M - add bootstrap RPK * LwM2M - add bootstrap No_sec * LwM2M - cleaned the code * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - fix bug CoAP transport * LwM2M: UI - add Json to credentials * LwM2M: Back - add command "/3/0/5" - trigger client * LwM2M: fix bug Json edit dialog * LwM2M: fix bug Json edit dialog * lwm2m: fix bug Json edit dialog: add validate * lwm2m: UI add tabs * lwm2m: UI add tabs (cleaner) * lwm2m: add interface SecurityConfigModels * lwm2m: add interface SecurityConfigModels2 * lwm2m: change html * lwm2m: UI add bootstrap component * lwm2m: UI add bootstrap component with FormControl * lwm2m: UI add start Observe * lwm2m: UI - correct * lwm2m: UI - correct * lwm2m: UI - add Validator: BS RPK, X509 * lwm2m: UI - add Observe * lwm2m: UI - finish Observe * lwm2m: UI - fix bug config-service update identity * lwm2m: Bootstarp&Sewrver All config secure * lwm2m: Bootstarp&Sewrver All config secure for new Front format * lwm2m: Bootstarp&Sewrver Different config secure for new Front format * lwm2m: Add attributes Gui and Backend * lwm2m: Add attributes Gui and Backend final * lwm2m: Add telemetrys to Gui * lwm2m: Add Attribute & telemetry in Gui to instance * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry for mobile * lwm2m: Model folder * lwm2m: Ok on AWS: NoSec, PSK, X509 bad registration - RPK * lwm2m: KeyStore start only one * lwm2m: Server observe ok * lwm2m: Server fix bug finish session without remove * lwm2m: Server add function installValue * lwm2m: Server add function getAttrTelemetry to tingsboard * lwm2m: Server add function installValue * lwm2m: Server add function update Telemetry, Attr from observe * lwm2m: Server add comments * lwm2m: Server add session listener * lwm2m: Server add onGetChangeCredentials with analyze * lwm2m: Server add onGetChangeCredentials with analyze Onserve add * lwm2m: Server: updated algorithm for analyzing dynamic changes in attributes / telemetry / observation * lwm2m: fix bug: "ngx-flowchart" compile * lwm2m: get value resource OPAQUE - byte [] to HexString * lwm2m: change path to base * lwm2m: fix bug COAP & lwm2m * Lwm2m_3_2: back: cleaner, test bootstrap-ok front: restore * Lwm2m_3_2: back: del SynchronousRegistrationListener.java * Lwm2m_3_2: front: start profile lwm2m UI * Lwm2m_3_2: front&back: add to profile lwm2m (api, getModels...) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (2) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (3) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (4) * Lwm2m_3_2: front: add update change bootstrapConfig and save to config json * Lwm2m_3_2: update after merge master * lwm2m: fix bug proto * lwm2m: fix bug in yml keyStore.jks * lwm2m: fix bug tests * lwm2m: front: add nameThingsboard * lwm2m: fix bug Autowired lwm2mContext, caseCamel * lwm2m: back-end^ start api /lwm2m/deviceProfile/bootstrap * lwm2m: back-end: add method read models from resources * lwm2m: back-end/front: add and finish api bootstrapConfig * lwm2m: back-end: add decode profile * lwm2m: back-end: add new bin in transport api * lwm2m: add microservice lwm2m and docker lwm2m. * lwm2m: add microservice lwm2m and docker lwm2m (fix bug) * lwm2m: front: start fix bug disabled resources * lwm2m: master to lwm2m merge, front add change attribute, telemetry * lwm2m: front PR * lwm2m: front add sort keyName to Json on the start * lwm2m: front add instances * lwm2m: front add/del instances FormGrp Value * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m # Conflicts: # common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java # common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/SessionMsgListener.java # ui-ngx/src/app/modules/home/components/home-components.module.ts * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m * lwm2m: Front: del sort after add/del instance * lwm2m: Front: fix bug reindex FormArray after update * Lwm2m: Front fix bug add/del instans * Lwm2m: Front finish1 profile * Lwm2m: Back add profile to ModelClient * Lwm2m: Back add form profile sent thingsboard: attr/tel/observe * Lwm2m: Back -> fix bug: serverKeyStore.jks] Unable to load KeyStore files server * Lwm2m: Back -> fix bug: onRegistered an unReg * Lwm2m: Back -> add updateProfiles * Lwm2m: Back -> add updateDevice and updateProfile dynamic * Lwm2m: Back -> error if CoapCode not access * Lwm2m: Front -> clear credential * Lwm2m: Front -> credential fix bug button "save" * Lwm2m: Back -> add telemetry logLwm2m Co-authored-by: nickAS21 <nick@avalr.com.ua>
2020-12-09 17:13:11 +02:00
2019-08-27 20:07:09 +03:00
@Input()
set required(value: boolean) {
this.requiredValue = coerceBooleanProperty(value);
}
private readonlyValue: boolean;
Develop/lwm2m (#3826) * LwM2M - Start transport * LwM2M - Test endpoint * LwM2M - Test endpoint * LwM2M - Test add xml * LwM2M device registration * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M implementation * LwM2M - add to service telemetry and attribute * LwM2M add to service attribute and telemetry * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add transport.process * LwM2M - delete from yml tenantid, PSK -ok * LwM2M - yml del tenantId * LwM2M - add RPK * LwM2M - add connect only x509 certificate. Crate certificates in serverKeyStore.jks and clientKeyStore.jks * LwM2M - add no_sec * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add read JKS from file * LwM2M - add read JKS from file * LwM2M - add bootstrap cert * LwM2M - add bootstrap RPK * LwM2M - add bootstrap No_sec * LwM2M - cleaned the code * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - fix bug CoAP transport * LwM2M: UI - add Json to credentials * LwM2M: Back - add command "/3/0/5" - trigger client * LwM2M: fix bug Json edit dialog * LwM2M: fix bug Json edit dialog * lwm2m: fix bug Json edit dialog: add validate * lwm2m: UI add tabs * lwm2m: UI add tabs (cleaner) * lwm2m: add interface SecurityConfigModels * lwm2m: add interface SecurityConfigModels2 * lwm2m: change html * lwm2m: UI add bootstrap component * lwm2m: UI add bootstrap component with FormControl * lwm2m: UI add start Observe * lwm2m: UI - correct * lwm2m: UI - correct * lwm2m: UI - add Validator: BS RPK, X509 * lwm2m: UI - add Observe * lwm2m: UI - finish Observe * lwm2m: UI - fix bug config-service update identity * lwm2m: Bootstarp&Sewrver All config secure * lwm2m: Bootstarp&Sewrver All config secure for new Front format * lwm2m: Bootstarp&Sewrver Different config secure for new Front format * lwm2m: Add attributes Gui and Backend * lwm2m: Add attributes Gui and Backend final * lwm2m: Add telemetrys to Gui * lwm2m: Add Attribute & telemetry in Gui to instance * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry for mobile * lwm2m: Model folder * lwm2m: Ok on AWS: NoSec, PSK, X509 bad registration - RPK * lwm2m: KeyStore start only one * lwm2m: Server observe ok * lwm2m: Server fix bug finish session without remove * lwm2m: Server add function installValue * lwm2m: Server add function getAttrTelemetry to tingsboard * lwm2m: Server add function installValue * lwm2m: Server add function update Telemetry, Attr from observe * lwm2m: Server add comments * lwm2m: Server add session listener * lwm2m: Server add onGetChangeCredentials with analyze * lwm2m: Server add onGetChangeCredentials with analyze Onserve add * lwm2m: Server: updated algorithm for analyzing dynamic changes in attributes / telemetry / observation * lwm2m: fix bug: "ngx-flowchart" compile * lwm2m: get value resource OPAQUE - byte [] to HexString * lwm2m: change path to base * lwm2m: fix bug COAP & lwm2m * Lwm2m_3_2: back: cleaner, test bootstrap-ok front: restore * Lwm2m_3_2: back: del SynchronousRegistrationListener.java * Lwm2m_3_2: front: start profile lwm2m UI * Lwm2m_3_2: front&back: add to profile lwm2m (api, getModels...) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (2) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (3) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (4) * Lwm2m_3_2: front: add update change bootstrapConfig and save to config json * Lwm2m_3_2: update after merge master * lwm2m: fix bug proto * lwm2m: fix bug in yml keyStore.jks * lwm2m: fix bug tests * lwm2m: front: add nameThingsboard * lwm2m: fix bug Autowired lwm2mContext, caseCamel * lwm2m: back-end^ start api /lwm2m/deviceProfile/bootstrap * lwm2m: back-end: add method read models from resources * lwm2m: back-end/front: add and finish api bootstrapConfig * lwm2m: back-end: add decode profile * lwm2m: back-end: add new bin in transport api * lwm2m: add microservice lwm2m and docker lwm2m. * lwm2m: add microservice lwm2m and docker lwm2m (fix bug) * lwm2m: front: start fix bug disabled resources * lwm2m: master to lwm2m merge, front add change attribute, telemetry * lwm2m: front PR * lwm2m: front add sort keyName to Json on the start * lwm2m: front add instances * lwm2m: front add/del instances FormGrp Value * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m # Conflicts: # common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java # common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/SessionMsgListener.java # ui-ngx/src/app/modules/home/components/home-components.module.ts * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m * lwm2m: Front: del sort after add/del instance * lwm2m: Front: fix bug reindex FormArray after update * Lwm2m: Front fix bug add/del instans * Lwm2m: Front finish1 profile * Lwm2m: Back add profile to ModelClient * Lwm2m: Back add form profile sent thingsboard: attr/tel/observe * Lwm2m: Back -> fix bug: serverKeyStore.jks] Unable to load KeyStore files server * Lwm2m: Back -> fix bug: onRegistered an unReg * Lwm2m: Back -> add updateProfiles * Lwm2m: Back -> add updateDevice and updateProfile dynamic * Lwm2m: Back -> error if CoapCode not access * Lwm2m: Front -> clear credential * Lwm2m: Front -> credential fix bug button "save" * Lwm2m: Back -> add telemetry logLwm2m Co-authored-by: nickAS21 <nick@avalr.com.ua>
2020-12-09 17:13:11 +02:00
2019-08-27 20:07:09 +03:00
get readonly(): boolean {
return this.readonlyValue;
}
Develop/lwm2m (#3826) * LwM2M - Start transport * LwM2M - Test endpoint * LwM2M - Test endpoint * LwM2M - Test add xml * LwM2M device registration * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M implementation * LwM2M - add to service telemetry and attribute * LwM2M add to service attribute and telemetry * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add transport.process * LwM2M - delete from yml tenantid, PSK -ok * LwM2M - yml del tenantId * LwM2M - add RPK * LwM2M - add connect only x509 certificate. Crate certificates in serverKeyStore.jks and clientKeyStore.jks * LwM2M - add no_sec * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add read JKS from file * LwM2M - add read JKS from file * LwM2M - add bootstrap cert * LwM2M - add bootstrap RPK * LwM2M - add bootstrap No_sec * LwM2M - cleaned the code * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - fix bug CoAP transport * LwM2M: UI - add Json to credentials * LwM2M: Back - add command "/3/0/5" - trigger client * LwM2M: fix bug Json edit dialog * LwM2M: fix bug Json edit dialog * lwm2m: fix bug Json edit dialog: add validate * lwm2m: UI add tabs * lwm2m: UI add tabs (cleaner) * lwm2m: add interface SecurityConfigModels * lwm2m: add interface SecurityConfigModels2 * lwm2m: change html * lwm2m: UI add bootstrap component * lwm2m: UI add bootstrap component with FormControl * lwm2m: UI add start Observe * lwm2m: UI - correct * lwm2m: UI - correct * lwm2m: UI - add Validator: BS RPK, X509 * lwm2m: UI - add Observe * lwm2m: UI - finish Observe * lwm2m: UI - fix bug config-service update identity * lwm2m: Bootstarp&Sewrver All config secure * lwm2m: Bootstarp&Sewrver All config secure for new Front format * lwm2m: Bootstarp&Sewrver Different config secure for new Front format * lwm2m: Add attributes Gui and Backend * lwm2m: Add attributes Gui and Backend final * lwm2m: Add telemetrys to Gui * lwm2m: Add Attribute & telemetry in Gui to instance * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry for mobile * lwm2m: Model folder * lwm2m: Ok on AWS: NoSec, PSK, X509 bad registration - RPK * lwm2m: KeyStore start only one * lwm2m: Server observe ok * lwm2m: Server fix bug finish session without remove * lwm2m: Server add function installValue * lwm2m: Server add function getAttrTelemetry to tingsboard * lwm2m: Server add function installValue * lwm2m: Server add function update Telemetry, Attr from observe * lwm2m: Server add comments * lwm2m: Server add session listener * lwm2m: Server add onGetChangeCredentials with analyze * lwm2m: Server add onGetChangeCredentials with analyze Onserve add * lwm2m: Server: updated algorithm for analyzing dynamic changes in attributes / telemetry / observation * lwm2m: fix bug: "ngx-flowchart" compile * lwm2m: get value resource OPAQUE - byte [] to HexString * lwm2m: change path to base * lwm2m: fix bug COAP & lwm2m * Lwm2m_3_2: back: cleaner, test bootstrap-ok front: restore * Lwm2m_3_2: back: del SynchronousRegistrationListener.java * Lwm2m_3_2: front: start profile lwm2m UI * Lwm2m_3_2: front&back: add to profile lwm2m (api, getModels...) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (2) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (3) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (4) * Lwm2m_3_2: front: add update change bootstrapConfig and save to config json * Lwm2m_3_2: update after merge master * lwm2m: fix bug proto * lwm2m: fix bug in yml keyStore.jks * lwm2m: fix bug tests * lwm2m: front: add nameThingsboard * lwm2m: fix bug Autowired lwm2mContext, caseCamel * lwm2m: back-end^ start api /lwm2m/deviceProfile/bootstrap * lwm2m: back-end: add method read models from resources * lwm2m: back-end/front: add and finish api bootstrapConfig * lwm2m: back-end: add decode profile * lwm2m: back-end: add new bin in transport api * lwm2m: add microservice lwm2m and docker lwm2m. * lwm2m: add microservice lwm2m and docker lwm2m (fix bug) * lwm2m: front: start fix bug disabled resources * lwm2m: master to lwm2m merge, front add change attribute, telemetry * lwm2m: front PR * lwm2m: front add sort keyName to Json on the start * lwm2m: front add instances * lwm2m: front add/del instances FormGrp Value * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m # Conflicts: # common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java # common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/SessionMsgListener.java # ui-ngx/src/app/modules/home/components/home-components.module.ts * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m * lwm2m: Front: del sort after add/del instance * lwm2m: Front: fix bug reindex FormArray after update * Lwm2m: Front fix bug add/del instans * Lwm2m: Front finish1 profile * Lwm2m: Back add profile to ModelClient * Lwm2m: Back add form profile sent thingsboard: attr/tel/observe * Lwm2m: Back -> fix bug: serverKeyStore.jks] Unable to load KeyStore files server * Lwm2m: Back -> fix bug: onRegistered an unReg * Lwm2m: Back -> add updateProfiles * Lwm2m: Back -> add updateDevice and updateProfile dynamic * Lwm2m: Back -> error if CoapCode not access * Lwm2m: Front -> clear credential * Lwm2m: Front -> credential fix bug button "save" * Lwm2m: Back -> add telemetry logLwm2m Co-authored-by: nickAS21 <nick@avalr.com.ua>
2020-12-09 17:13:11 +02:00
2019-08-27 20:07:09 +03:00
@Input()
set readonly(value: boolean) {
this.readonlyValue = coerceBooleanProperty(value);
}
fullscreen = false;
modelValue: any;
contentValue: string;
objectValid: boolean;
validationError: string;
errorShowed = false;
2020-09-03 10:04:03 +03:00
ignoreChange = false;
2019-08-27 20:07:09 +03:00
private propagateChange = null;
constructor(public elementRef: ElementRef,
2019-12-27 16:35:11 +02:00
protected store: Store<AppState>,
private raf: RafService) {
2019-08-27 20:07:09 +03:00
}
ngOnInit(): void {
const editorElement = this.jsonEditorElmRef.nativeElement;
2020-12-28 16:06:36 +02:00
let editorOptions: Partial<Ace.EditorOptions> = {
2019-08-27 20:07:09 +03:00
mode: 'ace/mode/json',
showGutter: true,
showPrintMargin: false,
readOnly: this.disabled || this.readonly
2019-08-27 20:07:09 +03:00
};
const advancedOptions = {
enableSnippets: true,
enableBasicAutocompletion: true,
enableLiveAutocompletion: true
};
editorOptions = {...editorOptions, ...advancedOptions};
2020-12-28 16:06:36 +02:00
getAce().subscribe(
(ace) => {
this.jsonEditor = ace.edit(editorElement, editorOptions);
this.jsonEditor.session.setUseWrapMode(false);
this.jsonEditor.setValue(this.contentValue ? this.contentValue : '', -1);
this.jsonEditor.setReadOnly(this.disabled || this.readonly);
this.jsonEditor.on('change', () => {
if (!this.ignoreChange) {
this.cleanupJsonErrors();
this.updateView();
}
});
this.editorResize$ = new ResizeObserver(() => {
this.onAceEditorResize();
});
this.editorResize$.observe(editorElement);
2020-09-03 10:04:03 +03:00
}
2020-12-28 16:06:36 +02:00
);
2019-12-27 16:35:11 +02:00
}
ngOnDestroy(): void {
if (this.editorResize$) {
this.editorResize$.disconnect();
2019-12-27 16:35:11 +02:00
}
}
private onAceEditorResize() {
if (this.editorsResizeCaf) {
this.editorsResizeCaf();
this.editorsResizeCaf = null;
}
this.editorsResizeCaf = this.raf.raf(() => {
this.jsonEditor.resize();
this.jsonEditor.renderer.updateFull();
});
2019-08-27 20:07:09 +03:00
}
registerOnChange(fn: any): void {
this.propagateChange = fn;
}
registerOnTouched(fn: any): void {
}
setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
if (this.jsonEditor) {
this.jsonEditor.setReadOnly(this.disabled || this.readonly);
}
2019-08-27 20:07:09 +03:00
}
public validate(c: FormControl) {
return (this.objectValid) ? null : {
jsonParseError: {
valid: false,
},
};
}
validateOnSubmit(): void {
if (!this.disabled && !this.readonly) {
this.cleanupJsonErrors();
if (!this.objectValid) {
this.store.dispatch(new ActionNotificationShow(
{
message: this.validationError,
type: 'error',
target: this.toastTargetId,
verticalPosition: 'bottom',
horizontalPosition: 'left'
}));
this.errorShowed = true;
}
}
}
cleanupJsonErrors(): void {
if (this.errorShowed) {
this.store.dispatch(new ActionNotificationHide(
{
target: this.toastTargetId
}));
this.errorShowed = false;
}
}
beautifyJSON() {
2020-07-08 11:55:47 +03:00
if (this.jsonEditor && this.objectValid) {
const res = JSON.stringify(this.modelValue, null, 2);
this.jsonEditor.setValue(res ? res : '', -1);
this.updateView();
}
}
minifyJSON() {
2020-07-08 11:55:47 +03:00
if (this.jsonEditor && this.objectValid) {
const res = JSON.stringify(this.modelValue);
this.jsonEditor.setValue(res ? res : '', -1);
this.updateView();
}
}
2019-08-27 20:07:09 +03:00
writeValue(value: any): void {
this.modelValue = value;
this.contentValue = '';
this.objectValid = false;
try {
2021-04-05 20:56:15 +03:00
if (isDefinedAndNotNull(this.modelValue)) {
2021-01-19 19:36:57 +02:00
this.contentValue = JSON.stringify(this.modelValue, isUndefined(this.sort) ? undefined :
(key, objectValue) => {
return this.sort(key, objectValue);
Develop/lwm2m (#3826) * LwM2M - Start transport * LwM2M - Test endpoint * LwM2M - Test endpoint * LwM2M - Test add xml * LwM2M device registration * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M - add get from client, add attributes and telemetry upgrade from registration client * LwM2M implementation * LwM2M - add to service telemetry and attribute * LwM2M add to service attribute and telemetry * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add LWM2M_CREDENTIALS to DeviceCredentialsType * LwM2M - add transport.process * LwM2M - delete from yml tenantid, PSK -ok * LwM2M - yml del tenantId * LwM2M - add RPK * LwM2M - add connect only x509 certificate. Crate certificates in serverKeyStore.jks and clientKeyStore.jks * LwM2M - add no_sec * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add RPK & PSK integration test with app Client * LwM2M - add read JKS from file * LwM2M - add read JKS from file * LwM2M - add bootstrap cert * LwM2M - add bootstrap RPK * LwM2M - add bootstrap No_sec * LwM2M - cleaned the code * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - add to 3.0 in UI credentials lwm2m * LwM2M - fix bug CoAP transport * LwM2M: UI - add Json to credentials * LwM2M: Back - add command "/3/0/5" - trigger client * LwM2M: fix bug Json edit dialog * LwM2M: fix bug Json edit dialog * lwm2m: fix bug Json edit dialog: add validate * lwm2m: UI add tabs * lwm2m: UI add tabs (cleaner) * lwm2m: add interface SecurityConfigModels * lwm2m: add interface SecurityConfigModels2 * lwm2m: change html * lwm2m: UI add bootstrap component * lwm2m: UI add bootstrap component with FormControl * lwm2m: UI add start Observe * lwm2m: UI - correct * lwm2m: UI - correct * lwm2m: UI - add Validator: BS RPK, X509 * lwm2m: UI - add Observe * lwm2m: UI - finish Observe * lwm2m: UI - fix bug config-service update identity * lwm2m: Bootstarp&Sewrver All config secure * lwm2m: Bootstarp&Sewrver All config secure for new Front format * lwm2m: Bootstarp&Sewrver Different config secure for new Front format * lwm2m: Add attributes Gui and Backend * lwm2m: Add attributes Gui and Backend final * lwm2m: Add telemetrys to Gui * lwm2m: Add Attribute & telemetry in Gui to instance * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry * lwm2m: Optimize Attr/Telemetry for mobile * lwm2m: Model folder * lwm2m: Ok on AWS: NoSec, PSK, X509 bad registration - RPK * lwm2m: KeyStore start only one * lwm2m: Server observe ok * lwm2m: Server fix bug finish session without remove * lwm2m: Server add function installValue * lwm2m: Server add function getAttrTelemetry to tingsboard * lwm2m: Server add function installValue * lwm2m: Server add function update Telemetry, Attr from observe * lwm2m: Server add comments * lwm2m: Server add session listener * lwm2m: Server add onGetChangeCredentials with analyze * lwm2m: Server add onGetChangeCredentials with analyze Onserve add * lwm2m: Server: updated algorithm for analyzing dynamic changes in attributes / telemetry / observation * lwm2m: fix bug: "ngx-flowchart" compile * lwm2m: get value resource OPAQUE - byte [] to HexString * lwm2m: change path to base * lwm2m: fix bug COAP & lwm2m * Lwm2m_3_2: back: cleaner, test bootstrap-ok front: restore * Lwm2m_3_2: back: del SynchronousRegistrationListener.java * Lwm2m_3_2: front: start profile lwm2m UI * Lwm2m_3_2: front&back: add to profile lwm2m (api, getModels...) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (2) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (3) * Lwm2m_3_2: back: fix bug from commented front: add update change observe/attribute/telemetry to config json (4) * Lwm2m_3_2: front: add update change bootstrapConfig and save to config json * Lwm2m_3_2: update after merge master * lwm2m: fix bug proto * lwm2m: fix bug in yml keyStore.jks * lwm2m: fix bug tests * lwm2m: front: add nameThingsboard * lwm2m: fix bug Autowired lwm2mContext, caseCamel * lwm2m: back-end^ start api /lwm2m/deviceProfile/bootstrap * lwm2m: back-end: add method read models from resources * lwm2m: back-end/front: add and finish api bootstrapConfig * lwm2m: back-end: add decode profile * lwm2m: back-end: add new bin in transport api * lwm2m: add microservice lwm2m and docker lwm2m. * lwm2m: add microservice lwm2m and docker lwm2m (fix bug) * lwm2m: front: start fix bug disabled resources * lwm2m: master to lwm2m merge, front add change attribute, telemetry * lwm2m: front PR * lwm2m: front add sort keyName to Json on the start * lwm2m: front add instances * lwm2m: front add/del instances FormGrp Value * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m # Conflicts: # common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java # common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/SessionMsgListener.java # ui-ngx/src/app/modules/home/components/home-components.module.ts * lwm2m: Merge remote-tracking branch 'origin/master' into develop/lwm2m * lwm2m: Front: del sort after add/del instance * lwm2m: Front: fix bug reindex FormArray after update * Lwm2m: Front fix bug add/del instans * Lwm2m: Front finish1 profile * Lwm2m: Back add profile to ModelClient * Lwm2m: Back add form profile sent thingsboard: attr/tel/observe * Lwm2m: Back -> fix bug: serverKeyStore.jks] Unable to load KeyStore files server * Lwm2m: Back -> fix bug: onRegistered an unReg * Lwm2m: Back -> add updateProfiles * Lwm2m: Back -> add updateDevice and updateProfile dynamic * Lwm2m: Back -> error if CoapCode not access * Lwm2m: Front -> clear credential * Lwm2m: Front -> credential fix bug button "save" * Lwm2m: Back -> add telemetry logLwm2m Co-authored-by: nickAS21 <nick@avalr.com.ua>
2020-12-09 17:13:11 +02:00
}, 2);
2019-08-27 20:07:09 +03:00
this.objectValid = true;
} else {
this.objectValid = !this.required;
this.validationError = 'Json object is required.';
2019-08-27 20:07:09 +03:00
}
} catch (e) {
//
}
if (this.jsonEditor) {
2020-09-03 10:04:03 +03:00
this.ignoreChange = true;
2019-08-27 20:07:09 +03:00
this.jsonEditor.setValue(this.contentValue ? this.contentValue : '', -1);
2020-09-03 10:04:03 +03:00
this.ignoreChange = false;
2019-08-27 20:07:09 +03:00
}
}
updateView() {
const editorValue = this.jsonEditor.getValue();
if (this.contentValue !== editorValue) {
this.contentValue = editorValue;
let data = null;
this.objectValid = false;
if (this.contentValue && this.contentValue.length > 0) {
try {
data = JSON.parse(this.contentValue);
2021-04-05 20:56:15 +03:00
if (!isLiteralObject(data)) {
throw new TypeError(`Value is not a valid JSON`);
}
2019-08-27 20:07:09 +03:00
this.objectValid = true;
this.validationError = '';
} catch (ex) {
let errorInfo = 'Error:';
if (ex.name) {
errorInfo += ' ' + ex.name + ':';
}
if (ex.message) {
errorInfo += ' ' + ex.message;
}
this.validationError = errorInfo;
}
2019-08-27 20:07:09 +03:00
} else {
this.objectValid = !this.required;
this.validationError = this.required ? 'Json object is required.' : '';
2019-08-27 20:07:09 +03:00
}
this.modelValue = data;
2019-08-27 20:07:09 +03:00
this.propagateChange(data);
}
}
onFullscreen() {
if (this.jsonEditor) {
setTimeout(() => {
this.jsonEditor.resize();
}, 0);
}
}
}