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/12 08:22:13 UTC

[incubator-streampipes] 01/02: [STREAMPIPES-145] Migrate pipeline validation handling

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 a0116357615b74fd3a4e4d42d0c2cc0a91b2f464
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Thu Jun 11 16:05:30 2020 +0200

    [STREAMPIPES-145] Migrate pipeline validation handling
---
 ui/src/app/NS/XS.service.ts                                   |  2 +-
 .../connect/static-properties/static-property.component.html  |  1 +
 .../pipeline-assembly/pipeline-assembly.component.html        |  2 +-
 .../app/editor-v2/components/pipeline/pipeline.component.html |  2 +-
 .../app/editor-v2/components/pipeline/pipeline.component.ts   | 11 +++--------
 ui/src/app/editor-v2/dialog/customize/customize.component.ts  |  3 ++-
 ui/src/app/editor-v2/model/editor.model.ts                    |  3 ++-
 ui/src/app/editor-v2/services/jsplumb.service.ts              |  1 +
 ui/src/app/editor-v2/services/pipeline-validation.service.ts  |  4 +++-
 9 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/ui/src/app/NS/XS.service.ts b/ui/src/app/NS/XS.service.ts
index e5bbd1e..6323702 100644
--- a/ui/src/app/NS/XS.service.ts
+++ b/ui/src/app/NS/XS.service.ts
@@ -23,7 +23,7 @@ export class xsService {
 
   XS_STRING: string = "xs:string";
   XS_INTEGER: string = "http://www.w3.org/2001/XMLSchema#integer";
-  XS_DOUBLE: string = "http://www.w3.org/2001/XMLSchema#:double";
+  XS_DOUBLE: string = "http://www.w3.org/2001/XMLSchema#double";
   XS_BOOLEAN: string = "http://www.w3.org/2001/XMLSchema#boolean";
   XS_NUMBER: string = "http://www.w3.org/2001/XMLSchema#number";
   XS_STRING1: string = "http://www.w3.org/2001/XMLSchema#string";
diff --git a/ui/src/app/connect/static-properties/static-property.component.html b/ui/src/app/connect/static-properties/static-property.component.html
index b069b61..2fde087 100644
--- a/ui/src/app/connect/static-properties/static-property.component.html
+++ b/ui/src/app/connect/static-properties/static-property.component.html
@@ -85,4 +85,5 @@
 </app-static-collection>
 <mat-divider></mat-divider>
 
+{{staticProperty.internalName}}
 
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 5680b95..a3fa2b6 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
@@ -21,7 +21,7 @@
         <div fxFlex="100" fxLayout="row" fxLayoutAlign="start center">
             <button mat-button matTooltip="Save Pipeline" [matTooltipPosition]="'above'"
                     style="display:flex;align-items:center;" class="md-button settings-bar-icon-button"
-                    [disabled]="!pipelineValid"
+                    [disabled]="!PipelineValidationService.pipelineValid"
                     (click)="submit()" type="submit">
                 <mat-icon>save</mat-icon>&nbsp;Save pipeline
             </button>
diff --git a/ui/src/app/editor-v2/components/pipeline/pipeline.component.html b/ui/src/app/editor-v2/components/pipeline/pipeline.component.html
index ccf4572..fbcd494 100644
--- a/ui/src/app/editor-v2/components/pipeline/pipeline.component.html
+++ b/ui/src/app/editor-v2/components/pipeline/pipeline.component.html
@@ -26,7 +26,7 @@
                  <mat-spinner [mode]="'indeterminate'" class="pipeline-element-progress" [diameter]="40"></mat-spinner>
             </div>
             <div class="pipeline-element-loading-container sp-fade-opacity" *ngIf="pipelineElement.settings.loadingStatus"></div>
-            <div class="pipeline-element-configuration-invalid {{pipelineElement.type === 'stream' ? 'pi-stream' : 'pi-processor'}}" *ngIf="pipelineElement.payload.uncompleted">
+            <div class="pipeline-element-configuration-invalid {{pipelineElement.type === 'stream' ? 'pi-stream' : 'pi-processor'}}" *ngIf="!pipelineElement.settings.completed">
                 <i class="material-icons pipeline-element-configuration-invalid-icon">
                 warning
                 </i>
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 a0dbc2c..be758e7 100644
--- a/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
+++ b/ui/src/app/editor-v2/components/pipeline/pipeline.component.ts
@@ -110,6 +110,8 @@ export class PipelineComponent implements OnInit {
   validatePipeline() {
     //this.$timeout(() => {
       this.pipelineValid = this.PipelineValidationService.isValidPipeline(this.rawPipelineModel);
+      console.log("validating");
+      console.log(this.pipelineValid);
     //}, 200);
   }
 
@@ -361,15 +363,8 @@ export class PipelineComponent implements OnInit {
     });
 
     dialogRef.afterClosed().subscribe(c => {
-      console.log("after close");
+      this.JsplumbService.activateEndpoint(pipelineElement.payload.dom, pipelineElement.settings.completed)
     });
-
-    // this.EditorDialogManager.showCustomizeDialog($("#" +pe.payload.dom), sourceEndpoint, pe.payload, false)
-    //     .then(() => {
-    //       this.JsplumbService.activateEndpoint(pe.payload.dom, !payload.uncompleted);
-    //     }, () => {
-    //       this.JsplumbService.activateEndpoint(pe.payload.dom, !payload.uncompleted);
-    //     });
   }
 
 
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 788d35e..d6b44e4 100644
--- a/ui/src/app/editor-v2/dialog/customize/customize.component.ts
+++ b/ui/src/app/editor-v2/dialog/customize/customize.component.ts
@@ -75,11 +75,12 @@ export class CustomizeComponent implements OnInit {
 
   save() {
     this.pipelineElement.payload = this.cachedPipelineElement;
+    this.pipelineElement.settings.completed = true;
+    this.pipelineElement.payload.configured = true;
     this.dialogRef.close(this.pipelineElement);
   }
 
   validConfiguration(event: any) {
-
   }
 
 }
