UI: Fixed device transport configuration enabled/disabled state
This commit is contained in:
parent
dd900dafba
commit
7f555fa747
@ -14,7 +14,7 @@
|
|||||||
/// limitations under the License.
|
/// limitations under the License.
|
||||||
///
|
///
|
||||||
|
|
||||||
import { Component, forwardRef, Input, OnInit } from '@angular/core';
|
import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ControlValueAccessor,
|
ControlValueAccessor,
|
||||||
UntypedFormBuilder,
|
UntypedFormBuilder,
|
||||||
@ -30,6 +30,7 @@ import { AppState } from '@app/core/core.state';
|
|||||||
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||||
import { DeviceTransportConfiguration, DeviceTransportType } from '@shared/models/device.models';
|
import { DeviceTransportConfiguration, DeviceTransportType } from '@shared/models/device.models';
|
||||||
import { deepClone } from '@core/utils';
|
import { deepClone } from '@core/utils';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-device-transport-configuration',
|
selector: 'tb-device-transport-configuration',
|
||||||
@ -104,9 +105,9 @@ export class DeviceTransportConfigurationComponent implements ControlValueAccess
|
|||||||
if (configuration) {
|
if (configuration) {
|
||||||
delete configuration.type;
|
delete configuration.type;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
this.deviceTransportConfigurationFormGroup.patchValue({configuration}, {emitEvent: false});
|
this.deviceTransportConfigurationFormGroup.patchValue({configuration}, {emitEvent: false});
|
||||||
}, 0);
|
// }, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(): ValidationErrors | null {
|
validate(): ValidationErrors | null {
|
||||||
|
|||||||
@ -127,6 +127,9 @@ export class SnmpDeviceTransportConfigurationComponent implements ControlValueAc
|
|||||||
this.snmpDeviceTransportConfigurationFormGroup.disable({emitEvent: false});
|
this.snmpDeviceTransportConfigurationFormGroup.disable({emitEvent: false});
|
||||||
} else {
|
} else {
|
||||||
this.snmpDeviceTransportConfigurationFormGroup.enable({emitEvent: false});
|
this.snmpDeviceTransportConfigurationFormGroup.enable({emitEvent: false});
|
||||||
|
this.updateDisabledFormValue(
|
||||||
|
this.snmpDeviceTransportConfigurationFormGroup.get('protocolVersion').value || SnmpDeviceProtocolVersion.V2C
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user