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 2020/06/13 12:29:38 UTC

[incubator-streampipes] branch STREAMPIPES-145 updated: [STREAMPIPES-145] Migrate pipeline cache

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


The following commit(s) were added to refs/heads/STREAMPIPES-145 by this push:
     new cd2cd03  [STREAMPIPES-145] Migrate pipeline cache
cd2cd03 is described below

commit cd2cd03db5c666cb002abc8350b565612f35e299
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Sat Jun 13 14:28:46 2020 +0200

    [STREAMPIPES-145] Migrate pipeline cache
---
 .../pipeline-assembly.component.html               | 13 +++++++-----
 .../pipeline-assembly.component.ts                 | 18 +++++++++--------
 .../components/pipeline/pipeline.component.ts      | 23 ++++++++++++++--------
 3 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.html b/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.html
index 0a2898d..1f3c41d 100644
--- a/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.html
+++ b/ui/src/app/editor-v2/components/pipeline-assembly/pipeline-assembly.component.html
@@ -52,10 +52,10 @@
             </button>
             <div class="pipeline-cache-block">
                 <div *ngIf="pipelineCached">All pipeline modifications saved.</div>
-                <!--                <div ng-if="pipelineCacheRunning"><md-progress-circular-->
-                <!--                        md-mode="indeterminate" class="pipeline-cache-progress"-->
-                <!--                        md-diameter="10"></md-progress-circular>&nbsp;Saving pipeline-->
-                <!--                    modifications</div>-->
+                    <div *ngIf="pipelineCacheRunning">
+                        <mat-spinner [mode]="'indeterminate'" class="pipeline-cache-progress" [diameter]="10">
+                        </mat-spinner>&nbsp;Saving pipeline
+                        modifications</div>
             </div>
             <span fxFlex></span>
             <div style="position:relative;">
@@ -101,7 +101,10 @@
                       [allElements]="allElements"
                       [preview]="false"
                       [pipelineCached]="pipelineCached"
-                      [pipelineCacheRunning]="pipelineCacheRunning"></pipeline>
+                      [pipelineCacheRunning]="pipelineCacheRunning"
+                      (pipelineCachedChanged)="pipelineCached=$event"
+                      (pipelineCacheRunningChanged)="pipelineCacheRunning=$event"
+            ></pipeline>
         </div>
     </div>
 </div>
