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 85f35decd8c89cb429f82f678d9f6be1296895fb Author: Dominik Riemer <[email protected]> AuthorDate: Thu Jul 16 23:05:36 2020 +0200 [STREAMPIPES-145] Fix bug in pipeline element cache --- .../pipeline-assembly.component.ts | 2 +- ui/src/app/editor-v2/services/editor.service.ts | 29 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.ts b/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.ts index 384b7ec..4c9333f 100644 --- a/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.ts +++ b/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.ts @@ -214,7 +214,7 @@ export class PipelineAssemblyComponent implements OnInit { checkAndDisplayCachedPipeline() { this.EditorService.getCachedPipeline().subscribe(msg => { if (msg) { - this.rawPipelineModel = msg as any; + this.rawPipelineModel = msg; this.displayPipelineInEditor(true); } }); diff --git a/ui/src/app/editor-v2/services/editor.service.ts b/ui/src/app/editor-v2/services/editor.service.ts index 5703c65..0b4218a 100644 --- a/ui/src/app/editor-v2/services/editor.service.ts +++ b/ui/src/app/editor-v2/services/editor.service.ts @@ -19,15 +19,17 @@ import {Injectable} from "@angular/core"; import {HttpClient} from "@angular/common/http"; import { - PipelineElementRecommendationMessage, - PipelineModificationMessage + DataProcessorInvocation, DataSinkInvocation, + PipelineElementRecommendationMessage, + PipelineModificationMessage, SpDataSet, SpDataStream } from "../../core-model/gen/streampipes-model"; import {Observable, Subject} from "rxjs"; import {PlatformServicesCommons} from "../../platform-services/apis/commons.service"; -import {PipelineElementUnion} from "../model/editor.model"; +import {PipelineElementConfig, PipelineElementUnion} from "../model/editor.model"; import {PanelType} from "../../core-ui/dialog/base-dialog/base-dialog.model"; import {DialogService} from "../../core-ui/dialog/base-dialog/base-dialog.service"; import {HelpComponent} from "../dialog/help/help.component"; +import {map} from "rxjs/operators"; @Injectable() export class EditorService { @@ -55,8 +57,25 @@ export class EditorService { }); } - getCachedPipeline() { - return this.http.get(this.platformServicesCommons.authUserBasePath() + "/pipeline-cache"); + getCachedPipeline(): Observable<PipelineElementConfig[]> { + return this.http.get(this.platformServicesCommons.authUserBasePath() + "/pipeline-cache") + .pipe(map(result => { + let configs: PipelineElementConfig[] = result as PipelineElementConfig[]; + configs.map(config => config.payload = this.convert(config.payload)); + return configs; + })); + } + + convert(payload: any) { + if (payload['@class'] === "org.apache.streampipes.model.SpDataSet") { + return SpDataSet.fromData(payload as SpDataSet); + } else if (payload['@class'] === "org.apache.streampipes.model.SpDataStream") { + return SpDataStream.fromData(payload as SpDataStream); + } else if (payload['@class'] === "org.apache.streampipes.model.graph.DataProcessorInvocation") { + return DataProcessorInvocation.fromData(payload as DataProcessorInvocation); + } else { + return DataSinkInvocation.fromData(payload as DataSinkInvocation); + } } getEpCategories() {
