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 | 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 | 18 | import { |
19 | 19 | ControlValueAccessor, |
20 | 20 | FormBuilder, |
... | ... | @@ -25,13 +25,13 @@ import { |
25 | 25 | ValidationErrors, |
26 | 26 | Validator, |
27 | 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 | 30 | import { |
31 | 31 | DeviceProvisionConfiguration, |
32 | 32 | DeviceProvisionType, |
33 | 33 | deviceProvisionTypeTranslationMap |
34 | -} from "@shared/models/device.models"; | |
34 | +} from '@shared/models/device.models'; | |
35 | 35 | import { generateSecret, isDefinedAndNotNull } from '@core/utils'; |
36 | 36 | |
37 | 37 | @Component({ |
... | ... | @@ -126,7 +126,11 @@ export class DeviceProfileProvisionConfigurationComponent implements ControlValu |
126 | 126 | if (this.disabled){ |
127 | 127 | this.provisionConfigurationFormGroup.disable(); |
128 | 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 | 94 | name: [entity ? entity.name : '', [Validators.required]], |
95 | 95 | type: [entity ? entity.type : null, [Validators.required]], |
96 | 96 | transportType: [entity ? entity.transportType : null, [Validators.required]], |
97 | - provisionType: [deviceProvisionConfiguration.type, [Validators.required]], | |
98 | - provisionDeviceKey: [deviceProvisionConfiguration.provisionDeviceKey], | |
99 | 97 | profileData: this.fb.group({ |
100 | 98 | configuration: [entity && !this.isAdd ? entity.profileData?.configuration : {}, Validators.required], |
101 | 99 | transportConfiguration: [entity && !this.isAdd ? entity.profileData?.transportConfiguration : {}, Validators.required], | ... | ... |