You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2021/06/04 09:40:23 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-378] Fix incorrect assignment of property selectors

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 8845a64  [STREAMPIPES-378] Fix incorrect assignment of property selectors
8845a64 is described below

commit 8845a64b799fa1d5c42995c682434ce654f4b4bb
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Fri Jun 4 11:40:12 2021 +0200

    [STREAMPIPES-378] Fix incorrect assignment of property selectors
---
 .../static-mapping-nary.component.ts               | 17 ++++++-------
 .../static-mapping-unary.component.ts              | 14 ++++-------
 .../static-mapping/static-mapping.ts               | 28 +++++++++++-----------
 3 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/ui/src/app/core-ui/static-properties/static-mapping-nary/static-mapping-nary.component.ts b/ui/src/app/core-ui/static-properties/static-mapping-nary/static-mapping-nary.component.ts
index 9103ab4..e158f18 100644
--- a/ui/src/app/core-ui/static-properties/static-mapping-nary/static-mapping-nary.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-mapping-nary/static-mapping-nary.component.ts
@@ -32,16 +32,13 @@ export class StaticMappingNaryComponent extends StaticMappingComponent<MappingPr
 
     @Output() inputEmitter: EventEmitter<Boolean> = new EventEmitter<Boolean>();
 
-    availableProperties: Array<any>;
-
-    constructor(staticPropertyUtil: StaticPropertyUtilService,
-                PropertySelectorService: PropertySelectorService){
-        super(staticPropertyUtil, PropertySelectorService);
+    constructor(){
+        super();
     }
 
     ngOnInit() {
-        this.availableProperties = this.extractPossibleSelections();
-        this.availableProperties.forEach(ep => ep.propertySelector = this.firstStreamPropertySelector + ep.runtimeName);
+        this.extractPossibleSelections();
+        //this.availableProperties.forEach(ep => ep.propertySelector = this.firstStreamPropertySelector + ep.runtimeName);
         if (!this.staticProperty.selectedProperties) {
             this.selectNone();
         } else {
@@ -69,8 +66,8 @@ export class StaticMappingNaryComponent extends StaticMappingComponent<MappingPr
         }
     }
 
-    makeSelector(property: EventProperty) {
-        return this.firstStreamPropertySelector + property.runtimeName;
+    makeSelector(property: any) {
+        return property.propertySelector;
     }
 
     selectAll() {
@@ -95,4 +92,4 @@ export class StaticMappingNaryComponent extends StaticMappingComponent<MappingPr
         this.emitUpdate();
     }
 
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/core-ui/static-properties/static-mapping-unary/static-mapping-unary.component.ts b/ui/src/app/core-ui/static-properties/static-mapping-unary/static-mapping-unary.component.ts
index db6bd64..911a30f 100644
--- a/ui/src/app/core-ui/static-properties/static-mapping-unary/static-mapping-unary.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-mapping-unary/static-mapping-unary.component.ts
@@ -32,17 +32,12 @@ export class StaticMappingUnaryComponent extends StaticMappingComponent<MappingP
 
     @Output() inputEmitter: EventEmitter<Boolean> = new EventEmitter<Boolean>();
 
-    availableProperties: Array<any>;
-
-    constructor(staticPropertyUtil: StaticPropertyUtilService,
-                PropertySelectorService: PropertySelectorService){
-        super(staticPropertyUtil, PropertySelectorService);
+    constructor(){
+        super();
     }
 
     ngOnInit() {
-        this.availableProperties = this.extractPossibleSelections();
-        this.availableProperties
-            .forEach(ep => ep.propertySelector = this.firstStreamPropertySelector + ep.runtimeName);
+        this.extractPossibleSelections();
         if (!(this.staticProperty.selectedProperty)) {
             this.staticProperty.selectedProperty = this.availableProperties[0].propertySelector;
             this.emitUpdate(true);
@@ -55,8 +50,9 @@ export class StaticMappingUnaryComponent extends StaticMappingComponent<MappingP
     }
 
     onValueChange(value: any) {
+        console.log(value);
         this.staticProperty.selectedProperty = value;
         this.emitUpdate(true);
     }
 
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/core-ui/static-properties/static-mapping/static-mapping.ts b/ui/src/app/core-ui/static-properties/static-mapping/static-mapping.ts
index 7207b35..8ca9eff 100644
--- a/ui/src/app/core-ui/static-properties/static-mapping/static-mapping.ts
+++ b/ui/src/app/core-ui/static-properties/static-mapping/static-mapping.ts
@@ -38,8 +38,9 @@ export abstract class StaticMappingComponent<T extends MappingProperty>
     protected firstStreamPropertySelector: string = "s0::";
     protected secondStreamPropertySelector: string = "s1::";
 
-    constructor(private staticPropertyUtil: StaticPropertyUtilService,
-                private PropertySelectorService: PropertySelectorService){
+    availableProperties: Array<any> = [];
+
+    constructor(){
         super();
     }
 
@@ -49,22 +50,21 @@ export abstract class StaticMappingComponent<T extends MappingProperty>
             : eventProperty.runTimeName;
     }
 
-    extractPossibleSelections(): Array<EventProperty> {
-        let properties: Array<EventProperty> = [];
-        this.eventSchemas.forEach(schema => {
-            properties = properties.concat(schema
+    extractPossibleSelections(): void {
+        this.eventSchemas.forEach((schema, index) => {
+            let streamIdentifier = index == 0 ? this.firstStreamPropertySelector : this.secondStreamPropertySelector;
+            let streamProperties = schema
                 .eventProperties
-                .filter(ep => this.isInSelection(ep))
-                .map(ep => this.cloneEp(ep)));
+                .filter(ep => this.isInSelection(ep, streamIdentifier))
+                .map(ep => this.cloneEp(ep));
+            streamProperties.forEach(ep => (ep as any).propertySelector = streamIdentifier + ep.runtimeName);
+            this.availableProperties = this.availableProperties.concat(streamProperties);
         });
-        console.log(properties);
-        return properties;
     }
 
-    isInSelection(ep: EventProperty): boolean {
+    isInSelection(ep: EventProperty, streamIdentifier: string): boolean {
         return this.staticProperty.mapsFromOptions
-            .some(maps => (maps === this.firstStreamPropertySelector + ep.runtimeName)
-                || maps === this.secondStreamPropertySelector + ep.runtimeName);
+            .some(maps => (maps === streamIdentifier + ep.runtimeName));
     }
 
     cloneEp(ep: EventPropertyUnion) {
@@ -76,4 +76,4 @@ export abstract class StaticMappingComponent<T extends MappingProperty>
             return EventPropertyNested.fromData(ep, new EventPropertyNested());
         }
     }
-}
\ No newline at end of file
+}