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

riemer pushed a commit to branch 2830-data-adapter-losing-dimension-selection
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to 
refs/heads/2830-data-adapter-losing-dimension-selection by this push:
     new 6b90352bde fix(#2830): Properly store property scope in rule 
definitions
6b90352bde is described below

commit 6b90352bde94d69f011fcd4d943d002b0c83f922
Author: Dominik Riemer <[email protected]>
AuthorDate: Tue May 21 16:58:12 2024 +0200

    fix(#2830): Properly store property scope in rule definitions
---
 .../convert/ToTransformedSchemaConverter.java              |  4 ++++
 .../connect/rules/value/AddTimestampRuleDescription.java   | 11 +++++++++++
 .../src/lib/model/gen/streampipes-model.ts                 |  4 +++-
 .../sp-exception-message.component.html                    |  8 ++++++--
 .../sp-exception-message.component.scss                    |  1 -
 ui/src/app/connect/services/transformation-rule.service.ts | 14 +++++++++-----
 6 files changed, 33 insertions(+), 9 deletions(-)

diff --git 
a/streampipes-connect-shared/src/main/java/org/apache/streampipes/connect/shared/preprocessing/convert/ToTransformedSchemaConverter.java
 
b/streampipes-connect-shared/src/main/java/org/apache/streampipes/connect/shared/preprocessing/convert/ToTransformedSchemaConverter.java
index 60f282abd4..92b1674d0d 100644
--- 
a/streampipes-connect-shared/src/main/java/org/apache/streampipes/connect/shared/preprocessing/convert/ToTransformedSchemaConverter.java
+++ 
b/streampipes-connect-shared/src/main/java/org/apache/streampipes/connect/shared/preprocessing/convert/ToTransformedSchemaConverter.java
@@ -109,6 +109,10 @@ public class ToTransformedSchemaConverter implements 
ITransformationRuleVisitor,
   public void visit(AddTimestampRuleDescription rule) {
     var timestampProperty = 
EpProperties.timestampProperty(rule.getRuntimeKey());
     timestampProperty.setElementId(TIMESTAMP_ID_PREFIX + 
UUIDGenerator.generateUuid());
+    // null check required for backwards compatibility
+    if (rule.getPropertyScope() != null) {
+      timestampProperty.setPropertyScope(rule.getPropertyScope().name());
+    }
     this.properties.add(timestampProperty);
   }
 
diff --git 
a/streampipes-model/src/main/java/org/apache/streampipes/model/connect/rules/value/AddTimestampRuleDescription.java
 
b/streampipes-model/src/main/java/org/apache/streampipes/model/connect/rules/value/AddTimestampRuleDescription.java
index 379ac3b90b..1df522dbd0 100644
--- 
a/streampipes-model/src/main/java/org/apache/streampipes/model/connect/rules/value/AddTimestampRuleDescription.java
+++ 
b/streampipes-model/src/main/java/org/apache/streampipes/model/connect/rules/value/AddTimestampRuleDescription.java
@@ -20,10 +20,12 @@ package org.apache.streampipes.model.connect.rules.value;
 
 import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
 import org.apache.streampipes.model.connect.rules.TransformationRulePriority;
+import org.apache.streampipes.model.schema.PropertyScope;
 
 public class AddTimestampRuleDescription extends 
ValueTransformationRuleDescription {
 
   private String runtimeKey;
+  private PropertyScope propertyScope;
 
   public AddTimestampRuleDescription() {
     super();
@@ -36,6 +38,7 @@ public class AddTimestampRuleDescription extends 
ValueTransformationRuleDescript
   public AddTimestampRuleDescription(AddTimestampRuleDescription other) {
     super(other);
     this.runtimeKey = other.getRuntimeKey();
+    this.propertyScope = other.getPropertyScope();
   }
 
   public String getRuntimeKey() {
@@ -46,6 +49,14 @@ public class AddTimestampRuleDescription extends 
ValueTransformationRuleDescript
     this.runtimeKey = runtimeKey;
   }
 
+  public PropertyScope getPropertyScope() {
+    return propertyScope;
+  }
+
+  public void setPropertyScope(PropertyScope propertyScope) {
+    this.propertyScope = propertyScope;
+  }
+
   @Override
   public void accept(ITransformationRuleVisitor visitor) {
     visitor.visit(this);
diff --git 
a/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts
 
b/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts
index b0de88590b..1cd4d5a729 100644
--- 
a/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts
+++ 
b/ui/projects/streampipes/platform-services/src/lib/model/gen/streampipes-model.ts
@@ -20,7 +20,7 @@
 /* tslint:disable */
 /* eslint-disable */
 // @ts-nocheck
-// Generated using typescript-generator version 3.2.1263 on 2024-04-30 
20:29:03.
+// Generated using typescript-generator version 3.2.1263 on 2024-05-21 
13:45:10.
 
 export class NamedStreamPipesEntity {
     '@class':
@@ -325,6 +325,7 @@ export class ValueTransformationRuleDescription extends 
TransformationRuleDescri
 
 export class AddTimestampRuleDescription extends 
ValueTransformationRuleDescription {
     '@class': 
'org.apache.streampipes.model.connect.rules.value.AddTimestampRuleDescription';
+    'propertyScope': PropertyScope;
     'runtimeKey': string;
 
     static 'fromData'(
@@ -336,6 +337,7 @@ export class AddTimestampRuleDescription extends 
ValueTransformationRuleDescript
         }
         const instance = target || new AddTimestampRuleDescription();
         super.fromData(data, instance);
+        instance.propertyScope = data.propertyScope;
         instance.runtimeKey = data.runtimeKey;
         return instance;
     }
diff --git 
a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.html
 
b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.html
index 5f9b8ab1e0..04493f10e3 100644
--- 
a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.html
+++ 
b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.html
@@ -30,13 +30,17 @@
                     <h5 *ngIf="messageTimestamp" class="mr-15">
                         {{ messageTimestamp | date: 'short' }}
                     </h5>
-                    <h5 fxFlex class="color-warn">
+                    <h5 fxFlex>
                         {{ message.title || 'Error' }}
                     </h5>
                 </div>
                 <span fxFlex></span>
                 <div fxLayoutAlign="end center" *ngIf="showDetails">
-                    <button mat-button (click)="openDetailsDialog()">
+                    <button
+                        mat-button
+                        color="accent"
+                        (click)="openDetailsDialog()"
+                    >
                         <i class="material-icons">visibility</i>&nbsp;Details
                     </button>
                 </div>
diff --git 
a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.scss
 
b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.scss
index 26170c62ba..165ce8fb0f 100644
--- 
a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.scss
+++ 
b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.scss
@@ -18,7 +18,6 @@
 
 .error-panel {
     background: var(--color-bg-1);
-    border-radius: 5px;
 }
 
 .error {
diff --git a/ui/src/app/connect/services/transformation-rule.service.ts 
b/ui/src/app/connect/services/transformation-rule.service.ts
index f1cca8565c..4179a5e02a 100644
--- a/ui/src/app/connect/services/transformation-rule.service.ts
+++ b/ui/src/app/connect/services/transformation-rule.service.ts
@@ -30,6 +30,7 @@ import {
     EventPropertyUnion,
     EventSchema,
     MoveRuleDescription,
+    PropertyScope,
     RenameRuleDescription,
     SemanticType,
     TimestampTranfsformationRuleDescription,
@@ -55,22 +56,24 @@ export class TransformationRuleService {
         if (originalSchema == null || targetSchema == null) {
             console.log('Old and new schema must be defined');
         } else {
-            const addedTimestampProperties = this.getTimestampProperty(
+            const addedTimestampProperty = this.getTimestampProperty(
                 targetSchema.eventProperties,
             );
-            if (addedTimestampProperties) {
+            if (addedTimestampProperty) {
                 // add to old event schema for the case users moved the 
property to a nested property
-                originalSchema.eventProperties.push(addedTimestampProperties);
+                originalSchema.eventProperties.push(addedTimestampProperty);
 
                 const timestampRuleDescription: AddTimestampRuleDescription =
                     new AddTimestampRuleDescription();
                 timestampRuleDescription['@class'] =
                     
'org.apache.streampipes.model.connect.rules.value.AddTimestampRuleDescription';
                 timestampRuleDescription.runtimeKey =
-                    addedTimestampProperties.runtimeName;
+                    addedTimestampProperty.runtimeName;
+                timestampRuleDescription.propertyScope =
+                    addedTimestampProperty.propertyScope as PropertyScope;
                 transformationRuleDescriptions.push(timestampRuleDescription);
             }
-
+            console.log(transformationRuleDescriptions);
             const staticValueProperties = this.getStaticValueProperties(
                 targetSchema.eventProperties,
             );
@@ -84,6 +87,7 @@ export class TransformationRuleService {
                 rule.datatype = ep.runtimeType;
                 rule.label = ep.label;
                 rule.description = ep.description;
+                rule.propertyScope = ep.propertyScope as PropertyScope;
                 if (ep.domainProperties.length > 0) {
                     rule.semanticType = ep.domainProperties[0];
                 }

Reply via email to