Browse Source
Merge pull request #3580 from vvlladd28/improvement/device-profile-provision
UI: Fixed disabled form in edit device-profile
pull/3583/head
Igor Kulikov
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
9 additions and
7 deletions
-
ui-ngx/src/app/modules/home/components/profile/device-profile-provision-configuration.component.ts
-
ui-ngx/src/app/modules/home/components/profile/device-profile.component.ts
|
|
|
@ -14,7 +14,7 @@ |
|
|
|
/// limitations under the License.
|
|
|
|
///
|
|
|
|
|
|
|
|
import { Component, forwardRef, Input, OnInit } from "@angular/core"; |
|
|
|
import { Component, forwardRef, Input, OnInit } from '@angular/core'; |
|
|
|
import { |
|
|
|
ControlValueAccessor, |
|
|
|
FormBuilder, |
|
|
|
@ -25,13 +25,13 @@ import { |
|
|
|
ValidationErrors, |
|
|
|
Validator, |
|
|
|
Validators |
|
|
|
} from "@angular/forms"; |
|
|
|
import { coerceBooleanProperty } from "@angular/cdk/coercion"; |
|
|
|
} from '@angular/forms'; |
|
|
|
import { coerceBooleanProperty } from '@angular/cdk/coercion'; |
|
|
|
import { |
|
|
|
DeviceProvisionConfiguration, |
|
|
|
DeviceProvisionType, |
|
|
|
deviceProvisionTypeTranslationMap |
|
|
|
} from "@shared/models/device.models"; |
|
|
|
} from '@shared/models/device.models'; |
|
|
|
import { generateSecret, isDefinedAndNotNull } from '@core/utils'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
@ -126,7 +126,11 @@ export class DeviceProfileProvisionConfigurationComponent implements ControlValu |
|
|
|
if (this.disabled){ |
|
|
|
this.provisionConfigurationFormGroup.disable(); |
|
|
|
} else { |
|
|
|
this.provisionConfigurationFormGroup.enable({emitEvent: false}); |
|
|
|
if (this.provisionConfigurationFormGroup.get('type').value !== DeviceProvisionType.DISABLED) { |
|
|
|
this.provisionConfigurationFormGroup.enable({emitEvent: false}); |
|
|
|
} else { |
|
|
|
this.provisionConfigurationFormGroup.get('type').enable({emitEvent: false}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -94,8 +94,6 @@ export class DeviceProfileComponent extends EntityComponent<DeviceProfile> { |
|
|
|
name: [entity ? entity.name : '', [Validators.required]], |
|
|
|
type: [entity ? entity.type : null, [Validators.required]], |
|
|
|
transportType: [entity ? entity.transportType : null, [Validators.required]], |
|
|
|
provisionType: [deviceProvisionConfiguration.type, [Validators.required]], |
|
|
|
provisionDeviceKey: [deviceProvisionConfiguration.provisionDeviceKey], |
|
|
|
profileData: this.fb.group({ |
|
|
|
configuration: [entity && !this.isAdd ? entity.profileData?.configuration : {}, Validators.required], |
|
|
|
transportConfiguration: [entity && !this.isAdd ? entity.profileData?.transportConfiguration : {}, Validators.required], |
|
|
|
|