This is an automated email from the ASF dual-hosted git repository. riemer pushed a commit to branch STREAMPIPES-145 in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit cb60a2ea80caf695e8357407fe48d998617bd2c6 Author: Dominik Riemer <[email protected]> AuthorDate: Fri Jul 17 23:32:18 2020 +0200 [STREAMPIPES-145] Fix bug in mapping property selection --- .../static-mapping-nary.component.ts | 14 -------------- .../static-mapping/static-mapping.ts | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.ts b/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.ts index 40e2257..7f2d4b3 100644 --- a/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.ts +++ b/ui/src/app/connect/static-properties/static-mapping-nary/static-mapping-nary.component.ts @@ -32,8 +32,6 @@ export class StaticMappingNaryComponent extends StaticMappingComponent<MappingPr @Output() inputEmitter: EventEmitter<Boolean> = new EventEmitter<Boolean>(); - private inputValue: String; - private hasInput: Boolean; availableProperties: Array<any>; constructor(staticPropertyUtil: StaticPropertyUtilService, @@ -75,18 +73,6 @@ export class StaticMappingNaryComponent extends StaticMappingComponent<MappingPr return this.firstStreamPropertySelector + property.runtimeName; } - valueChange(inputValue) { - this.inputValue = inputValue; - if (inputValue == "" || !inputValue) { - this.hasInput = false; - } - else { - this.hasInput = true; - } - - this.inputEmitter.emit(this.hasInput); - } - selectAll() { this.selectNone(); this.availableProperties.forEach(ep => { diff --git a/ui/src/app/connect/static-properties/static-mapping/static-mapping.ts b/ui/src/app/connect/static-properties/static-mapping/static-mapping.ts index d4dcb65..6ccdbcc 100644 --- a/ui/src/app/connect/static-properties/static-mapping/static-mapping.ts +++ b/ui/src/app/connect/static-properties/static-mapping/static-mapping.ts @@ -18,7 +18,11 @@ import {StaticPropertyUtilService} from "../static-property-util.service"; import {PropertySelectorService} from "../../../services/property-selector.service"; -import {EventProperty, MappingProperty} from "../../../core-model/gen/streampipes-model"; +import { + EventProperty, EventPropertyList, EventPropertyNested, EventPropertyPrimitive, + EventPropertyUnion, + MappingProperty +} from "../../../core-model/gen/streampipes-model"; import {AbstractValidatedStaticPropertyRenderer} from "../base/abstract-validated-static-property"; @@ -42,7 +46,10 @@ export abstract class StaticMappingComponent<T extends MappingProperty> extractPossibleSelections(): Array<EventProperty> { let properties: Array<EventProperty> = []; this.eventSchemas.forEach(schema => { - properties = properties.concat(schema.eventProperties.filter(ep => this.isInSelection(ep))); + properties = properties.concat(schema + .eventProperties + .filter(ep => this.isInSelection(ep)) + .map(ep => this.cloneEp(ep))); }); return properties; } @@ -52,4 +59,14 @@ export abstract class StaticMappingComponent<T extends MappingProperty> .some(maps => (maps === this.firstStreamPropertySelector + ep.runtimeName) || maps === this.secondStreamPropertySelector + ep.runtimeName); } + + cloneEp(ep: EventPropertyUnion) { + if (ep instanceof EventPropertyPrimitive) { + return EventPropertyPrimitive.fromData(ep, new EventPropertyPrimitive()); + } else if (ep instanceof EventPropertyList) { + return EventPropertyList.fromData(ep, new EventPropertyList()); + } else { + return EventPropertyNested.fromData(ep, new EventPropertyNested()); + } + } } \ No newline at end of file
