You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by eb...@apache.org on 2020/05/25 09:33:46 UTC

[incubator-streampipes] branch dev updated (218ab75 -> 28daf81)

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

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


 discard 218ab75  Update timing of label saving to database (timeseries labeling tool)
     new 28daf81  Update timing of saving labels in database (timeseries labeling tool)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (218ab75)
            \
             N -- N -- N   refs/heads/dev (28daf81)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[incubator-streampipes] 01/01: Update timing of saving labels in database (timeseries labeling tool)

Posted by eb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 28daf8135f793672263823eea651bf64ca83d859
Author: Daniel Ebi <eb...@fzi.de>
AuthorDate: Mon May 25 11:30:18 2020 +0200

    Update timing of saving labels in database (timeseries labeling tool)
---
 .../line-chart/line-chart-widget.component.ts      | 55 ++++------------------
 1 file changed, 10 insertions(+), 45 deletions(-)

diff --git a/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.ts b/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.ts
index ed6faf3..e433508 100644
--- a/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.ts
+++ b/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.ts
@@ -51,10 +51,7 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget implements
 
   // indicator variable if labeling mode is activated
   private labelingModeOn = false;
-
-  // indicator variable if labels has been changed
-  private changedLabels = false;
-
+  
   private dialogReference = undefined;
 
   updatemenus = [
@@ -323,7 +320,8 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget implements
               }
             }
             this.data['labels'] = this.data[0]['customdata'];
-            this.setChangedLabels(true);
+            // saving labels persistently
+            this.saveLabelsInDatabase(result, this.selectedStartX, this.selectedEndX);
 
             // adding coloured shape (based on selected label) to graph (equals selected time interval)
             this.addShapeToGraph(this.selectedStartX, this.selectedEndX, this.colorService.getColor(result));
@@ -416,42 +414,17 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget implements
 
     // changing dragmode to 'zoom'
     this.graph.layout.dragmode = 'zoom';
-
-    // saving labels persistently
-    if (this.getChangedLabels()) {
-      this.saveLabelsInDatabase();
-    }
+    
   }
 
-  private saveLabelsInDatabase() {
-    let currentLabel = undefined;
-    let indices = [];
-    for (const label in this.data['labels']) {
-      if (currentLabel !== this.data['labels'][label] && indices.length > 0) {
-        const startdate = new Date(this.data[0]['x'][indices[0]]).getTime() - 1;
-        const enddate = new Date(this.data[0]['x'][indices[indices.length - 1]]).getTime() + 1;
-        this.dataLakeRestService.saveLabelsInDatabase(this.data['measureName'], startdate, enddate, currentLabel).subscribe(
+  private saveLabelsInDatabase(label, start_X, end_X) {
+    const startdate = new Date(start_X).getTime() - 1;
+    const enddate = new Date(end_X).getTime() + 1;
+    this.dataLakeRestService.saveLabelsInDatabase(this.data['measureName'], startdate, enddate, label).subscribe(
             res => {
               // console.log('Successfully wrote label ' + currentLabel + ' into database.');
             }
-        );
-        currentLabel = undefined;
-        indices = [];
-        indices.push(label);
-      } else {
-        indices.push(label);
-      }
-
-      currentLabel = this.data['labels'][label];
-    }
-    const last_startdate = new Date(this.data[0]['x'][indices[0]]).getTime() - 1;
-    const last_enddate = new Date(this.data[0]['x'][indices[indices.length - 1]]).getTime() + 1;
-    this.dataLakeRestService.saveLabelsInDatabase(this.data['measureName'], last_startdate, last_enddate, currentLabel).subscribe(
-        res => {
-          // console.log('Successfully wrote label ' + currentLabel + ' in last iteration into database.');
-        });
-    this.setChangedLabels(false);
-
+            );
   }
 
   private addInitialColouredShapesToGraph() {
@@ -510,15 +483,7 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget implements
     };
     this.graph.layout.shapes.push(shape);
   }
-
-  public setChangedLabels(state: boolean) {
-    this.changedLabels = state;
-  }
-
-  public getChangedLabels() {
-    return this.changedLabels;
-  }
-
+  
   setStartX(startX: string) {
     this.selectedStartX = startX;
   }