This is an automated email from the ASF dual-hosted git repository. zehnder pushed a commit to branch STREAMPIPES-145 in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 7e75d05eb235627870c5342169f8bfc57aaca4f8 Author: Philipp Zehnder <[email protected]> AuthorDate: Thu Jul 2 12:57:15 2020 +0200 [STREAMPIPES-145] Fix unit transformation --- .../dialog/edit-event-property/edit-event-property.component.ts | 9 ++++++++- .../unit-transformation/unit-transformation.component.html | 4 ++-- .../dialog/unit-transformation/unit-transformation.component.ts | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.ts b/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.ts index 2d86157..f5bd7e1 100644 --- a/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.ts +++ b/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.ts @@ -75,6 +75,12 @@ export class EditEventPropertyComponent implements OnInit { copyEp(ep: EventPropertyUnion) { if (ep instanceof EventPropertyPrimitive) { const result = EventPropertyPrimitive.fromData(ep as EventPropertyPrimitive, new EventPropertyPrimitive()); + + result.measurementUnit = (ep as EventPropertyPrimitive).measurementUnit; + (result as any).measurementUnitTmp = (ep as any).measurementUnitTmp; + (result as any).oldMeasurementUnit = (ep as any).oldMeasurementUnit; + (result as any).hadMeasarumentUnit = (ep as any).hadMeasarumentUnit; + (result as any).timestampTransformationMode = (ep as any).timestampTransformationMode; (result as any).timestampTransformationFormatString = (ep as any).timestampTransformationFormatString; (result as any).timestampTransformationMultiplier = (ep as any).timestampTransformationMultiplier; @@ -123,7 +129,8 @@ export class EditEventPropertyComponent implements OnInit { if (this.property instanceof EventPropertyPrimitive) { this.property.runtimeType = (this.cachedProperty as EventPropertyPrimitive).runtimeType; - this.property.measurementUnit = (this.cachedProperty as EventPropertyPrimitive).measurementUnit; + + this.property.measurementUnit = (this.cachedProperty as any).oldMeasurementUnit; (this.property as any).measurementUnitTmp = (this.cachedProperty as any).measurementUnitTmp; (this.property as any).oldMeasurementUnit = (this.cachedProperty as any).oldMeasurementUnit; diff --git a/ui/src/app/connect/dialog/unit-transformation/unit-transformation.component.html b/ui/src/app/connect/dialog/unit-transformation/unit-transformation.component.html index 46a559b..ecac425 100644 --- a/ui/src/app/connect/dialog/unit-transformation/unit-transformation.component.html +++ b/ui/src/app/connect/dialog/unit-transformation/unit-transformation.component.html @@ -18,7 +18,7 @@ <div fxLayout="row" fxLayoutAlign="start" *ngIf="showUnitTransformation"> <div class="form-group" fxFlexAlign="center" style="width: 155px"> - <mat-form-field *ngIf="!hadMeasarumentUnit" class="example-full-width" style="width: 155px"> + <mat-form-field *ngIf="!hadMeasurementUnit" class="example-full-width" style="width: 155px"> <input matInput placeholder="Unit" [matAutocomplete]="auto" [formControl]="stateCtrl" [attr.disabled]="transformUnitEnable ? '' : null"> <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn"> @@ -27,7 +27,7 @@ </mat-option> </mat-autocomplete> </mat-form-field> - <mat-form-field *ngIf="hadMeasarumentUnit" class="example-full-width" style="width: 155px"> + <mat-form-field *ngIf="hadMeasurementUnit" class="example-full-width" style="width: 155px"> <input matInput placeholder="Unit" disabled [(ngModel)]="oldMeasurementUnitDipsplay"> </mat-form-field> diff --git a/ui/src/app/connect/dialog/unit-transformation/unit-transformation.component.ts b/ui/src/app/connect/dialog/unit-transformation/unit-transformation.component.ts index b8cf3c9..8887459 100644 --- a/ui/src/app/connect/dialog/unit-transformation/unit-transformation.component.ts +++ b/ui/src/app/connect/dialog/unit-transformation/unit-transformation.component.ts @@ -42,7 +42,7 @@ export class UnitTransformationComponent implements OnInit { private newUnitStateCtrl = new FormControl(); private filteredUnits: Observable<UnitDescription[]>; - private hadMesarumentUnit = false; + public hadMeasurementUnit = false; private oldMeasurementUnitDipsplay; constructor(private formBuilder: FormBuilder, @@ -66,7 +66,7 @@ export class UnitTransformationComponent implements OnInit { (this.cachedProperty as any).oldMeasurementUnit = (this.cachedProperty as any).oldMeasurementUnit; // TODO: use if backend deserialize URI correct (this.cachedProperty as any).measurementUnitTmp = (this.cachedProperty as any).measurementUnitTmp; - this.hadMesarumentUnit = (this.cachedProperty as any).hadMeasarumentUnit; + this.hadMeasurementUnit = (this.cachedProperty as any).hadMeasarumentUnit; this.transformUnitEnable = (this.cachedProperty as any).hadMeasarumentUnit; const unit = this.allUnits.find(unitTmp => unitTmp.resource === (this.cachedProperty as any).oldMeasurementUnit); this.oldMeasurementUnitDipsplay = unit.label; @@ -76,7 +76,7 @@ export class UnitTransformationComponent implements OnInit { this.possibleUnitTransformations = result; // this.selectUnit = this.possibleUnitTransformations[0]; this.selectUnit = this.allUnits.find(unitTmp => unitTmp.resource === (this.cachedProperty as any).measurementUnitTmp); - this.transformUnitEnable = true; + // this.transformUnitEnable = true; this.changeTargetUnit(this.selectUnit); }); }