\ No newline at end of file
diff --git a/ui/src/app/editor-v2/model/editor.model.ts b/ui/src/app/editor-v2/model/editor.model.ts
index d09d2d6..8f336ea 100644
--- a/ui/src/app/editor-v2/model/editor.model.ts
+++ b/ui/src/app/editor-v2/model/editor.model.ts
@@ -36,7 +36,8 @@ export interface PipelineElementConfig {
     displaySettings: string,
     connectable: string,
     disabled: boolean,
-    loadingStatus: boolean
+    loadingStatus: boolean,
+    completed: boolean
     position: {
       x: number,
       y: number
diff --git a/ui/src/app/editor-v2/services/jsplumb.service.ts b/ui/src/app/editor-v2/services/jsplumb.service.ts
index 2c773e5..2efb534 100644
--- a/ui/src/app/editor-v2/services/jsplumb.service.ts
+++ b/ui/src/app/editor-v2/services/jsplumb.service.ts
@@ -156,6 +156,7 @@ export class JsplumbService {
         pipelineElementConfig.settings = {connectable: connectable,
             openCustomize: !(pipelineElement as any).configured,
             preview: isPreview,
+            completed: (pipelineElement instanceof SpDataStream || isPreview),
             disabled: false,
             loadingStatus: false,
             displaySettings: displaySettings,
diff --git a/ui/src/app/editor-v2/services/pipeline-validation.service.ts b/ui/src/app/editor-v2/services/pipeline-validation.service.ts
index 59901c5..ea335e9 100644
--- a/ui/src/app/editor-v2/services/pipeline-validation.service.ts
+++ b/ui/src/app/editor-v2/services/pipeline-validation.service.ts
@@ -26,6 +26,7 @@ import {PipelineElementConfig} from "../model/editor.model";
 export class PipelineValidationService {
 
     errorMessages: any = [];
+    pipelineValid: boolean = false;
 
     availableErrorMessages: any = [
         {title: "Did you add a data stream?", content: "Any pipeline needs at least one data stream."},
@@ -58,7 +59,8 @@ export class PipelineValidationService {
             this.errorMessages = [];
         }
 
-        return streamInAssembly && actionInAssembly && allElementsConnected && onlyOnePipelineCreated;
+        this.pipelineValid = streamInAssembly && actionInAssembly && allElementsConnected && onlyOnePipelineCreated;
+        return this.pipelineValid;
     }
 
     isEmptyPipeline(rawPipelineModel) {