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 2022/02/09 19:21:25 UTC

[incubator-streampipes] branch experimental-module-federation-494 updated: [STREAMPIPES-494] Improve cloning behaviour of pipelines

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

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


The following commit(s) were added to refs/heads/experimental-module-federation-494 by this push:
     new e4d5229  [STREAMPIPES-494] Improve cloning behaviour of pipelines
e4d5229 is described below

commit e4d5229be8938b5b53abb2a150c6fa1d53b4ccc9
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Wed Feb 9 20:21:14 2022 +0100

    [STREAMPIPES-494] Improve cloning behaviour of pipelines
---
 .../streampipes/manager/matching/ProtocolSelector.java     |  2 +-
 .../pipeline-assembly/pipeline-assembly.component.ts       |  5 +++--
 .../app/editor/components/pipeline/pipeline.component.ts   |  1 -
 .../editor/dialog/save-pipeline/save-pipeline.component.ts | 14 ++++++++++++++
 4 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/ProtocolSelector.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/ProtocolSelector.java
index 4527e90..ec3a891 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/ProtocolSelector.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/ProtocolSelector.java
@@ -39,7 +39,7 @@ public class ProtocolSelector extends GroundingSelector {
 
     public ProtocolSelector(NamedStreamPipesEntity source, Set<InvocableStreamPipesEntity> targets) {
         super(source, targets);
-        this.outputTopic = TopicGenerator.generateInternalPipelineElementTopic(source.getDOM());
+        this.outputTopic = TopicGenerator.generateRandomTopic();
         this.prioritizedProtocols =
                 BackendConfig.INSTANCE.getMessagingSettings().getPrioritizedProtocols();
     }
diff --git a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts
index 7c2fcfb..fd23987 100644
--- a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts
+++ b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts
@@ -214,8 +214,9 @@ export class PipelineAssemblyComponent implements OnInit, AfterViewInit {
      * Sends the pipeline to the server
      */
     submit() {
-        const pipeline = this.objectProvider.makeFinalPipeline(this.rawPipelineModel);
-        this.pipelinePositioningService.collectPipelineElementPositions(this.pipelineCanvasMetadata, this.rawPipelineModel);
+        const pipelineModel = this.pipelineComponent.rawPipelineModel;
+        const pipeline = this.objectProvider.makeFinalPipeline(pipelineModel);
+        this.pipelinePositioningService.collectPipelineElementPositions(this.pipelineCanvasMetadata, pipelineModel);
         pipeline.name = this.currentPipelineName;
         pipeline.description = this.currentPipelineDescription;
         if (this.currentModifiedPipelineId) {
diff --git a/ui/src/app/editor/components/pipeline/pipeline.component.ts b/ui/src/app/editor/components/pipeline/pipeline.component.ts
index eff13c9..4508749 100644
--- a/ui/src/app/editor/components/pipeline/pipeline.component.ts
+++ b/ui/src/app/editor/components/pipeline/pipeline.component.ts
@@ -266,7 +266,6 @@ export class PipelineComponent implements OnInit, OnDestroy {
     }, 10);
 
     const streamDescription = pipelineElementConfig.payload as SpDataStream;
-    console.log(streamDescription);
     if (streamDescription
       .eventGrounding
       .transportProtocols[0]
diff --git a/ui/src/app/editor/dialog/save-pipeline/save-pipeline.component.ts b/ui/src/app/editor/dialog/save-pipeline/save-pipeline.component.ts
index 7b8d05d..d2774a3 100644
--- a/ui/src/app/editor/dialog/save-pipeline/save-pipeline.component.ts
+++ b/ui/src/app/editor/dialog/save-pipeline/save-pipeline.component.ts
@@ -24,6 +24,8 @@ import { EditorService } from '../../services/editor.service';
 import { ShepherdService } from '../../../services/tour/shepherd.service';
 import { FormControl, FormGroup, Validators } from '@angular/forms';
 import { Router } from '@angular/router';
+import { InvocablePipelineElementUnion } from "../../model/editor.model";
+import { JsplumbService } from "../../services/jsplumb.service";
 
 @Component({
   selector: 'save-pipeline',
@@ -60,6 +62,7 @@ export class SavePipelineComponent implements OnInit {
 
   constructor(private editorService: EditorService,
               private dialogRef: DialogRef<SavePipelineComponent>,
+              private jsplumbService: JsplumbService,
               private objectProvider: ObjectProvider,
               private pipelineService: PipelineService,
               private router: Router,
@@ -120,6 +123,10 @@ export class SavePipelineComponent implements OnInit {
     if (updateMode) {
       storageRequest = this.pipelineService.updatePipeline(this.pipeline);
     } else {
+      if (this.currentModifiedPipelineId) {
+        this.pipeline.actions.forEach(element => this.updateId(element));
+        this.pipeline.sepas.forEach(element => this.updateId(element));
+      }
       this.pipeline._id = undefined;
       storageRequest = this.pipelineService.storePipeline(this.pipeline);
     }
@@ -138,6 +145,13 @@ export class SavePipelineComponent implements OnInit {
         });
   }
 
+  updateId(entity: InvocablePipelineElementUnion) {
+    const lastIdIndex = entity.elementId.lastIndexOf(':');
+    const newElementId = entity.elementId.substring(0, lastIdIndex + 1) + this.jsplumbService.makeId(5);
+    entity.elementId = newElementId;
+    entity.uri = newElementId;
+  }
+
   storePipelineCanvasMetadata(pipelineId: string,
                               updateMode: boolean) {
     let request;