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

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


The following commit(s) were added to refs/heads/edge-extensions by this push:
     new dfbea97  Update Pipeline Status Dialog for multiple edge nodes and 
migration
dfbea97 is described below

commit dfbea97eaa3fdf3fd668815eb26f870ea882c364
Author: Daniel Gomm <[email protected]>
AuthorDate: Fri Feb 26 11:15:48 2021 +0100

    Update Pipeline Status Dialog for multiple edge nodes and migration
---
 .../model/pipeline/PipelineElementStatus.java      | 17 +++++++++++++
 .../manager/execution/http/HttpRequestBuilder.java | 23 ++++++++++++-----
 ui/src/app/core-model/gen/streampipes-model.ts     | 12 ++++++---
 .../pipeline-status-dialog.component.html          | 29 ++++++++++++++--------
 .../pipeline-status-dialog.component.scss          | 16 ++++++++++++
 .../pipeline-status-dialog.component.ts            | 27 +++++++++++++++++++-
 6 files changed, 102 insertions(+), 22 deletions(-)

diff --git 
a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementStatus.java
 
b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementStatus.java
index 2b16a34..7e7274b 100644
--- 
a/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementStatus.java
+++ 
b/streampipes-model/src/main/java/org/apache/streampipes/model/pipeline/PipelineElementStatus.java
@@ -23,6 +23,8 @@ public class PipelineElementStatus {
        private String elementId;
        private String elementName;
        private String optionalMessage;
+       private String operation;
+       private String elementNode;
        
        private boolean success;
 
@@ -68,4 +70,19 @@ public class PipelineElementStatus {
        public void setSuccess(boolean success) {
                this.success = success;
        }
+       public String getOperation() {
+               return operation;
+       }
+
+       public void setOperation(String operation) {
+               this.operation = operation;
+       }
+
+       public String getElementNode() {
+               return elementNode;
+       }
+
+       public void setElementNode(String elementNode) {
+               this.elementNode = elementNode;
+       }
 }
diff --git 
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/execution/http/HttpRequestBuilder.java
 
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/execution/http/HttpRequestBuilder.java
index 35509cb..7097577 100644
--- 
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/execution/http/HttpRequestBuilder.java
+++ 
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/execution/http/HttpRequestBuilder.java
@@ -25,6 +25,7 @@ import org.apache.http.client.fluent.Request;
 import org.apache.http.client.fluent.Response;
 import org.apache.http.entity.ContentType;
 import org.apache.streampipes.commons.Utils;
+import org.apache.streampipes.model.SpDataStreamRelayContainer;
 import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
 import org.apache.streampipes.model.base.NamedStreamPipesEntity;
 import org.apache.streampipes.model.pipeline.PipelineElementStatus;
@@ -62,7 +63,7 @@ public class HttpRequestBuilder {
               .bodyString(json, ContentType.APPLICATION_JSON)
               .connectTimeout(CONNECT_TIMEOUT)
               .execute();
-      return handleResponse(httpResp);
+      return handleResponse(httpResp, "invoke");
     } catch (Exception e) {
       LOG.error(e.getMessage());
       return new PipelineElementStatus(endpointUrl, payload.getName(), false, 
e.getMessage());
@@ -80,23 +81,33 @@ public class HttpRequestBuilder {
               .Delete(endpointUrl)
               .connectTimeout(CONNECT_TIMEOUT)
               .execute();
-      return handleResponse(httpResp);
+      return handleResponse(httpResp, "detach");
     } catch (Exception e) {
       LOG.error("Could not stop pipeline " + endpointUrl, e.getMessage());
       return new PipelineElementStatus(endpointUrl, payload.getName(), false, 
e.getMessage());
     }
   }
 
-  private PipelineElementStatus handleResponse(Response httpResp) throws 
JsonSyntaxException, IOException {
+  private PipelineElementStatus handleResponse(Response httpResp, String 
action) throws JsonSyntaxException, IOException {
     String resp = httpResp.returnContent().asString();
     org.apache.streampipes.model.Response streamPipesResp = JacksonSerializer
             .getObjectMapper()
             .readValue(resp, org.apache.streampipes.model.Response.class);
-    return convert(streamPipesResp);
+    return convert(streamPipesResp, action);
   }
 
-  private PipelineElementStatus convert(org.apache.streampipes.model.Response 
response) {
-    return new PipelineElementStatus(endpointUrl, payload.getName(), 
response.isSuccess(), response.getOptionalMessage());
+  private PipelineElementStatus convert(org.apache.streampipes.model.Response 
response, String action) {
+    PipelineElementStatus status = new PipelineElementStatus(endpointUrl, 
payload.getName(), response.isSuccess(),
+            response.getOptionalMessage());
+    if(payload instanceof InvocableStreamPipesEntity){
+      
status.setElementNode(((InvocableStreamPipesEntity)payload).getDeploymentTargetNodeId());
+      status.setOperation(action);
+    }
+    else if(payload instanceof SpDataStreamRelayContainer){
+      
status.setElementNode(((SpDataStreamRelayContainer)payload).getDeploymentTargetNodeId());
+      status.setOperation(action + " relay");
+    }
+    return status;
   }
 
   private String toJson() throws Exception {
diff --git a/ui/src/app/core-model/gen/streampipes-model.ts 
b/ui/src/app/core-model/gen/streampipes-model.ts
index 2bdc014..f34d68a 100644
--- a/ui/src/app/core-model/gen/streampipes-model.ts
+++ b/ui/src/app/core-model/gen/streampipes-model.ts
@@ -19,7 +19,7 @@
 /* tslint:disable */
 /* eslint-disable */
 // @ts-nocheck
-// Generated using typescript-generator version 2.27.744 on 2021-02-17 
10:58:49.
+// Generated using typescript-generator version 2.27.744 on 2021-02-23 
09:17:52.
 
 export class AbstractStreamPipesEntity {
     "@class": "org.apache.streampipes.model.base.AbstractStreamPipesEntity" | 
"org.apache.streampipes.model.base.NamedStreamPipesEntity" | 
"org.apache.streampipes.model.connect.adapter.AdapterDescription" | 
"org.apache.streampipes.model.connect.adapter.AdapterSetDescription" | 
"org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription" | 
"org.apache.streampipes.model.connect.adapter.SpecificAdapterSetDescription" | 
"org.apache.streampipes.model.connect.adapter.AdapterStre [...]
@@ -151,8 +151,8 @@ export class NamedStreamPipesEntity extends 
AbstractStreamPipesEntity {
         instance.applicationLinks = 
__getCopyArrayFn(ApplicationLink.fromData)(data.applicationLinks);
         instance.internallyManaged = data.internallyManaged;
         instance.connectedTo = 
__getCopyArrayFn(__identity<string>())(data.connectedTo);
-        instance.uri = data.uri;
         instance.dom = data.dom;
+        instance.uri = data.uri;
         return instance;
     }
 }
@@ -1824,8 +1824,8 @@ export class GenericAdapterSetDescription extends 
AdapterSetDescription implemen
         }
         const instance = target || new GenericAdapterSetDescription();
         super.fromData(data, instance);
-        instance.protocolDescription = 
ProtocolDescription.fromData(data.protocolDescription);
         instance.formatDescription = 
FormatDescription.fromData(data.formatDescription);
+        instance.protocolDescription = 
ProtocolDescription.fromData(data.protocolDescription);
         instance.eventSchema = EventSchema.fromData(data.eventSchema);
         return instance;
     }
@@ -1843,8 +1843,8 @@ export class GenericAdapterStreamDescription extends 
AdapterStreamDescription im
         }
         const instance = target || new GenericAdapterStreamDescription();
         super.fromData(data, instance);
-        instance.protocolDescription = 
ProtocolDescription.fromData(data.protocolDescription);
         instance.formatDescription = 
FormatDescription.fromData(data.formatDescription);
+        instance.protocolDescription = 
ProtocolDescription.fromData(data.protocolDescription);
         instance.eventSchema = EventSchema.fromData(data.eventSchema);
         return instance;
     }
