Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#2830): Data adapter losing dimension selection #2888

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public void visit(RemoveDuplicatesTransformationRuleDescription rule) {
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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

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();
Expand All @@ -36,6 +38,7 @@ public AddTimestampRuleDescription(String runtimeKey) {
public AddTimestampRuleDescription(AddTimestampRuleDescription other) {
super(other);
this.runtimeKey = other.getRuntimeKey();
this.propertyScope = other.getPropertyScope();
}

public String getRuntimeKey() {
Expand All @@ -46,6 +49,14 @@ public void setRuntimeKey(String runtimeKey) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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'(
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

.error-panel {
background: var(--color-bg-1);
border-radius: 5px;
}

.error {
Expand Down
13 changes: 8 additions & 5 deletions ui/src/app/connect/services/transformation-rule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
EventPropertyUnion,
EventSchema,
MoveRuleDescription,
PropertyScope,
RenameRuleDescription,
SemanticType,
TimestampTranfsformationRuleDescription,
Expand All @@ -55,22 +56,23 @@ 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);
}

const staticValueProperties = this.getStaticValueProperties(
targetSchema.eventProperties,
);
Expand All @@ -84,6 +86,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];
}
Expand Down
Loading