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/09/26 08:50:59 UTC

[incubator-streampipes] 03/03: [hotfix] Properly reload pipeline element recommendations

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

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

commit 5714f20412a41f5189d859446de522b563ac7783
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Sat Sep 26 10:50:43 2020 +0200

    [hotfix] Properly reload pipeline element recommendations
---
 .../pipeline-element-recommendation.component.ts   | 26 ++++++++++++++--------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.ts b/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.ts
index 61ca035..2799c44 100644
--- a/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.ts
+++ b/ui/src/app/editor/components/pipeline-element-recommendation/pipeline-element-recommendation.component.ts
@@ -38,8 +38,7 @@ export class PipelineElementRecommendationComponent implements OnInit, AfterView
   @Input()
   pipelineElementDomId: string;
 
-  @Input()
-  recommendedElements: any;
+  _recommendedElements: any;
 
   recommendationsPrepared: boolean = false;
 
@@ -49,9 +48,6 @@ export class PipelineElementRecommendationComponent implements OnInit, AfterView
   }
 
   ngOnInit() {
-    this.fillRemainingItems();
-    this.prepareStyles(this.recommendedElements);
-    this.recommendationsPrepared = true;
   }
 
   ngAfterViewInit(): void {
@@ -136,12 +132,24 @@ export class PipelineElementRecommendationComponent implements OnInit, AfterView
     return (360 / recommendedElements.length);
   }
 
-  fillRemainingItems() {
-    if (this.recommendedElements.length < 6) {
-      for (var i = this.recommendedElements.length; i < 6; i++) {
+  fillRemainingItems(recommendedElements) {
+    if (recommendedElements.length < 6) {
+      for (var i = recommendedElements.length; i < 6; i++) {
         let element = {fakeElement: true, weight: 0};
-        this.recommendedElements.push(element);
+        recommendedElements.push(element);
       }
     }
   }
+
+  get recommendedElements() {
+    return this._recommendedElements;
+  }
+
+  @Input()
+  set recommendedElements(recommendedElements: any) {
+    this.fillRemainingItems(recommendedElements);
+    this.prepareStyles(recommendedElements);
+    this._recommendedElements = recommendedElements;
+    this.recommendationsPrepared = true;
+  }
 }
\ No newline at end of file