Commit 390bbfd67f91b7792aa3d5ed16a06d3ba60bd321
1 parent
ff4ca5a7
UI: Fixed disabled form in edit device-profile
Showing
2 changed files
with
9 additions
and
7 deletions
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | /// limitations under the License. | 14 | /// limitations under the License. |
15 | /// | 15 | /// |
16 | 16 | ||
17 | -import { Component, forwardRef, Input, OnInit } from "@angular/core"; | 17 | +import { Component, forwardRef, Input, OnInit } from '@angular/core'; |
18 | import { | 18 | import { |
19 | ControlValueAccessor, | 19 | ControlValueAccessor, |
20 | FormBuilder, | 20 | FormBuilder, |
@@ -25,13 +25,13 @@ import { | @@ -25,13 +25,13 @@ import { | ||
25 | ValidationErrors, | 25 | ValidationErrors, |
26 | Validator, | 26 | Validator, |
27 | Validators | 27 | Validators |
28 | -} from "@angular/forms"; | ||
29 | -import { coerceBooleanProperty } from "@angular/cdk/coercion"; | 28 | +} from '@angular/forms'; |
29 | +import { coerceBooleanProperty } from '@angular/cdk/coercion'; | ||
30 | import { | 30 | import { |
31 | DeviceProvisionConfiguration, | 31 | DeviceProvisionConfiguration, |
32 | DeviceProvisionType, | 32 | DeviceProvisionType, |
33 | deviceProvisionTypeTranslationMap | 33 | deviceProvisionTypeTranslationMap |
34 | -} from "@shared/models/device.models"; | 34 | +} from '@shared/models/device.models'; |
35 | import { generateSecret, isDefinedAndNotNull } from '@core/utils'; | 35 | import { generateSecret, isDefinedAndNotNull } from '@core/utils'; |
36 | 36 | ||
37 | @Component({ | 37 | @Component({ |
@@ -126,7 +126,11 @@ export class DeviceProfileProvisionConfigurationComponent implements ControlValu | @@ -126,7 +126,11 @@ export class DeviceProfileProvisionConfigurationComponent implements ControlValu | ||
126 | if (this.disabled){ | 126 | if (this.disabled){ |
127 | this.provisionConfigurationFormGroup.disable(); | 127 | this.provisionConfigurationFormGroup.disable(); |
128 | } else { | 128 | } else { |
129 | - this.provisionConfigurationFormGroup.enable({emitEvent: false}); | 129 | + if (this.provisionConfigurationFormGroup.get('type').value !== DeviceProvisionType.DISABLED) { |
130 | + this.provisionConfigurationFormGroup.enable({emitEvent: false}); | ||
131 | + } else { | ||
132 | + this.provisionConfigurationFormGroup.get('type').enable({emitEvent: false}); | ||
133 | + } | ||
130 | } | 134 | } |
131 | } | 135 | } |
132 | 136 |
@@ -94,8 +94,6 @@ export class DeviceProfileComponent extends EntityComponent<DeviceProfile> { | @@ -94,8 +94,6 @@ export class DeviceProfileComponent extends EntityComponent<DeviceProfile> { | ||
94 | name: [entity ? entity.name : '', [Validators.required]], | 94 | name: [entity ? entity.name : '', [Validators.required]], |
95 | type: [entity ? entity.type : null, [Validators.required]], | 95 | type: [entity ? entity.type : null, [Validators.required]], |
96 | transportType: [entity ? entity.transportType : null, [Validators.required]], | 96 | transportType: [entity ? entity.transportType : null, [Validators.required]], |
97 | - provisionType: [deviceProvisionConfiguration.type, [Validators.required]], | ||
98 | - provisionDeviceKey: [deviceProvisionConfiguration.provisionDeviceKey], | ||
99 | profileData: this.fb.group({ | 97 | profileData: this.fb.group({ |
100 | configuration: [entity && !this.isAdd ? entity.profileData?.configuration : {}, Validators.required], | 98 | configuration: [entity && !this.isAdd ? entity.profileData?.configuration : {}, Validators.required], |
101 | transportConfiguration: [entity && !this.isAdd ? entity.profileData?.transportConfiguration : {}, Validators.required], | 99 | transportConfiguration: [entity && !this.isAdd ? entity.profileData?.transportConfiguration : {}, Validators.required], |