Browse Source

Device Profile provision X.509 strategy update: save certificateValue as provisionDeviceSecret

pull/7935/head
deaflynx 4 years ago
parent
commit
bf3346d1ec
  1. 10
      ui-ngx/src/app/modules/home/components/profile/device-profile-provision-configuration.component.ts
  2. 2
      ui-ngx/src/app/modules/home/components/profile/device-profile.component.ts

10
ui-ngx/src/app/modules/home/components/profile/device-profile-provision-configuration.component.ts

@ -62,7 +62,6 @@ export class DeviceProfileProvisionConfigurationComponent implements ControlValu
deviceProvisionType = DeviceProvisionType;
deviceProvisionTypes = Object.keys(DeviceProvisionType);
deviceProvisionTypeTranslateMap = deviceProvisionTypeTranslationMap;
readMore: boolean;
private requiredValue: boolean;
get required(): boolean {
@ -143,16 +142,16 @@ export class DeviceProfileProvisionConfigurationComponent implements ControlValu
}
writeValue(value: DeviceProvisionConfiguration | null): void {
if (isDefinedAndNotNull(value)){
if (isDefinedAndNotNull(value)) {
this.provisionConfigurationFormGroup.patchValue(value, {emitEvent: false});
} else {
this.provisionConfigurationFormGroup.patchValue({type: DeviceProvisionType.DISABLED});
}
}
setDisabledState(isDisabled: boolean){
setDisabledState(isDisabled: boolean) {
this.disabled = isDisabled;
if (this.disabled){
if (this.disabled) {
this.provisionConfigurationFormGroup.disable({emitEvent: false});
} else {
if (this.provisionConfigurationFormGroup.get('type').value !== DeviceProvisionType.DISABLED) {
@ -176,6 +175,9 @@ export class DeviceProfileProvisionConfigurationComponent implements ControlValu
this.resetFormControls(this.provisionConfigurationFormGroup.value);
if (this.provisionConfigurationFormGroup.valid) {
deviceProvisionConfiguration = this.provisionConfigurationFormGroup.getRawValue();
if (deviceProvisionConfiguration.type === DeviceProvisionType.X509_CERTIFICATE_CHAIN) {
deviceProvisionConfiguration.provisionDeviceSecret = deviceProvisionConfiguration.certificateValue;
}
}
this.propagateChange(deviceProvisionConfiguration);
}

2
ui-ngx/src/app/modules/home/components/profile/device-profile.component.ts

@ -105,7 +105,6 @@ export class DeviceProfileComponent extends EntityComponent<DeviceProfile> {
type: entity?.provisionType ? entity.provisionType : DeviceProvisionType.DISABLED,
provisionDeviceKey: entity?.provisionDeviceKey,
provisionDeviceSecret: entity?.profileData?.provisionConfiguration?.provisionDeviceSecret,
certificateValue: entity?.profileData?.provisionConfiguration?.certificateValue,
certificateRegExPattern: entity?.profileData?.provisionConfiguration?.certificateRegExPattern,
allowCreateNewDevicesByX509Certificate: entity?.profileData?.provisionConfiguration?.allowCreateNewDevicesByX509Certificate
};
@ -189,7 +188,6 @@ export class DeviceProfileComponent extends EntityComponent<DeviceProfile> {
type: entity?.provisionType ? entity.provisionType : DeviceProvisionType.DISABLED,
provisionDeviceKey: entity?.provisionDeviceKey,
provisionDeviceSecret: entity?.profileData?.provisionConfiguration?.provisionDeviceSecret,
certificateValue: entity?.profileData?.provisionConfiguration?.certificateValue,
certificateRegExPattern: entity?.profileData?.provisionConfiguration?.certificateRegExPattern,
allowCreateNewDevicesByX509Certificate: entity?.profileData?.provisionConfiguration?.allowCreateNewDevicesByX509Certificate
};

Loading…
Cancel
Save