Browse Source

refactoring

pull/11185/head
mpetrov 2 years ago
parent
commit
78136e2734
  1. 31
      ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts

31
ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts

@ -406,20 +406,21 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, OnDestroy, C
} }
private observeMQTTWithResponse(): void { private observeMQTTWithResponse(): void {
this.commandForm.get('withResponse').valueChanges.pipe( if (this.connectorType === ConnectorType.MQTT) {
filter(() => this.connectorType === ConnectorType.MQTT), this.commandForm.get('withResponse').valueChanges.pipe(
tap((isActive: boolean) => { tap((isActive: boolean) => {
const responseTopicControl = this.commandForm.get('responseTopicExpression'); const responseTopicControl = this.commandForm.get('responseTopicExpression');
const responseTimeoutControl = this.commandForm.get('responseTimeout'); const responseTimeoutControl = this.commandForm.get('responseTimeout');
if (isActive) { if (isActive) {
responseTopicControl.enable(); responseTopicControl.enable();
responseTimeoutControl.enable(); responseTimeoutControl.enable();
} else { } else {
responseTopicControl.disable(); responseTopicControl.disable();
responseTimeoutControl.disable(); responseTimeoutControl.disable();
} }
}), }),
takeUntil(this.destroy$), takeUntil(this.destroy$),
).subscribe(); ).subscribe();
}
} }
} }

Loading…
Cancel
Save