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 c0e14a29e4dfe8889ab70103898226a9b208e101
Author: Dominik Riemer <[email protected]>
AuthorDate: Sat Jul 18 13:32:32 2020 +0200

    [STREAMPIPES-145] Migrate interactive editor tour
---
 .../components/pipeline/pipeline.component.ts      |   6 +-
 .../dialog/customize/customize.component.ts        |  12 +-
 .../save-pipeline/save-pipeline.component.html     |  12 +-
 .../save-pipeline/save-pipeline.component.ts       |  22 ++-
 ui/src/app/editor-v2/editor.component.html         |   2 +-
 ui/src/app/editor-v2/editor.component.ts           |   1 +
 .../services/pipeline-operations.service.ts        | 179 ++++++++++-----------
 .../tour/create-pipeline-tour.constants.ts         |  20 +--
 ui/src/app/services/tour/shepherd.service.ts       |   4 +-
 9 files changed, 140 insertions(+), 118 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 c82b61c..2a48f04 100644
--- a/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
+++ b/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
@@ -192,7 +192,7 @@ export class PipelineComponent implements OnInit {
               setTimeout(() => {
                 setTimeout(() => {
                   
this.JsplumbService.setDropped(pipelineElementConfig.payload.dom, 
pipelineElementConfig.payload, true, false);
-                });
+                }, 10);
               });
             }
             else if (ui.draggable.hasClass('stream')) {
@@ -201,7 +201,7 @@ export class PipelineComponent implements OnInit {
               setTimeout(() => {
                 setTimeout(() => {
                   
this.JsplumbService.sepaDropped(pipelineElementConfig.payload.dom, 
pipelineElementConfig.payload, true, false);
-                });
+                }, 10);
               });
               //Droppable Actions
             } else if (ui.draggable.hasClass('action')) {
@@ -209,7 +209,7 @@ export class PipelineComponent implements OnInit {
                 setTimeout(() => {
                   
this.JsplumbService.actionDropped(pipelineElementConfig.payload.dom, 
pipelineElementConfig.payload, true, false);
                 });
-              });
+              }, 10);
             }
             if (this.ShepherdService.isTourActive()) {
               this.ShepherdService.trigger("drop-" 
+pipelineElementConfig.type);
diff --git a/ui/src/app/editor-v2/dialog/customize/customize.component.ts 
b/ui/src/app/editor-v2/dialog/customize/customize.component.ts
index 42e1c2a..a3c423e 100644
--- a/ui/src/app/editor-v2/dialog/customize/customize.component.ts
+++ b/ui/src/app/editor-v2/dialog/customize/customize.component.ts
@@ -29,6 +29,7 @@ import {DialogRef} from 
"../../../core-ui/dialog/base-dialog/dialog-ref";
 import {JsplumbService} from "../../services/jsplumb.service";
 import {DataProcessorInvocation, EventSchema} from 
"../../../core-model/gen/streampipes-model";
 import {FormBuilder, FormGroup} from "@angular/forms";
+import {ShepherdService} from "../../../services/tour/shepherd.service";
 
 @Component({
   selector: 'customize-pipeline-element',
@@ -49,7 +50,6 @@ export class CustomizeComponent implements OnInit, 
AfterViewInit {
   displayRecommended: boolean = true;
   showDocumentation: boolean = false;
 
-  selectedElement: any;
   selection: any;
   matchingSelectionLeft: any;
   matchingSelectionRight: any;
@@ -68,10 +68,9 @@ export class CustomizeComponent implements OnInit, 
AfterViewInit {
 
   isDataProcessor: boolean = false;
 
-  //ShepherdService: ShepherdService;
-
   constructor(private dialogRef: DialogRef<CustomizeComponent>,
               private JsPlumbService: JsplumbService,
+              private ShepherdService: ShepherdService,
               private fb: FormBuilder,
               private changeDetectorRef: ChangeDetectorRef) {
 
@@ -94,6 +93,9 @@ export class CustomizeComponent implements OnInit, 
AfterViewInit {
     this.parentForm.statusChanges.subscribe((status)=>{
       this.formValid = this.viewInitialized && this.parentForm.valid;
     })
+    if (this.ShepherdService.isTourActive()) {
+      this.ShepherdService.trigger("customize-" +this.pipelineElement.type);
+    }
   }
 
   close() {
@@ -104,7 +106,9 @@ export class CustomizeComponent implements OnInit, 
AfterViewInit {
     this.pipelineElement.payload = this.cachedPipelineElement;
     this.pipelineElement.settings.completed = true;
     this.pipelineElement.payload.configured = true;
-    console.log(this.pipelineElement);
+    if (this.ShepherdService.isTourActive()) {
+      this.ShepherdService.trigger("save-" +this.pipelineElement.type);
+    }
     this.dialogRef.close(this.pipelineElement);
   }
 
diff --git 
a/ui/src/app/editor-v2/dialog/save-pipeline/save-pipeline.component.html 
b/ui/src/app/editor-v2/dialog/save-pipeline/save-pipeline.component.html
index 1ab2b87..92744a7 100644
--- a/ui/src/app/editor-v2/dialog/save-pipeline/save-pipeline.component.html
+++ b/ui/src/app/editor-v2/dialog/save-pipeline/save-pipeline.component.html
@@ -20,7 +20,6 @@
     <div class="sp-dialog-content padding-20">
         <div fxFlex="100" fxLayout="column">
 
-        <form name="submitPipelineForm">
             <div fxFlex="100" fxLayout="column">
                 <div id="overwriteCheckbox" class="checkbox" 
*ngIf="modificationMode">
                     <mat-radio-group class="md-accent" 
[(ngModel)]="updateMode">
@@ -32,30 +31,31 @@
                         </mat-radio-button>
                     </mat-radio-group>
                 </div>
+                <form [formGroup]="submitPipelineForm">
                 <div fxFlex="100" fxLayout="column" *ngIf="!modificationMode 
|| updateMode=='clone'">
                     <mat-form-field fxFlex><mat-label>Pipeline Name</mat-label>
-                        <input matInput name="pipelineName" 
[(ngModel)]="pipeline.name" required [maxLength]="40"/>
+                        <input [formControlName]="'pipelineName'" matInput 
name="pipelineName"/>
 <!--                        <span 
ng-show="submitPipelineForm.pipelineName.$touched && 
submitPipelineForm.pipelineName.$error.required">Please provide a pipeline 
name.</span>-->
 <!--                        <span 
ng-show="submitPipelineForm.pipelineName.$error.maxlength">Please provide a 
shorter pipeline name.</span>-->
                     </mat-form-field>
                     <mat-form-field fxFlex><mat-label>Description</mat-label>
-                        <input matInput name="pipelineDescription" 
[(ngModel)]="pipeline.description" [maxLength]="80"/>
+                        <input [formControlName]="'pipelineDescription'" 
matInput/>
 <!--                        <span 
ng-show="submitPipelineForm.pipelineDescription.$error.maxlength">Please 
provide a shorter description.</span>-->
                     </mat-form-field>
                 </div>
+                </form>
                 <mat-checkbox (click)="triggerTutorial()" aria-label="Start 
Pipeline" [(ngModel)]="startPipelineAfterStorage">
                     Start pipeline immediately
                 </mat-checkbox>
             </div>
-        </form>
         </div>
     </div>
     <mat-divider></mat-divider>
     <div class="sp-dialog-actions">
-        <button mat-button mat-raised-button color="primary" 
(click)="savePipelineName(false)" style="margin-right:10px;">
+        <button [disabled]="!submitPipelineForm.valid" mat-button 
mat-raised-button color="primary" (click)="savePipelineName(false)" 
style="margin-right:10px;">
             Save
         </button>
-        <button mat-button mat-raised-button color="primary" 
(click)="savePipelineName(true)" style="margin-right:10px;">
+        <button [disabled]="!submitPipelineForm.valid" mat-button 
mat-raised-button color="primary" (click)="savePipelineName(true)" 
style="margin-right:10px;">
             Save and go to pipeline view
         </button>
         <button mat-button mat-raised-button class="mat-basic" 
(click)="hide()">
diff --git 
a/ui/src/app/editor-v2/dialog/save-pipeline/save-pipeline.component.ts 
b/ui/src/app/editor-v2/dialog/save-pipeline/save-pipeline.component.ts
index 6f4660c..f986694 100644
--- a/ui/src/app/editor-v2/dialog/save-pipeline/save-pipeline.component.ts
+++ b/ui/src/app/editor-v2/dialog/save-pipeline/save-pipeline.component.ts
@@ -23,6 +23,7 @@ import {ObjectProvider} from 
"../../services/object-provider.service";
 import {EditorService} from "../../services/editor.service";
 import {PipelineService} from 
"../../../platform-services/apis/pipeline.service";
 import {ShepherdService} from "../../../services/tour/shepherd.service";
+import {FormControl, FormGroup, Validators} from "@angular/forms";
 
 @Component({
   selector: 'save-pipeline',
@@ -34,7 +35,8 @@ export class SavePipelineComponent implements OnInit {
   pipelineCategories: any;
   startPipelineAfterStorage: any;
   updateMode: any;
-  submitPipelineForm: any;
+
+  submitPipelineForm: FormGroup = new FormGroup({});
   TransitionService: any;
 
   @Input()
@@ -57,6 +59,20 @@ export class SavePipelineComponent implements OnInit {
 
   ngOnInit() {
     this.getPipelineCategories();
+    this.submitPipelineForm.addControl("pipelineName", new 
FormControl(this.pipeline.name,
+        [Validators.required,
+          Validators.maxLength(40)]))
+    this.submitPipelineForm.addControl("pipelineDescription", new 
FormControl(this.pipeline.description,
+        [Validators.maxLength(80)]))
+
+    
this.submitPipelineForm.controls["pipelineName"].valueChanges.subscribe(value 
=> {
+      this.pipeline.name = value;
+    });
+
+    
this.submitPipelineForm.controls["pipelineDescription"].valueChanges.subscribe(value
 => {
+      this.pipeline.description = value;
+    });
+
     if (this.ShepherdService.isTourActive()) {
       this.ShepherdService.trigger("enter-pipeline-name");
     }
@@ -83,8 +99,8 @@ export class SavePipelineComponent implements OnInit {
 
   getPipelineCategories() {
     this.pipelineService.getPipelineCategories().subscribe(pipelineCategories 
=> {
-          this.pipelineCategories = pipelineCategories;
-        });
+      this.pipelineCategories = pipelineCategories;
+    });
   };
 
 
diff --git a/ui/src/app/editor-v2/editor.component.html 
b/ui/src/app/editor-v2/editor.component.html
index 5b9b99d..49a449b 100644
--- a/ui/src/app/editor-v2/editor.component.html
+++ b/ui/src/app/editor-v2/editor.component.html
@@ -20,7 +20,7 @@
     <div fxLayout="row" style="padding:0px;background-color:#f6f6f6;">
         <div fxFlex="100" style="line-height:24px;border-bottom:1px solid 
#ccc">
             <div fxFlex="100" fxLayout="row">
-                <div fxFlex fxLayoutAlign="start center">
+                <div fxFlex fxLayoutAlign="start center" [attr.id]="'peType'">
                     <mat-tab-group [selectedIndex]="selectedIndex" 
(selectedIndexChange)="selectPipelineElements($event)">
                         <mat-tab *ngFor="let tab of tabs" 
label="{{tab.title}}"></mat-tab>
                     </mat-tab-group>
diff --git a/ui/src/app/editor-v2/editor.component.ts 
b/ui/src/app/editor-v2/editor.component.ts
index ec30fa8..efcdd38 100644
--- a/ui/src/app/editor-v2/editor.component.ts
+++ b/ui/src/app/editor-v2/editor.component.ts
@@ -170,6 +170,7 @@ export class EditorComponent implements OnInit {
             .sort((a, b) => {
                 return a.name.localeCompare(b.name);
             });
+        this.shepherdService.trigger("select-" 
+PipelineElementTypeUtils.toCssShortHand(this.activeType));
     }
 
     toggleEditorStand() {
diff --git a/ui/src/app/pipelines/services/pipeline-operations.service.ts 
b/ui/src/app/pipelines/services/pipeline-operations.service.ts
index 74d40be..e01474e 100644
--- a/ui/src/app/pipelines/services/pipeline-operations.service.ts
+++ b/ui/src/app/pipelines/services/pipeline-operations.service.ts
@@ -19,111 +19,110 @@
 import * as angular from 'angular';
 import {PipelineStatusDialogController} from 
"../dialog/pipeline-status-dialog.controller";
 import {DeletePipelineDialogController} from 
"../dialog/delete-pipeline-dialog.controller";
+import {RestApi} from "../../services/rest-api.service";
+import {ShepherdService} from "../../services/tour/shepherd.service";
+import {Inject, Injectable} from "@angular/core";
 
 declare const require: any;
 
+@Injectable()
 export class PipelineOperationsService {
 
-    $mdDialog: any;
-    RestApi: any;
-    $state: any;
-    starting: any;
-    stopping: any;
-    ShepherdService: any;
+  starting: any;
+  stopping: any;
 
-    constructor($mdDialog, RestApi, $state, ShepherdService) {
-        this.$mdDialog = $mdDialog;
-        this.RestApi = RestApi;
-        this.$state = $state;
-        this.ShepherdService = ShepherdService;
-    }
+  constructor(@Inject('$mdDialog') private $mdDialog,
+              @Inject('RestApi') private RestApi: RestApi,
+              @Inject('$state') private $state,
+              @Inject('ShepherdService') private ShepherdService: 
ShepherdService) {
+  }
 
-    startPipeline(pipelineId, toggleRunningOperation, refreshPipelines) {
-        toggleRunningOperation('starting');
-        this.RestApi.startPipeline(pipelineId)
-            .then(msg => {
-                let data = msg.data;
-                this.showDialog(data);
-                refreshPipelines();
-                toggleRunningOperation('starting');
-                if (this.ShepherdService.isTourActive()) {
-                    this.ShepherdService.trigger("pipeline-started");
-                }
-            }, error => {
-                toggleRunningOperation('starting');
-                this.showDialog({
-                    notifications: [{
-                        title: "Network Error",
-                        description: "Please check your Network."
-                    }]
-                });
-            });
-    };
+  startPipeline(pipelineId, toggleRunningOperation, refreshPipelines) {
+    toggleRunningOperation('starting');
+    this.RestApi.startPipeline(pipelineId)
+        .then(msg => {
+          let data = msg.data;
+          this.showDialog(data);
+          refreshPipelines();
+          toggleRunningOperation('starting');
+          if (this.ShepherdService.isTourActive()) {
+            this.ShepherdService.trigger("pipeline-started");
+          }
+        }, error => {
+          toggleRunningOperation('starting');
+          this.showDialog({
+            notifications: [{
+              title: "Network Error",
+              description: "Please check your Network."
+            }]
+          });
+        });
+  };
 
-    stopPipeline(pipelineId, toggleRunningOperation, refreshPipelines) {
-        toggleRunningOperation('stopping');
-        this.RestApi.stopPipeline(pipelineId)
-            .then(msg => {
-                let data = msg.data;
-                toggleRunningOperation('stopping');
-                this.showDialog(data);
-                refreshPipelines();
-            }, error => {
-                toggleRunningOperation('stopping');
-                this.showDialog({
-                    notifications: [{
-                        title: "Network Error",
-                        description: "Please check your Network."
-                    }]
-                });
+  stopPipeline(pipelineId, toggleRunningOperation, refreshPipelines) {
+    toggleRunningOperation('stopping');
+    this.RestApi.stopPipeline(pipelineId)
+        .then(msg => {
+          let data = msg.data;
+          toggleRunningOperation('stopping');
+          this.showDialog(data);
+          refreshPipelines();
+        }, error => {
+          toggleRunningOperation('stopping');
+          this.showDialog({
+            notifications: [{
+              title: "Network Error",
+              description: "Please check your Network."
+            }]
+          });
 
-            });
-    };
+        });
+  };
 
-    showDeleteDialog(pipeline, refreshPipelines) {
-        this.$mdDialog.show({
-            controller: DeletePipelineDialogController,
-            controllerAs: 'ctrl',
-            template: require('../dialog/delete-pipeline-dialog.tmpl.html'),
-            parent: angular.element(document.body),
-            clickOutsideToClose: false,
-            locals: {
-                pipeline: pipeline,
-                refreshPipelines: refreshPipelines
-            },
-            bindToController: true
-        })
-    };
+  showDeleteDialog(pipeline, refreshPipelines) {
+    this.$mdDialog.show({
+      controller: DeletePipelineDialogController,
+      controllerAs: 'ctrl',
+      template: require('../dialog/delete-pipeline-dialog.tmpl.html'),
+      parent: angular.element(document.body),
+      clickOutsideToClose: false,
+      locals: {
+        pipeline: pipeline,
+        refreshPipelines: refreshPipelines
+      },
+      bindToController: true
+    })
+  };
 
-    showDialog(data) {
-        this.$mdDialog.show({
-            controller: PipelineStatusDialogController,
-            controllerAs: 'ctrl',
-            template: require('../dialog/pipeline-status-dialog.tmpl.html'),
-            parent: angular.element(document.body),
-            clickOutsideToClose: false,
-            locals: {
-                data: data
-            },
-            bindToController: true
-        })
-    };
+  showDialog(data) {
+    this.$mdDialog.show({
+      controller: PipelineStatusDialogController,
+      controllerAs: 'ctrl',
+      template: require('../dialog/pipeline-status-dialog.tmpl.html'),
+      parent: angular.element(document.body),
+      clickOutsideToClose: false,
+      locals: {
+        data: data
+      },
+      bindToController: true
+    })
+  };
 
-    showPipelineInEditor(id) {
-        this.$state.go("streampipes.editor", {pipeline: id});
-    }
+  showPipelineInEditor(id) {
+    this.$state.go("streampipes.editor", {pipeline: id});
+  }
 
-    showPipelineDetails(id) {
-        this.$state.go("streampipes.pipelineDetails", {pipeline: id});
-    }
+  showPipelineDetails(id) {
+    this.$state.go("streampipes.pipelineDetails", {pipeline: id});
+  }
 
-    modifyPipeline(pipeline) {
-        this.showPipelineInEditor(pipeline);
-    }
+  modifyPipeline(pipeline) {
+    this.showPipelineInEditor(pipeline);
+  }
 
-    showLogs(id) {
-        this.$state.go("streampipes.pipelinelogs", {pipeline: id});
-    }
+  showLogs(id) {
+    this.$state.go("streampipes.pipelinelogs", {pipeline: id});
+  }
 }
 
 PipelineOperationsService.$inject = ['$mdDialog', 'RestApi', '$state', 
'ShepherdService'];
\ No newline at end of file
diff --git a/ui/src/app/services/tour/create-pipeline-tour.constants.ts 
b/ui/src/app/services/tour/create-pipeline-tour.constants.ts
index 648b4ff..e166f1b 100644
--- a/ui/src/app/services/tour/create-pipeline-tour.constants.ts
+++ b/ui/src/app/services/tour/create-pipeline-tour.constants.ts
@@ -34,7 +34,7 @@ export default {
                 stepId: "step-2",
                 title: "Pipeline Element Selection",
                 text: "<p>Let's start!</p> <p>This is the <b>Pipeline Element 
Selection</b> panel. Here you can select pipeline element types. The current 
panel, data streams, shows a list of currently available streams.</p>",
-                attachToElement: 
"#pe-type>md-tabs-wrapper>md-tabs-canvas>md-pagination-wrapper 
md-tab-item:nth-child(2)",
+                attachToElement: 
"#peType>mat-tab-group>mat-tab-header>div.mat-tab-label-container>div>div>div:nth-child(2)",
                 attachPosition: "bottom",
                 buttons: [
                     "cancel",
@@ -55,7 +55,7 @@ export default {
                 stepId: "step-4",
                 title: "Creating pipelines",
                 text: "<p>Cool!</p> <p>Dragging and dropping elements is the 
basic principle you need to know to create pipelines. You only need to select a 
pipeline element and drop it to the assembly area.</p><p>Click <b>Next</b> to 
continue.</p>",
-                attachToElement: "#assembly>pipeline>div>span:nth-child(1)",
+                attachToElement: "#assembly>pipeline .stream:nth-child(1)",
                 attachPosition: "left",
                 buttons: [
                     "cancel",
@@ -66,7 +66,7 @@ export default {
                 stepId: "step-5",
                 title: "Switching between pipeline element types",
                 text: "No we will add a data processor. Select the data 
processor tab to see a list of currently available processors.",
-                attachToElement: 
"#pe-type>md-tabs-wrapper>md-tabs-canvas>md-pagination-wrapper 
md-tab-item:nth-child(3)",
+                attachToElement: 
"#peType>mat-tab-group>mat-tab-header>div.mat-tab-label-container>div>div>div:nth-child(3)",
                 attachPosition: "bottom",
                 buttons: [
                     "cancel"
@@ -96,8 +96,8 @@ export default {
                 stepId: "step-8",
                 title: "Customize elements",
                 text: "<p>Most pipeline elements can be customized according 
to your needs. Whenever you connect two elements with each other, a 
configuration dialog pops up.</p><p>Select <b>Mass Flow</b> as the field to 
filter, select <b>greater than (>) </b> as operation, select <b>2</b> as the 
threshold value and click <b>Save</b>.</p>",
-                attachToElement: "#tutorial-placeholder",
-                attachPosition: "top",
+                attachToElement: "div .dialog-panel-content",
+                attachPosition: "right",
                 buttons: [
                     "cancel"
                 ]
@@ -106,7 +106,7 @@ export default {
                 stepId: "step-9",
                 title: "Selecting data sinks",
                 text: "<p>What's missing?</p><p>Every pipeline needs a data 
sink. Sinks define what to do with the output of your pipeline and can be 
visualizations, notifications, or can trigger third party components or even 
actuators.</p><p>Click the tab above to see available data sinks.</p>",
-                attachToElement: 
"#pe-type>md-tabs-wrapper>md-tabs-canvas>md-pagination-wrapper 
md-tab-item:nth-child(4)",
+                attachToElement: 
"#peType>mat-tab-group>mat-tab-header>div.mat-tab-label-container>div>div>div:nth-child(4)",
                 attachPosition: "bottom",
                 buttons: [
                     "cancel"
@@ -136,8 +136,8 @@ export default {
                 stepId: "step-12",
                 title: "Enter pipeline name",
                 text: "<p>Enter a name and an optional description of your 
pipeline.</p><p>Afterwards, make sure that <b>Start pipeline immediately</b> is 
checked.</p>",
-                attachToElement: '[name^="pipelineName"]',
-                attachPosition: "left",
+                attachToElement: 'div .dialog-panel-content',
+                attachPosition: "right",
                 buttons: [
                     "cancel"
                 ]
@@ -146,8 +146,8 @@ export default {
                 stepId: "step-13",
                 title: "Save Pipeline Dialog",
                 text: "<p>Click on <b>Save and go to pipeline view</b> to 
start the pipeline.</p>",
-                attachToElement: 
"md-dialog>md-dialog-actions>button:nth-of-type(3)",
-                attachPosition: "bottom",
+                attachToElement: "save-pipeline 
.sp-dialog-actions>button:nth-of-type(2)",
+                attachPosition: "top",
                 buttons: [
                     "cancel"
                 ]
diff --git a/ui/src/app/services/tour/shepherd.service.ts 
b/ui/src/app/services/tour/shepherd.service.ts
index 62edc53..a310677 100644
--- a/ui/src/app/services/tour/shepherd.service.ts
+++ b/ui/src/app/services/tour/shepherd.service.ts
@@ -30,7 +30,9 @@ export class ShepherdService {
     currentTourSettings: any;
     timeWaitMillis: number;
 
-    constructor(@Inject('$timeout') $timeout, @Inject('$state') $state, 
@Inject('TourProviderService') TourProviderService) {
+    constructor(@Inject('$timeout') $timeout,
+                @Inject('$state') $state,
+                @Inject('TourProviderService') TourProviderService) {
         this.$timeout = $timeout;
         this.$state = $state;
         this.TourProviderService = TourProviderService;

Reply via email to