Loading src/app/p_services/admin/catalogManagement/edit-service-specs/edit-service-spec-characteristics/edit-service-spec-characteristics.component.ts +19 −3 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ export class EditServiceSpecCharacteristicsComponent implements OnInit { updateFormArrayItem(CharValue: ServiceSpecCharacteristicValue): UntypedFormGroup { const rangeInterval = CharValue.valueFrom != null || CharValue.valueTo != null ? "closed" : null return new UntypedFormGroup({ value: new UntypedFormGroup({ alias: new UntypedFormControl(CharValue.value.alias), Loading @@ -127,7 +128,10 @@ export class EditServiceSpecCharacteristicsComponent implements OnInit { }), unitOfMeasure: new UntypedFormControl(CharValue.unitOfMeasure), isDefault: new UntypedFormControl({value: (CharValue.isDefault || this.data.specToBeUpdated.valueType === 'ARRAY'), disabled: this.data.specToBeUpdated.valueType === 'ARRAY'}), valueType: new UntypedFormControl(CharValue.valueType) valueType: new UntypedFormControl(CharValue.valueType), valueFrom: new UntypedFormControl(CharValue.valueFrom), valueTo: new UntypedFormControl(CharValue.valueTo), rangeInterval: new UntypedFormControl(rangeInterval) }) } Loading @@ -151,9 +155,13 @@ export class EditServiceSpecCharacteristicsComponent implements OnInit { }), unitOfMeasure: new UntypedFormControl(), isDefault: new UntypedFormControl({value: this.editFormCharacteristic.get('valueType').value === 'ARRAY', disabled: this.editFormCharacteristic.get('valueType').value === 'ARRAY'}), valueType: new UntypedFormControl(subType) valueType: new UntypedFormControl(subType), valueFrom: new UntypedFormControl(), valueTo: new UntypedFormControl(), rangeInterval: new UntypedFormControl() }) ) this.isCharValueBlockExpanded.push(false) } Loading Loading @@ -184,7 +192,15 @@ export class EditServiceSpecCharacteristicsComponent implements OnInit { submitDialog() { if (this.newSpec) { this.data.serviceSpec.serviceSpecCharacteristic.push(this.editFormCharacteristic.getRawValue()) const specChar = this.editFormCharacteristic.getRawValue(); // rangeInterval defaults to closed for INTEGER characteristics in order to be validated by the API. // Without this code rangeInterval would be null and therefore no validation would be done. specChar.serviceSpecCharacteristicValue.forEach(value => { if (value.valueFrom != null || value.valueTo != null) { value.rangeInterval = 'closed'; } }); this.data.serviceSpec.serviceSpecCharacteristic.push(specChar); } else { const updateCharacteristIndex = this.data.serviceSpec.serviceSpecCharacteristic.findIndex(char => char.id === this.data.specToBeUpdated.id) this.data.serviceSpec.serviceSpecCharacteristic[updateCharacteristIndex] = this.editFormCharacteristic.getRawValue() Loading Loading
src/app/p_services/admin/catalogManagement/edit-service-specs/edit-service-spec-characteristics/edit-service-spec-characteristics.component.ts +19 −3 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ export class EditServiceSpecCharacteristicsComponent implements OnInit { updateFormArrayItem(CharValue: ServiceSpecCharacteristicValue): UntypedFormGroup { const rangeInterval = CharValue.valueFrom != null || CharValue.valueTo != null ? "closed" : null return new UntypedFormGroup({ value: new UntypedFormGroup({ alias: new UntypedFormControl(CharValue.value.alias), Loading @@ -127,7 +128,10 @@ export class EditServiceSpecCharacteristicsComponent implements OnInit { }), unitOfMeasure: new UntypedFormControl(CharValue.unitOfMeasure), isDefault: new UntypedFormControl({value: (CharValue.isDefault || this.data.specToBeUpdated.valueType === 'ARRAY'), disabled: this.data.specToBeUpdated.valueType === 'ARRAY'}), valueType: new UntypedFormControl(CharValue.valueType) valueType: new UntypedFormControl(CharValue.valueType), valueFrom: new UntypedFormControl(CharValue.valueFrom), valueTo: new UntypedFormControl(CharValue.valueTo), rangeInterval: new UntypedFormControl(rangeInterval) }) } Loading @@ -151,9 +155,13 @@ export class EditServiceSpecCharacteristicsComponent implements OnInit { }), unitOfMeasure: new UntypedFormControl(), isDefault: new UntypedFormControl({value: this.editFormCharacteristic.get('valueType').value === 'ARRAY', disabled: this.editFormCharacteristic.get('valueType').value === 'ARRAY'}), valueType: new UntypedFormControl(subType) valueType: new UntypedFormControl(subType), valueFrom: new UntypedFormControl(), valueTo: new UntypedFormControl(), rangeInterval: new UntypedFormControl() }) ) this.isCharValueBlockExpanded.push(false) } Loading Loading @@ -184,7 +192,15 @@ export class EditServiceSpecCharacteristicsComponent implements OnInit { submitDialog() { if (this.newSpec) { this.data.serviceSpec.serviceSpecCharacteristic.push(this.editFormCharacteristic.getRawValue()) const specChar = this.editFormCharacteristic.getRawValue(); // rangeInterval defaults to closed for INTEGER characteristics in order to be validated by the API. // Without this code rangeInterval would be null and therefore no validation would be done. specChar.serviceSpecCharacteristicValue.forEach(value => { if (value.valueFrom != null || value.valueTo != null) { value.rangeInterval = 'closed'; } }); this.data.serviceSpec.serviceSpecCharacteristic.push(specChar); } else { const updateCharacteristIndex = this.data.serviceSpec.serviceSpecCharacteristic.findIndex(char => char.id === this.data.specToBeUpdated.id) this.data.serviceSpec.serviceSpecCharacteristic[updateCharacteristIndex] = this.editFormCharacteristic.getRawValue() Loading