You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/09/02 17:50:00 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-219] Refresh button in Data Explorer is not working

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

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


The following commit(s) were added to refs/heads/dev by this push:
     new 026764b  [STREAMPIPES-219] Refresh button in Data Explorer is not working
026764b is described below

commit 026764bf9abc16f6cbc908422c26dd90943f435e
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Wed Sep 2 19:48:59 2020 +0200

    [STREAMPIPES-219] Refresh button in Data Explorer is not working
---
 .../components/time-selector/timeRangeSelector.component.html    | 6 +-----
 .../components/time-selector/timeRangeSelector.component.ts      | 9 +++++++++
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.html b/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.html
index 9d9375d..b106f37 100644
--- a/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.html
+++ b/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.html
@@ -17,10 +17,6 @@
   -->
 
 <div fxLayout="row" fxLayoutAlign="start center">
-<!--    <Button (click)="decreaseTime()"><</Button>-->
-
-<!--    <Button (click)="increaseTime()">></Button>-->
-<!--    &nbsp;-->
     <div class="time-range-wrapper" fxFlex fxLayoutAlign="center center">
     <button mat-button mat-raised-button
             *ngFor="let item of possibleTimeButtons"
@@ -58,7 +54,7 @@
         <button mat-button mat-raised-button color="primary"
                 class="button-margin smaller-button-font-size"
                 matTooltip="Reload" matTooltipPosition="above">
-            <mat-icon (click)="reloadData()">autorenew</mat-icon>
+            <mat-icon (click)="refreshData()">autorenew</mat-icon>
         </button>
     </div>
 </div>
diff --git a/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.ts b/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.ts
index e94f983..3cecb14 100644
--- a/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.ts
+++ b/ui/src/app/data-explorer/components/time-selector/timeRangeSelector.component.ts
@@ -64,6 +64,15 @@ export class TimeRangeSelectorComponent implements OnInit {
     this.changeTimeByInterval((a, b) => a - b);
   }
 
+  refreshData() {
+    const difference = this.dateRange.endDate.getTime() - this.dateRange.startDate.getTime();
+
+    const current = new Date();
+    this.dateRange = new DateRange(new Date(current.getTime() - difference), current);
+
+    this.reloadData();
+  }
+
   private  changeTimeByInterval(func) {
     const difference = this.dateRange.endDate.getTime() - this.dateRange.startDate.getTime();
     const newStartTime = new Date(func(this.dateRange.startDate.getTime(), difference));