Browse Source

default config

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

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

@ -140,7 +140,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
}); });
this.connectorForm.get('type').valueChanges.subscribe(type=> { this.connectorForm.get('type').valueChanges.subscribe(type=> {
if(type && this.initialConnector === null) { if(type && !this.initialConnector) {
this.attributeService.getEntityAttributes(this.device, AttributeScope.CLIENT_SCOPE, this.attributeService.getEntityAttributes(this.device, AttributeScope.CLIENT_SCOPE,
[`${type.toUpperCase()}_DEFAULT_CONFIG`], {ignoreErrors: true}).subscribe(defaultConfig=>{ [`${type.toUpperCase()}_DEFAULT_CONFIG`], {ignoreErrors: true}).subscribe(defaultConfig=>{
if (defaultConfig && defaultConfig.length) { if (defaultConfig && defaultConfig.length) {
@ -322,6 +322,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
} }
private clearOutConnectorForm(): void { private clearOutConnectorForm(): void {
this.initialConnector = null;
this.connectorForm.setValue({ this.connectorForm.setValue({
name: '', name: '',
type: 'mqtt', type: 'mqtt',
@ -331,7 +332,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
configuration: '', configuration: '',
configurationJson: {} configurationJson: {}
}); });
this.initialConnector = null;
this.connectorForm.markAsPristine(); this.connectorForm.markAsPristine();
} }

Loading…
Cancel
Save