\ No newline at end of file
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 91accc6..4559321 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
@@ -88,7 +88,7 @@ export class PipelineAssemblyComponent implements OnInit {
         if (this.currentModifiedPipelineId) {
             //this.displayPipelineById();
         } else {
-            //this.checkAndDisplayCachedPipeline();
+            this.checkAndDisplayCachedPipeline();
         }
 
         // this.$rootScope.$on("pipeline.validate", () => {
@@ -178,7 +178,7 @@ export class PipelineAssemblyComponent implements OnInit {
         this.currentZoomLevel = 1;
         this.JsplumbBridge.setZoom(this.currentZoomLevel);
         this.JsplumbBridge.repaintEverything();
-        this.RestApi.removePipelineFromCache().then(msg => {
+        this.EditorService.removePipelineFromCache().subscribe(msg => {
             this.pipelineCached = false;
             this.pipelineCacheRunning = false;
         });
@@ -212,9 +212,9 @@ export class PipelineAssemblyComponent implements OnInit {
     }
 
     checkAndDisplayCachedPipeline() {
-        this.RestApi.getCachedPipeline().then(msg => {
-            if (msg.data !== "") {
-                this.rawPipelineModel = msg.data;
+        this.EditorService.getCachedPipeline().subscribe(msg => {
+            if (msg) {
+                this.rawPipelineModel = msg as any;
                 this.displayPipelineInEditor(true);
             }
         });
@@ -232,9 +232,11 @@ export class PipelineAssemblyComponent implements OnInit {
     };
 
     displayPipelineInEditor(autoLayout) {
-        this.PipelinePositioningService.displayPipeline(this.rawPipelineModel, "#assembly", false, autoLayout);
-        this.EditorService.makePipelineAssemblyEmpty(false);
-        this.pipelineValid = this.PipelineValidationService.isValidPipeline(this.rawPipelineModel);
+        setTimeout(() => {
+            this.PipelinePositioningService.displayPipeline(this.rawPipelineModel, "#assembly", false, autoLayout);
+            this.EditorService.makePipelineAssemblyEmpty(false);
+            this.pipelineValid = this.PipelineValidationService.isValidPipeline(this.rawPipelineModel);
+        });
     }
 
     toggleErrorMessagesDisplayed() {
diff --git a/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts b/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
index bd14563..e6dd360 100644
--- a/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
+++ b/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
@@ -24,7 +24,7 @@ import {JsplumbService} from "../../services/jsplumb.service";
 import {PipelineEditorService} from "../../services/pipeline-editor.service";
 import {JsplumbBridge} from "../../services/jsplumb-bridge.service";
 import {ShepherdService} from "../../../services/tour/shepherd.service";
-import {Component, Input, OnInit} from "@angular/core";
+import {Component, EventEmitter, Input, OnInit, Output} from "@angular/core";
 import {
   InvocablePipelineElementUnion,
   PipelineElementConfig,
@@ -67,9 +67,15 @@ export class PipelineComponent implements OnInit {
   @Input()
   pipelineCached: boolean;
 
+  @Output()
+  pipelineCachedChanged: EventEmitter<boolean> = new EventEmitter<boolean>();
+
   @Input()
   pipelineCacheRunning: boolean;
 
+  @Output()
+  pipelineCacheRunningChanged: EventEmitter<boolean> = new EventEmitter<boolean>();
+
   availablePipelineElementCache: PipelineElementUnion[];
 
   DialogBuilder: any;
@@ -110,11 +116,7 @@ export class PipelineComponent implements OnInit {
   }
 
   validatePipeline() {
-    //this.$timeout(() => {
       this.pipelineValid = this.PipelineValidationService.isValidPipeline(this.rawPipelineModel);
-      console.log("validating");
-      console.log(this.pipelineValid);
-    //}, 200);
   }
 
   ngOnDestroy() {
@@ -246,7 +248,7 @@ export class PipelineComponent implements OnInit {
       this.EditorService.makePipelineAssemblyEmpty(true);
     }
     this.JsplumbBridge.repaintEverything();
-    this.RestApi.updateCachedPipeline(this.rawPipelineModel);
+    this.triggerPipelineCacheUpdate();
   }
 
   initPlumb() {
@@ -350,9 +352,12 @@ export class PipelineComponent implements OnInit {
 
   triggerPipelineCacheUpdate() {
     this.pipelineCacheRunning = true;
-    this.RestApi.updateCachedPipeline(this.rawPipelineModel).then(msg => {
+    this.pipelineCacheRunningChanged.emit(this.pipelineCacheRunning);
+    this.EditorService.updateCachedPipeline(this.rawPipelineModel).subscribe(msg => {
       this.pipelineCacheRunning = false;
+      this.pipelineCacheRunningChanged.emit(this.pipelineCacheRunning)
       this.pipelineCached = true;
+      this.pipelineCachedChanged.emit(this.pipelineCached);
     });
   }
 
@@ -367,7 +372,9 @@ export class PipelineComponent implements OnInit {
 
     dialogRef.afterClosed().subscribe(c => {
       if (c) {
-        this.JsplumbService.activateEndpoint(pipelineElement.payload.dom, pipelineElement.settings.completed)
+        pipelineElement.settings.openCustomize = false;
+        this.JsplumbService.activateEndpoint(pipelineElement.payload.dom, pipelineElement.settings.completed);
+        this.triggerPipelineCacheUpdate();
       }
     });
   }