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/11 13:17:34 UTC

[incubator-streampipes] branch STREAMPIPES-145 updated: [STREAMPIPES-145] Improve data injection to dialogs

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 3c3fdec  [STREAMPIPES-145] Improve data injection to dialogs
3c3fdec is described below

commit 3c3fdec1247ab438b323ec493997c53859de913d
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Thu Jun 11 15:13:01 2020 +0200

    [STREAMPIPES-145] Improve data injection to dialogs
---
 ui/src/app/editor-v2/components/pipeline/pipeline.component.ts | 8 +++++---
 ui/src/app/editor-v2/dialog/base-dialog/base-dialog.model.ts   | 1 +
 ui/src/app/editor-v2/dialog/base-dialog/base-dialog.service.ts | 9 ++++-----
 3 files changed, 10 insertions(+), 8 deletions(-)

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 15cd9bf..20eb19f 100644
--- a/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
+++ b/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
@@ -356,10 +356,12 @@ export class PipelineComponent implements OnInit {
     inputMap["pipelineElement"] = pipelineElement;
 
     const dialogRef = this.dialogService.open(CustomizeComponent,{
-      width: "60vw",
       panelType: PanelType.SLIDE_IN_PANEL,
-      title: "Customize " + pipelineElement.payload.name
-    }, inputMap);
+      title: "Customize " + pipelineElement.payload.name,
+      data: {
+        "pipelineElement": pipelineElement
+      }
+    });
 
     dialogRef.afterClosed().subscribe(c => {
       console.log("after close");
diff --git a/ui/src/app/editor-v2/dialog/base-dialog/base-dialog.model.ts b/ui/src/app/editor-v2/dialog/base-dialog/base-dialog.model.ts
index 826eb4b..af68298 100644
--- a/ui/src/app/editor-v2/dialog/base-dialog/base-dialog.model.ts
+++ b/ui/src/app/editor-v2/dialog/base-dialog/base-dialog.model.ts
@@ -14,6 +14,7 @@ export interface DialogConfig {
   disableClose?: boolean;
   autoFocus?: boolean;
   title: string;
+  data?: any;
 }
 
 export interface DialogPanelConfig {
diff --git a/ui/src/app/editor-v2/dialog/base-dialog/base-dialog.service.ts b/ui/src/app/editor-v2/dialog/base-dialog/base-dialog.service.ts
index 201b7fb..007c648 100644
--- a/ui/src/app/editor-v2/dialog/base-dialog/base-dialog.service.ts
+++ b/ui/src/app/editor-v2/dialog/base-dialog/base-dialog.service.ts
@@ -38,9 +38,8 @@ export class DialogService {
   }
 
   public open<T>(component: ComponentType<T>,
-                 config?: DialogConfig,
-                 inputMap?: Object): DialogRef<T> {
-    config = config || {width: "auto", title: "", panelType: PanelType.SLIDE_IN_PANEL};
+                 config?: DialogConfig): DialogRef<T> {
+    config = config || {width: "60vw", title: "", panelType: PanelType.SLIDE_IN_PANEL};
 
     const positionStrategy = this.getPositionStrategy(config.panelType);
     const panelConfig: BaseDialogConfig = this.getConfig(config.panelType);
@@ -57,8 +56,8 @@ export class DialogService {
     panelDialogContainerRef.instance.dialogRef = dialogRef;
     dialogRef.componentInstance = panelDialogContainerRef.instance.attach();
 
-    Object.keys(inputMap).forEach(key => {
-      dialogRef.componentInstance[key] = inputMap[key];
+    Object.keys(config.data).forEach(key => {
+      dialogRef.componentInstance[key] = config.data[key];
     })
 
     this.applyDialogProperties(panelDialogContainerRef, overlay, config);