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 27b61a1  [TE] add padding to graphs in email and Anomalies route 
(#4263)
27b61a1 is described below

commit 27b61a1bf23fcc358ade6bf8ea073415fd21aa56
Author: Harley Jackson <[email protected]>
AuthorDate: Thu May 30 17:00:34 2019 -0700

    [TE] add padding to graphs in email and Anomalies route (#4263)
---
 .../pods/components/anomaly-summary/component.js   | 28 ++++++++++++++--------
 .../app/pods/screenshot/controller.js              | 21 ++++++++++++----
 .../thirdeye-frontend/app/pods/screenshot/route.js |  7 ++----
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git 
a/thirdeye/thirdeye-frontend/app/pods/components/anomaly-summary/component.js 
b/thirdeye/thirdeye-frontend/app/pods/components/anomaly-summary/component.js
index 2d1e7eb..d4d65e9 100644
--- 
a/thirdeye/thirdeye-frontend/app/pods/components/anomaly-summary/component.js
+++ 
b/thirdeye/thirdeye-frontend/app/pods/components/anomaly-summary/component.js
@@ -81,8 +81,19 @@ export default Component.extend({
 
   axis: computed(
     'anomalyData',
+    'series',
     function () {
-      const anomalyData = get(this, 'anomalyData');
+      const {
+        anomalyData,
+        series
+      } = this.getProperties('anomalyData', 'series');
+
+      let start = anomalyData.startTime;
+      let end = anomalyData.endTime;
+      if (series.current && series.current.timestamps && 
Array.isArray(series.current.timestamps)) {
+        start = series.current.timestamps[0];
+        end = series.current.timestamps[series.current.timestamps.length - 1];
+      }
 
       return {
         y: {
@@ -99,8 +110,8 @@ export default Component.extend({
         x: {
           type: 'timeseries',
           show: true,
-          min: anomalyData.startTime,
-          max: anomalyData.endTime,
+          min: start,
+          max: end,
           tick: {
             fit: false,
             format: (d) => {
@@ -137,10 +148,10 @@ export default Component.extend({
         };
       }
 
-      if (current && !_.isEmpty(current.value)) {
+      if (current && !_.isEmpty(current.current)) {
         series['current'] = {
           timestamps: current.timestamp,
-          values: current.value,
+          values: current.current,
           type: 'line',
           color: 'blue'
         };
@@ -206,17 +217,14 @@ export default Component.extend({
       .then(checkStatus)
       .then(res => {
         set(this, 'anomalyData', res);
-        const timeZone = 'America/Los_Angeles';
-        const currentUrl = 
`/rootcause/metric/timeseries?urn=${res.metricUrn}&start=${res.startTime}&end=${res.endTime}&offset=current&timezone=${timeZone}`;
-        const predictedUrl = 
`/detection/predicted-baseline/${anomalyId}?start=${res.startTime}&end=${res.endTime}`;
+        const predictedUrl = 
`/detection/predicted-baseline/${anomalyId}?start=${res.startTime}&end=${res.endTime}&padding=true`;
         const timeseriesHash = {
-          current: fetch(currentUrl).then(res => checkStatus(res, 'get', 
true)),
           predicted: fetch(predictedUrl).then(res => checkStatus(res, 'get', 
true))
         };
         return RSVP.hash(timeseriesHash);
       })
       .then((res) => {
-        set(this, 'current', res.current);
+        set(this, 'current', res.predicted);
         set(this, 'predicted', res.predicted);
         set(this, 'isLoading', false);
       })
diff --git a/thirdeye/thirdeye-frontend/app/pods/screenshot/controller.js 
b/thirdeye/thirdeye-frontend/app/pods/screenshot/controller.js
index 0072ad4..245fb7a 100644
--- a/thirdeye/thirdeye-frontend/app/pods/screenshot/controller.js
+++ b/thirdeye/thirdeye-frontend/app/pods/screenshot/controller.js
@@ -72,10 +72,10 @@ export default Controller.extend({
         };
       }
 
-      if (current && !_.isEmpty(current.value)) {
+      if (current && !_.isEmpty(current.current)) {
         series['current'] = {
           timestamps: current.timestamp,
-          values: current.value,
+          values: current.current,
           type: 'line',
           color: 'blue'
         };
@@ -95,8 +95,19 @@ export default Controller.extend({
 
   axis: computed(
     'anomalyData',
+    'series',
     function () {
-      const anomalyData = get(this, 'anomalyData');
+      const {
+        anomalyData,
+        series
+      } = this.getProperties('anomalyData', 'series');
+
+      let start = anomalyData.startTime;
+      let end = anomalyData.endTime;
+      if (series.current && series.current.timestamps && 
Array.isArray(series.current.timestamps)) {
+        start = series.current.timestamps[0];
+        end = series.current.timestamps[series.current.timestamps.length - 1];
+      }
 
       return {
         y: {
@@ -113,8 +124,8 @@ export default Controller.extend({
         x: {
           type: 'timeseries',
           show: true,
-          min: anomalyData.startTime,
-          max: anomalyData.endTime,
+          min: start,
+          max: end,
           tick: {
             fit: false,
             format: (d) => {
diff --git a/thirdeye/thirdeye-frontend/app/pods/screenshot/route.js 
b/thirdeye/thirdeye-frontend/app/pods/screenshot/route.js
index e50b118..7cd0a2b 100644
--- a/thirdeye/thirdeye-frontend/app/pods/screenshot/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/screenshot/route.js
@@ -12,11 +12,8 @@ export default Route.extend(UnauthenticatedRouteMixin, {
     return fetch(anomalyUrl)
       .then(checkStatus)
       .then(res => {
-        const timeZone = 'America/Los_Angeles';
-        const currentUrl = 
`/rootcause/metric/timeseries?urn=${res.metricUrn}&start=${res.startTime}&end=${res.endTime}&offset=current&timezone=${timeZone}`;
-        const predictedUrl = 
`/detection/predicted-baseline/${id}?start=${res.startTime}&end=${res.endTime}`;
+        const predictedUrl = 
`/detection/predicted-baseline/${id}?start=${res.startTime}&end=${res.endTime}&padding=true`;
         const timeseriesHash = {
-          current: fetch(currentUrl).then(res => checkStatus(res, 'get', 
true)),
           predicted: fetch(predictedUrl).then(res => checkStatus(res, 'get', 
true)),
           anomalyData: res
         };
@@ -31,7 +28,7 @@ export default Route.extend(UnauthenticatedRouteMixin, {
   setupController(controller, model) {
     this._super(...arguments);
     controller.setProperties({
-      current: model.current,
+      current: model.predicted,
       predicted: model.predicted,
       anomalyData: model.anomalyData
     });


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to