You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@streampipes.apache.org by GitBox <gi...@apache.org> on 2023/01/08 18:05:34 UTC

[GitHub] [streampipes] tenthe commented on a diff in pull request #1057: [#877] Apply UI linting to connect module

tenthe commented on code in PR #1057:
URL: https://github.com/apache/streampipes/pull/1057#discussion_r1064181687


##########
ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.ts:
##########
@@ -33,159 +44,215 @@ import { EditValueTransformationComponent } from './components/edit-value-transf
 import { EditUnitTransformationComponent } from './components/edit-unit-transformation/edit-unit-transformation.component';
 
 @Component({
-  selector: 'sp-edit-event-property',
-  templateUrl: './edit-event-property.component.html',
-  styleUrls: ['./edit-event-property.component.scss']
+    selector: 'sp-edit-event-property',
+    templateUrl: './edit-event-property.component.html',
+    styleUrls: ['./edit-event-property.component.scss'],
 })
 export class EditEventPropertyComponent implements OnInit {
-
-  @Input() property: EventPropertyUnion;
-  @Input() isEditable: boolean;
-
-  @Output() propertyChange = new EventEmitter<EventPropertyUnion>();
-
-  schemaTransformationComponent: EditSchemaTransformationComponent;
-  valueTransformationComponent: EditValueTransformationComponent;
-  unitTransformationComponent: EditUnitTransformationComponent;
-
-  cachedProperty: any;
-
-  isTimestampProperty = false;
-  isEventPropertyPrimitive: boolean;
-  isEventPropertyNested: boolean;
-  isEventPropertyList: boolean;
-  isNumericProperty: boolean;
-  isSaveBtnEnabled: boolean;
-
-  private propertyForm: UntypedFormGroup;
-
-  private runtimeDataTypes;
-
-  constructor(public dialogRef: DialogRef<EditEventPropertyComponent>,
-              private formBuilder: UntypedFormBuilder,
-              private dataTypeService: DataTypesService,
-              private semanticTypeUtilsService: SemanticTypeUtilsService,
-              private semanticTypesService: SemanticTypesService) {
-  }
-
-  ngOnInit(): void {
-    this.cachedProperty = this.copyEp(this.property);
-    this.runtimeDataTypes = this.dataTypeService.getDataTypes();
-    this.isTimestampProperty = this.semanticTypeUtilsService.isTimestamp(this.cachedProperty);
-    this.isEventPropertyList = this.property instanceof EventPropertyList;
-    this.isEventPropertyPrimitive = this.property instanceof EventPropertyPrimitive;
-    this.isEventPropertyNested = this.property instanceof EventPropertyNested;
-    this.isNumericProperty = this.semanticTypeUtilsService.isNumeric(this.cachedProperty) ||
-      this.dataTypeService.isNumeric(this.cachedProperty.runtimeType);
-    this.createForm();
-
-  }
-
-  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;
-
-      (result as any).staticValue = (ep as any).staticValue;
-
-      (result as any).correctionValue = (ep as any).correctionValue;
-      (result as any).operator = (ep as any).operator;
-
-      return result;
-    } else if (ep instanceof EventPropertyNested) {
-      return EventPropertyNested.fromData(ep as EventPropertyNested, new EventPropertyNested());
-    } else {
-      return EventPropertyList.fromData(ep as EventPropertyList, new EventPropertyList());
-    }
-  }
-
-  private createForm() {
-    this.propertyForm = this.formBuilder.group({
-      label: [this.property.label, Validators.required],
-      runtimeName: [this.property.runtimeName, Validators.required],
-      description: [this.property.description, Validators.required],
-      domainProperty: ['', Validators.required],
-      dataType: ['', Validators.required]
-    });
-  }
-
-  staticValueAddedByUser() {
-    return (this.property.elementId.startsWith('http://eventProperty.de/staticValue/'));
-  }
-
-  save(): void {
-    this.property.label = this.cachedProperty.label;
-    this.property.description = this.cachedProperty.description;
-
-    // remove undefined from domain properies array
-    this.property.domainProperties = this.cachedProperty.domainProperties.filter(n => n);
-    this.property.runtimeName = this.cachedProperty.runtimeName;
-    this.property.propertyScope = this.cachedProperty.propertyScope;
-
-    if (this.property instanceof EventPropertyList) {
-      // @ts-ignore
-      this.property.eventProperty.runtimeType = (this.cachedProperty as EventPropertyList).eventProperty.runtimeType;
+    @Input() property: EventPropertyUnion;
+    @Input() isEditable: boolean;
+
+    @Output() propertyChange = new EventEmitter<EventPropertyUnion>();
+
+    schemaTransformationComponent: EditSchemaTransformationComponent;
+    valueTransformationComponent: EditValueTransformationComponent;
+    unitTransformationComponent: EditUnitTransformationComponent;
+
+    cachedProperty: any;
+
+    isTimestampProperty = false;
+    isEventPropertyPrimitive: boolean;
+    isEventPropertyNested: boolean;
+    isEventPropertyList: boolean;
+    isNumericProperty: boolean;
+    isSaveBtnEnabled: boolean;
+
+    private propertyForm: UntypedFormGroup;
+
+    private runtimeDataTypes;
+
+    constructor(
+        public dialogRef: DialogRef<EditEventPropertyComponent>,
+        private formBuilder: UntypedFormBuilder,
+        private dataTypeService: DataTypesService,
+        private semanticTypeUtilsService: SemanticTypeUtilsService,
+        private semanticTypesService: SemanticTypesService,
+    ) {}
+
+    ngOnInit(): void {
+        this.cachedProperty = this.copyEp(this.property);
+        this.runtimeDataTypes = this.dataTypeService.getDataTypes();
+        this.isTimestampProperty = this.semanticTypeUtilsService.isTimestamp(
+            this.cachedProperty,
+        );
+        this.isEventPropertyList = this.property instanceof EventPropertyList;
+        this.isEventPropertyPrimitive =
+            this.property instanceof EventPropertyPrimitive;
+        this.isEventPropertyNested =
+            this.property instanceof EventPropertyNested;
+        this.isNumericProperty =
+            this.semanticTypeUtilsService.isNumeric(this.cachedProperty) ||
+            this.dataTypeService.isNumeric(this.cachedProperty.runtimeType);
+        this.createForm();
     }
 
-    if (this.property instanceof EventPropertyPrimitive) {
-      this.property.runtimeType = (this.cachedProperty as EventPropertyPrimitive).runtimeType;
-
-      this.property.measurementUnit = (this.cachedProperty as any).oldMeasurementUnit;
+    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;
+
+            (result as any).staticValue = (ep as any).staticValue;
+
+            (result as any).correctionValue = (ep as any).correctionValue;
+            (result as any).operator = (ep as any).operator;
+
+            return result;
+        } else if (ep instanceof EventPropertyNested) {
+            return EventPropertyNested.fromData(
+                ep as EventPropertyNested,
+                new EventPropertyNested(),
+            );
+        } else {
+            return EventPropertyList.fromData(
+                ep as EventPropertyList,
+                new EventPropertyList(),
+            );
+        }
+    }
 
-      (this.property as any).measurementUnitTmp = (this.cachedProperty as any).measurementUnitTmp;
-      (this.property as any).oldMeasurementUnit = (this.cachedProperty as any).oldMeasurementUnit;
-      (this.property as any).hadMeasarumentUnit = (this.cachedProperty as any).hadMeasarumentUnit;
+    private createForm() {
+        this.propertyForm = this.formBuilder.group({
+            label: [this.property.label, Validators.required],
+            runtimeName: [this.property.runtimeName, Validators.required],
+            description: [this.property.description, Validators.required],
+            domainProperty: ['', Validators.required],
+            dataType: ['', Validators.required],
+        });
+    }
 
-      (this.property as any).timestampTransformationMode = (this.cachedProperty as any).timestampTransformationMode;
-      (this.property as any).timestampTransformationFormatString = (this.cachedProperty as any).timestampTransformationFormatString;
-      (this.property as any).timestampTransformationMultiplier = (this.cachedProperty as any).timestampTransformationMultiplier;
+    staticValueAddedByUser() {
+        return this.property.elementId.startsWith(
+            'http://eventProperty.de/staticValue/',
+        );
+    }
 
-      (this.property as any).staticValue = (this.cachedProperty as any).staticValue;
+    save(): void {
+        this.property.label = this.cachedProperty.label;
+        this.property.description = this.cachedProperty.description;
+
+        // remove undefined from domain properies array
+        this.property.domainProperties =
+            this.cachedProperty.domainProperties.filter(n => n);
+        this.property.runtimeName = this.cachedProperty.runtimeName;
+        this.property.propertyScope = this.cachedProperty.propertyScope;
+
+        if (this.property instanceof EventPropertyList) {
+            // @ts-ignore
+            this.property.eventProperty.runtimeType = (
+                this.cachedProperty as EventPropertyList
+            ).eventProperty.runtimeType;

Review Comment:
   Can you try to remove the @ts-ignore comment?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@streampipes.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org