|
|
|
@ -29,7 +29,6 @@ import { |
|
|
|
DeviceProvisionConfiguration, |
|
|
|
DeviceProvisionType, |
|
|
|
DeviceTransportType, |
|
|
|
deviceTransportTypeConfigurationInfoMap, |
|
|
|
deviceTransportTypeHintMap, |
|
|
|
deviceTransportTypeTranslationMap |
|
|
|
} from '@shared/models/device.models'; |
|
|
|
@ -66,7 +65,6 @@ export class DeviceWizardDialogComponent extends |
|
|
|
showNext = true; |
|
|
|
|
|
|
|
createProfile = false; |
|
|
|
createTransportConfiguration = false; |
|
|
|
|
|
|
|
entityType = EntityType; |
|
|
|
|
|
|
|
@ -88,7 +86,7 @@ export class DeviceWizardDialogComponent extends |
|
|
|
|
|
|
|
customerFormGroup: FormGroup; |
|
|
|
|
|
|
|
labelPosition = 'end'; |
|
|
|
labelPosition: MatHorizontalStepper['labelPosition'] = 'end'; |
|
|
|
|
|
|
|
serviceType = ServiceType.TB_RULE_ENGINE; |
|
|
|
|
|
|
|
@ -109,7 +107,6 @@ export class DeviceWizardDialogComponent extends |
|
|
|
label: [''], |
|
|
|
gateway: [false], |
|
|
|
overwriteActivityTime: [false], |
|
|
|
transportType: [DeviceTransportType.DEFAULT, Validators.required], |
|
|
|
addProfileType: [0], |
|
|
|
deviceProfileId: [null, Validators.required], |
|
|
|
newDeviceProfileTitle: [{value: null, disabled: true}], |
|
|
|
@ -130,7 +127,6 @@ export class DeviceWizardDialogComponent extends |
|
|
|
this.deviceWizardFormGroup.get('defaultQueueName').disable(); |
|
|
|
this.deviceWizardFormGroup.updateValueAndValidity(); |
|
|
|
this.createProfile = false; |
|
|
|
this.createTransportConfiguration = false; |
|
|
|
} else { |
|
|
|
this.deviceWizardFormGroup.get('deviceProfileId').setValidators(null); |
|
|
|
this.deviceWizardFormGroup.get('deviceProfileId').disable(); |
|
|
|
@ -141,18 +137,18 @@ export class DeviceWizardDialogComponent extends |
|
|
|
|
|
|
|
this.deviceWizardFormGroup.updateValueAndValidity(); |
|
|
|
this.createProfile = true; |
|
|
|
this.createTransportConfiguration = this.deviceWizardFormGroup.get('transportType').value && |
|
|
|
deviceTransportTypeConfigurationInfoMap.get(this.deviceWizardFormGroup.get('transportType').value).hasProfileConfiguration; |
|
|
|
} |
|
|
|
} |
|
|
|
)); |
|
|
|
|
|
|
|
this.transportConfigFormGroup = this.fb.group( |
|
|
|
{ |
|
|
|
transportType: [DeviceTransportType.DEFAULT, Validators.required], |
|
|
|
transportConfiguration: [createDeviceProfileTransportConfiguration(DeviceTransportType.DEFAULT), Validators.required] |
|
|
|
} |
|
|
|
); |
|
|
|
this.subscriptions.push(this.deviceWizardFormGroup.get('transportType').valueChanges.subscribe((transportType) => { |
|
|
|
|
|
|
|
this.subscriptions.push(this.transportConfigFormGroup.get('transportType').valueChanges.subscribe((transportType) => { |
|
|
|
this.deviceProfileTransportTypeChanged(transportType); |
|
|
|
})); |
|
|
|
|
|
|
|
@ -229,8 +225,6 @@ export class DeviceWizardDialogComponent extends |
|
|
|
if (index > 0) { |
|
|
|
if (!this.createProfile) { |
|
|
|
index += 3; |
|
|
|
} else if (!this.createTransportConfiguration) { |
|
|
|
index += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
switch (index) { |
|
|
|
@ -256,8 +250,6 @@ export class DeviceWizardDialogComponent extends |
|
|
|
private deviceProfileTransportTypeChanged(deviceTransportType: DeviceTransportType): void { |
|
|
|
this.transportConfigFormGroup.patchValue( |
|
|
|
{transportConfiguration: createDeviceProfileTransportConfiguration(deviceTransportType)}); |
|
|
|
this.createTransportConfiguration = this.createProfile && deviceTransportType && |
|
|
|
deviceTransportTypeConfigurationInfoMap.get(deviceTransportType).hasProfileConfiguration; |
|
|
|
} |
|
|
|
|
|
|
|
add(): void { |
|
|
|
@ -281,7 +273,7 @@ export class DeviceWizardDialogComponent extends |
|
|
|
const deviceProfile: DeviceProfile = { |
|
|
|
name: this.deviceWizardFormGroup.get('newDeviceProfileTitle').value, |
|
|
|
type: DeviceProfileType.DEFAULT, |
|
|
|
transportType: this.deviceWizardFormGroup.get('transportType').value, |
|
|
|
transportType: this.transportConfigFormGroup.get('transportType').value, |
|
|
|
provisionType: deviceProvisionConfiguration.type, |
|
|
|
provisionDeviceKey, |
|
|
|
profileData: { |
|
|
|
|