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 eca1d2e  [TE] frontend - set analysis range using 
alertDetailsDefaultWindowSize from endpoint (#4460)
eca1d2e is described below

commit eca1d2e3950ddd064bab6bdd824ad9cf8225a9ec
Author: Harley Jackson <[email protected]>
AuthorDate: Wed Jul 24 14:20:21 2019 -0700

    [TE] frontend - set analysis range using alertDetailsDefaultWindowSize from 
endpoint (#4460)
---
 .../app/pods/components/alert-details/component.js            | 11 +++++++----
 thirdeye/thirdeye-frontend/app/pods/manage/explore/route.js   |  6 ++++--
 .../thirdeye-frontend/app/pods/manage/explore/template.hbs    |  1 +
 thirdeye/thirdeye-frontend/app/pods/manage/yaml/route.js      |  6 ++++--
 thirdeye/thirdeye-frontend/app/pods/manage/yaml/template.hbs  |  1 +
 5 files changed, 17 insertions(+), 8 deletions(-)

diff --git 
a/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js 
b/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
index a7c1239..7770afc 100644
--- a/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
+++ b/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
@@ -94,7 +94,7 @@ export default Component.extend({
   alertYaml: null,
   dimensionExploration: null,
   detectionHealth: null, // result of call to detection/health/{id}, passed in 
by parent
-
+  timeWindowSize: null, // passed in by parent, which retrieves from endpoint. 
 Do not set
 
 
   /**
@@ -747,10 +747,12 @@ export default Component.extend({
       isPreviewMode,
       dimensionExploration
     } = this.getProperties('granularity', 'isPreviewMode', 
'dimensionExploration');
+    let timeWindowSize = get(this, 'timeWindowSize');
+    timeWindowSize = timeWindowSize ? timeWindowSize : 172800000; // 48 hours 
in milliseconds
     if (!isPreviewMode) {
       this.setProperties({
-        analysisRange: [moment().add(1, 'day').subtract(1, 
'month').startOf('day').valueOf(), moment().add(1, 
'day').startOf('day').valueOf()],
-        duration: '1m',
+        analysisRange: [moment().subtract(timeWindowSize, 
'milliseconds').startOf('day').valueOf(), moment().add(1, 
'day').startOf('day').valueOf()],
+        duration: (timeWindowSize === 172800000) ? '48h' : 'custom',
         selectedDimension: 'Choose a dimension',
         // For now, we will only show predicted and bounds on daily metrics 
with no dimensions, for the Alert Overview page
         selectedBaseline: (granularity === 'DAYS' && !dimensionExploration) ? 
'predicted' : 'wo1w'
@@ -758,7 +760,8 @@ export default Component.extend({
       this._fetchAnomalies();
     } else {
       this.setProperties({
-        duration: '48h',
+        analysisRange: [moment().subtract(timeWindowSize, 
'milliseconds').startOf('day').valueOf(), moment().add(1, 
'day').startOf('day').valueOf()],
+        duration: 'custom',
         selectedBaseline: 'predicted'
       });
     }
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/explore/route.js 
b/thirdeye/thirdeye-frontend/app/pods/manage/explore/route.js
index 22f4f1f2..a750a16 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/explore/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/explore/route.js
@@ -66,7 +66,8 @@ export default Route.extend(AuthenticatedRouteMixin, {
             rawDetectionYaml: detection_json.yaml,
             metricUrn: detection_json.metricUrns[0],
             metricUrnList: detection_json.metricUrns,
-            granularity
+            granularity,
+            timeWindowSize: detection_json.alertDetailsDefaultWindowSize
           });
 
         }
@@ -128,7 +129,8 @@ export default Route.extend(AuthenticatedRouteMixin, {
       subscribedGroups,
       metricUrn: get(this, 'metricUrn'),
       metricUrnList: get(this, 'metricUrnList') ? get(this, 'metricUrnList') : 
[],
-      granularity
+      granularity,
+      timeWindowSize: get(this, 'timeWindowSize')
     });
   },
 
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/explore/template.hbs 
b/thirdeye/thirdeye-frontend/app/pods/manage/explore/template.hbs
index 5425e24..533bd35 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/explore/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/explore/template.hbs
@@ -35,6 +35,7 @@
         granularity=model.granularity
         dimensionExploration=model.alertData.dimensionExploration
         detectionHealth=model.detectionHealth
+        timeWindowSize=model.timeWindowSize
       }}
     {{/if}}
   </div>
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/yaml/route.js 
b/thirdeye/thirdeye-frontend/app/pods/manage/yaml/route.js
index 0da0c00..119f11d 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/yaml/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/yaml/route.js
@@ -54,7 +54,8 @@ export default Route.extend(AuthenticatedRouteMixin, {
           this.setProperties({
             alertId: alertId,
             detectionInfo,
-            rawDetectionYaml: detection_json.yaml
+            rawDetectionYaml: detection_json.yaml,
+            timeWindowSize: detection_json.alertDetailsDefaultWindowSize
           });
         }
       }
@@ -116,7 +117,8 @@ export default Route.extend(AuthenticatedRouteMixin, {
       detectionHealth: get (this, 'detectionHealth'),
       subscriptionGroups: get(this, 'subscriptionGroups'),
       subscribedGroups,
-      subscriptionGroupNames // all subscription groups as Ember data
+      subscriptionGroupNames, // all subscription groups as Ember data
+      timeWindowSize: get(this, 'timeWindowSize')
     });
   },
 
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/yaml/template.hbs 
b/thirdeye/thirdeye-frontend/app/pods/manage/yaml/template.hbs
index 90aca1c..544c37b 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/yaml/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/yaml/template.hbs
@@ -49,6 +49,7 @@
                   alertYaml=detectionYaml
                   dataIsCurrent=alertDataIsCurrent
                   detectionHealth=model.detectionHealth
+                  timeWindowSize=model.timeWindowSize
                 }}
                   {{yield}}
                 {{/alert-details}}


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

Reply via email to