Browse Source

default config

pull/9637/head
dudnikmaksim 3 years ago
parent
commit
c598b4fa9d
  1. 15
      ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts

15
ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts

@ -139,6 +139,21 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
this.cd.detectChanges();
});
this.connectorForm.get('type').valueChanges.subscribe(type=> {
if(type && this.initialConnector === null) {
this.attributeService.getEntityAttributes(this.device, AttributeScope.CLIENT_SCOPE,
[`${type.toUpperCase()}_DEFAULT_CONFIG`], {ignoreErrors: true}).subscribe(defaultConfig=>{
if (defaultConfig && defaultConfig.length) {
this.connectorForm.get('configurationJson').setValue(
isString(defaultConfig[0].value) ?
JSON.parse(defaultConfig[0].value) :
defaultConfig[0].value);
this.cd.detectChanges();
}
})
}
});
this.dataSource.sort = this.sort;
this.dataSource.sortingDataAccessor = (data: AttributeData, sortHeaderId: string) => {
if (sortHeaderId === 'syncStatus') {

Loading…
Cancel
Save