@@ -2526,6 +2526,8 @@ export class PipelineElementRecommendationMessage {
 export class PipelineElementStatus {
     elementId: string;
     elementName: string;
+    elementNode: string;
+    operation: string;
     optionalMessage: string;
     success: boolean;
 
@@ -2537,6 +2539,8 @@ export class PipelineElementStatus {
         instance.elementId = data.elementId;
         instance.elementName = data.elementName;
         instance.optionalMessage = data.optionalMessage;
+        instance.operation = data.operation;
+        instance.elementNode = data.elementNode;
         instance.success = data.success;
         return instance;
     }
diff --git 
a/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.html
 
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.html
index 2ef39f5..48d2340 100644
--- 
a/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.html
+++ 
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.html
@@ -31,19 +31,26 @@
             </button>
 
             <div fxLayout="column" *ngIf="statusDetailsVisible">
-                <div fxFlex="100" fxLayout="column" class="md-whiteframe-z2" 
*ngFor="let msg of pipelineOperationStatus.elementStatus">
-                    <div fxFlex="100" fxLayout="column" class="md-padding">
-                        <div>
-                            <b>{{msg.elementName}} </b> at URL <b> 
{{msg.elementId}}</b>
-                            <mat-icon color="accent" 
*ngIf="msg.success">done</mat-icon>
-                            <mat-icon color="accent" 
*ngIf="!msg.success">warning</mat-icon>
-                        </div>
-                        <div>
-                            <div fxFlex="100" fxLayout="column" 
*ngIf="msg.optionalMessage">
-                                <div class="error-message">
-                                    {{msg.optionalMessage}}
+                <div fxFlex="100" fxLayout="column" class="md-whiteframe-z2" 
*ngFor="let statList of elementStati">
+                    <hr />
+                    <div fxFlex="100" fxLayout="column" class="node-title">
+                        <b>Node: {{statList[0].elementNode}}</b>
+                    </div>
+                    <div *ngFor="let msg of statList">
+                        <div fxFlex="100" fxLayout="column" class="md-padding">
+                            <div>
+                                <b>{{msg.operation}}<br>{{msg.elementName}} 
</b> at URL <b> {{msg.elementId}}</b>
+                                <mat-icon color="accent" 
*ngIf="msg.success">done</mat-icon>
+                                <mat-icon color="accent" 
*ngIf="!msg.success">warning</mat-icon>
+                            </div>
+                            <div>
+                                <div fxFlex="100" fxLayout="column" 
*ngIf="msg.optionalMessage">
+                                    <div class="error-message">
+                                        {{msg.optionalMessage}}
+                                    </div>
                                 </div>
                             </div>
+                            <div class="operation-separator" 
*ngIf="statList.indexOf(msg) != statList.length-1"></div>
                         </div>
                     </div>
                 </div>
diff --git 
a/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.scss
 
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.scss
index e11debc..4630f82 100644
--- 
a/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.scss
+++ 
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.scss
@@ -28,4 +28,20 @@
   color: white;
   padding: 10px;
   width: 100%;
+}
+
+.node-title{
+  font-size: larger;
+  color: $sp-color-accent;
+}
+
+.operation-separator {
+  width:100%;
+  height:1px;
+  background: $sp-color-accent-light-blue }
+
+hr {
+  width: 100%;
+  height: 2px;
+  background: $sp-color-accent;
 }
\ No newline at end of file
diff --git 
a/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.ts
 
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.ts
index cd5d103..4014443 100644
--- 
a/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.ts
+++ 
b/ui/src/app/pipelines/dialog/pipeline-status/pipeline-status-dialog.component.ts
@@ -17,7 +17,7 @@
  */
 
 import {DialogRef} from "../../../core-ui/dialog/base-dialog/dialog-ref";
-import {PipelineOperationStatus} from 
"../../../core-model/gen/streampipes-model";
+import {PipelineElementStatus, PipelineOperationStatus} from 
"../../../core-model/gen/streampipes-model";
 import {Component, Input} from "@angular/core";
 
 
@@ -29,12 +29,37 @@ import {Component, Input} from "@angular/core";
 export class PipelineStatusDialogComponent {
 
     statusDetailsVisible: any;
+    elementStati : [[PipelineElementStatus]];
 
     @Input()
     pipelineOperationStatus: PipelineOperationStatus;
 
     constructor(private DialogRef: DialogRef<PipelineStatusDialogComponent>) {
         this.statusDetailsVisible = false;
+        this.elementStati = [];
+    }
+
+    ngOnInit(){
+        console.log(this.pipelineOperationStatus.elementStatus)
+        let nodes: [String];
+        nodes = [];
+        this.pipelineOperationStatus.elementStatus.forEach(stat => {
+            if (!nodes.includes(stat.elementNode)){
+                nodes.push(stat.elementNode)
+            }
+        })
+        console.log(nodes)
+        nodes.forEach(node =>{
+            let nodeStati : [PipelineElementStatus];
+            nodeStati = [];
+            this.pipelineOperationStatus.elementStatus.forEach(stat =>{
+                if(stat.elementNode == node){
+                    nodeStati.push(stat);
+                }
+            })
+            this.elementStati.push(nodeStati);
+        })
+        console.log(this.elementStati)
     }
 
     close() {

Reply via email to