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 2021/08/10 15:21:02 UTC

[incubator-streampipes] branch STREAMPIPES-319 updated: [STREAMPIPES-401] Use default time range in time selector

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

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


The following commit(s) were added to refs/heads/STREAMPIPES-319 by this push:
     new 262bbd9  [STREAMPIPES-401] Use default time range in time selector
262bbd9 is described below

commit 262bbd9bd7762e4fb4f5826c77ade792af38cb51
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Tue Aug 10 17:20:48 2021 +0200

    [STREAMPIPES-401] Use default time range in time selector
---
 .../time-selector/timeRangeSelector.component.ts           | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

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 0524824..1c509d6 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
@@ -16,8 +16,8 @@
  *
  */
 
-import {Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation} from '@angular/core';
-import {TimeSettings} from "../../../dashboard/models/dashboard.model";
+import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
+import { TimeSettings } from '../../../dashboard/models/dashboard.model';
 
 @Component({
   selector: 'sp-time-range-selector',
@@ -57,7 +57,7 @@ export class TimeRangeSelectorComponent implements OnInit {
   }
 
   findOffset(dynamicSelection: number) {
-    return this.possibleTimeButtons.find(el => el.offset === dynamicSelection);
+    return this.possibleTimeButtons.find(el => el.offset === dynamicSelection) || this.possibleTimeButtons[0];
   }
 
   reloadData() {
@@ -76,7 +76,7 @@ export class TimeRangeSelectorComponent implements OnInit {
     const difference = this.endDate.getTime() - this.startDate.getTime();
 
     const current = new Date().getTime();
-    this.dateRange = { startTime: current - difference, endTime: current, dynamicSelection: -1} as TimeSettings;
+    this.dateRange = { startTime: current - difference, endTime: current, dynamicSelection: -1 };
 
     this.reloadData();
   }
@@ -88,7 +88,7 @@ export class TimeRangeSelectorComponent implements OnInit {
 
     this.startDate = new Date(newStartTime);
     this.endDate = new Date(newEndTime);
-    this.dateRange = { startTime: newStartTime, endTime: newEndTime, dynamicSelection: -1} as TimeSettings;
+    this.dateRange = { startTime: newStartTime, endTime: newEndTime, dynamicSelection: -1 };
     this.selectedTimeButton =  this.possibleTimeButtons[this.possibleTimeButtons.length - 1];
     this.reloadData();
   }
@@ -98,7 +98,7 @@ export class TimeRangeSelectorComponent implements OnInit {
     const newStartTime = this.startDate.getTime();
     const newEndTime = this.endDate.getTime();
 
-    this.dateRange = { startTime: newStartTime, endTime: newEndTime, dynamicSelection: -1} as TimeSettings;
+    this.dateRange = { startTime: newStartTime, endTime: newEndTime, dynamicSelection: -1 };
     this.reloadData();
   }
 
@@ -111,7 +111,7 @@ export class TimeRangeSelectorComponent implements OnInit {
     const current = new Date().getTime();
     this.startDate = new Date(current - item.offset * 60000);
     this.endDate = new Date(current);
-    this.dateRange = {startTime: current - item.offset * 60000, endTime: current, dynamicSelection: item.offset};
+    this.dateRange = { startTime: current - item.offset * 60000, endTime: current, dynamicSelection: item.offset };
     this.reloadData();
   }