You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ji...@apache.org on 2019/03/18 18:39:28 UTC

[incubator-pinot] branch master updated: [TE] frontend - harleyjj/home - set default date picker to yesterday (#3976)

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

jihao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 636c6c1  [TE] frontend - harleyjj/home - set default date picker to yesterday (#3976)
636c6c1 is described below

commit 636c6c1c93a485cddc9f804ee471f22029f447d3
Author: Harley Jackson <ha...@gmail.com>
AuthorDate: Mon Mar 18 11:39:23 2019 -0700

    [TE] frontend - harleyjj/home - set default date picker to yesterday (#3976)
    
    Sets default date/time range on home page to be yesterday, to promote consistency of data from 0:00 to 0:00
    
    Cleans up some eslint warnings
---
 thirdeye/thirdeye-frontend/app/pods/home/index/controller.js |  8 +++-----
 thirdeye/thirdeye-frontend/app/pods/home/index/route.js      | 12 ++++--------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/thirdeye/thirdeye-frontend/app/pods/home/index/controller.js b/thirdeye/thirdeye-frontend/app/pods/home/index/controller.js
index 256eea3..ec1543e 100644
--- a/thirdeye/thirdeye-frontend/app/pods/home/index/controller.js
+++ b/thirdeye/thirdeye-frontend/app/pods/home/index/controller.js
@@ -9,7 +9,7 @@ import * as anomalyUtil from 'thirdeye-frontend/utils/anomaly';
 import { inject as service } from '@ember/service';
 
 const TIME_PICKER_INCREMENT = 5; // tells date picker hours field how granularly to display time
-const DEFAULT_ACTIVE_DURATION = '1d'; // setting this date range selection as default (Last 24 Hours)
+const DEFAULT_ACTIVE_DURATION = 'today'; // setting this date range selection default as Today
 const UI_DATE_FORMAT = 'MMM D, YYYY hh:mm a'; // format for date picker to use (usually varies by route or metric)
 const DISPLAY_DATE_FORMAT = 'YYYY-MM-DD HH:mm'; // format used consistently across app to display custom date range
 const TIME_RANGE_OPTIONS = ['today', '1d', '2d', '1w'];
@@ -44,8 +44,6 @@ export default Controller.extend({
   sortedApplications: computed(
     'model.applications',
     function() {
-      let model = get(this, 'model');
-
       // Iterate through each anomaly
       let applications =  this.get('store').peekAll('application').sortBy('application');
       return applications;
@@ -92,9 +90,9 @@ export default Controller.extend({
       const endDate = Number(get(this, 'model.endDate'));
       const duration = get(this, 'model.duration') || DEFAULT_ACTIVE_DURATION;
       const predefinedRanges = {
-        'Today': [moment().startOf('day'), moment()],
+        'Today': [moment().startOf('day'), moment().startOf('day').add(1, 'day')],
         'Last 24 hours': [moment().subtract(1, 'day'), moment()],
-        'Yesterday': [moment().subtract(1, 'day').startOf('day'), moment().subtract(1, 'days').endOf('day')],
+        'Yesterday': [moment().subtract(1, 'day').startOf('day'), moment().startOf('day')],
         'Last Week': [moment().subtract(1, 'week'), moment()]
       };
 
diff --git a/thirdeye/thirdeye-frontend/app/pods/home/index/route.js b/thirdeye/thirdeye-frontend/app/pods/home/index/route.js
index a62b12e..86e70e2 100644
--- a/thirdeye/thirdeye-frontend/app/pods/home/index/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/home/index/route.js
@@ -1,14 +1,10 @@
 import Route from '@ember/routing/route';
 import columns from 'thirdeye-frontend/shared/anomaliesTableColumns';
-import fetch from 'fetch';
 import { hash } from 'rsvp';
-import { selfServeApiCommon } from 'thirdeye-frontend/utils/api/self-serve';
-import { setProperties } from '@ember/object';
 import { task } from 'ember-concurrency';
 import RSVP from "rsvp";
 import moment from 'moment';
 import { inject as service } from '@ember/service';
-import _ from 'lodash';
 import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
 
 const queryParamsConfig = {
@@ -29,9 +25,9 @@ export default Route.extend(AuthenticatedRouteMixin, {
   },
   applicationAnomalies: null,
   appName: null,
-  startDate: moment().subtract(1, 'day').utc().valueOf(), //taylored for Last 24 hours vs Today -> moment().startOf('day').utc().valueOf(),
-  endDate: moment().utc().valueOf(),//taylored for Last 24 hours
-  duration: '1d',//taylored for Last 24 hours
+  startDate: moment().startOf('day').utc().valueOf(), //set default to 0:00 for data consistency
+  endDate: moment().startOf('day').add(1, 'day').utc().valueOf(), //set default to 0:00 for data consistency
+  duration: 'today', //set default to today
   feedbackType: 'All Resolutions',
 
   /**
@@ -101,7 +97,7 @@ export default Route.extend(AuthenticatedRouteMixin, {
     });
   },
 
-  _getAnomalyMapping: task (function * (model) {//TODO: need to add to anomaly util - LH
+  _getAnomalyMapping: task (function * () {//TODO: need to add to anomaly util - LH
     let anomalyMapping = {};
     //fetch the anomalies from the onion wrapper cache.
     const applicationAnomalies = yield this.get('anomaliesApiService').queryAnomaliesByAppName(this.get('appName'), this.get('startDate'), this.get('endDate'));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org