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 2018/11/16 21:45:00 UTC

[incubator-pinot] branch master updated: [TE] frontend - aaronucsd/share - added % (+/-) for offsets against current like predicted. (#3509)

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 f64625b  [TE] frontend - aaronucsd/share - added % (+/-) for offsets against current like predicted. (#3509)
f64625b is described below

commit f64625bd8965c0c728b32322001b36f7827becf7
Author: Long Huynh <lo...@linkedin.com>
AuthorDate: Fri Nov 16 13:44:56 2018 -0800

    [TE] frontend - aaronucsd/share - added % (+/-) for offsets against current like predicted. (#3509)
---
 .../app/pods/home/share-dashboard/controller.js    | 23 +++++++++++++++-------
 .../app/pods/home/share-dashboard/template.hbs     | 19 +++++++++++++-----
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/controller.js b/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/controller.js
index b140b26..5f2e7c8 100644
--- a/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/controller.js
+++ b/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/controller.js
@@ -19,7 +19,8 @@ import {
   computed
 } from '@ember/object';
 import { appendFilters } from 'thirdeye-frontend/utils/rca-utils';
-import { humanizeFloat, checkStatus } from 'thirdeye-frontend/utils/utils';
+import { humanizeFloat, humanizeChange, checkStatus } from 'thirdeye-frontend/utils/utils';
+import floatToPercent from 'thirdeye-frontend/utils/float-to-percent';
 
 const CUSTOMIZE_OPTIONS = [{
   id: 0,
@@ -301,10 +302,21 @@ export default Controller.extend({
           //Get all in the following order - current,wo2w,median4w
           const offsets = await fetch(`/rootcause/metric/aggregate/batch?urn=${metricUrn}&start=${start}&end=${end}&offsets=wo1w,wo2w,median4w&timezone=America/Los_Angeles`).then(checkStatus).then(res => res);
 
+          const current = get(item.anomaly, 'current');
+          const wow = humanizeFloat(offsets[0]);
+          const wo2w = humanizeFloat(offsets[1]);
+          const median4w = humanizeFloat(offsets[2]);
+          const wowChange = floatToPercent(Number((current - offsets[0]) / offsets[0]));
+          const wo2wChange = floatToPercent(Number((current - offsets[1]) / offsets[1]));
+          const median4wChange = floatToPercent(Number((current - offsets[2]) / offsets[2]));
+          const wowHumanizeChange = humanizeChange(Number((current - offsets[0]) / offsets[0]));
+          const wo2wHumanizeChange = humanizeChange(Number((current - offsets[1]) / offsets[1]));
+          const median4wHumanizeChange = humanizeChange(Number((current - offsets[2]) / offsets[2]));
+
           set(item.anomaly, 'offsets',  offsets ? {
-            'wow': humanizeFloat(offsets[0]),
-            'wo2w': humanizeFloat(offsets[1]),
-            'median4w': humanizeFloat(offsets[2])
+            'wow': { value: wow, change: wowChange, humanizedChangeDisplay: wowHumanizeChange },
+            'wo2w': { value: wo2w, change: wo2wChange, humanizedChangeDisplay: wo2wHumanizeChange },
+            'median4w': { value: median4w, change: median4wChange, humanizedChangeDisplay: median4wHumanizeChange },
           } : {
             'wow': '-',
             'wo2w': '-',
@@ -381,9 +393,6 @@ export default Controller.extend({
           'offsetsMap': map
         });
       }
-
-      // //show median4w column
-      // this.toggleProperty('showMedian4w');
   },
 
   _customizeEmailHelper(option, type) {
diff --git a/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/template.hbs b/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/template.hbs
index 3879228..804262c 100644
--- a/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/template.hbs
@@ -209,7 +209,7 @@
                         <!-- Anomaly level -->
                         {{#each alertList.items as |record index|}}
                           <tr style="border-bottom: 1px solid #C7D1D8;{{if record.anomaly.comment 'border-bottom: none;'}}">
-                            <td style="padding: 0 3px 3px 10px;">
+                            <td style="padding: 0 3px 3px 10px;min-width: 110px;">
                               <p style="margin: 0;">
                                 <label style="margin: 0;">
                                   <span style="color: #0073B1; font-size: 14px; line-height: 20px;">
@@ -226,7 +226,7 @@
                             <td style="padding: 0 3px 3px 10px;">
                               <ul class="dimensions">
                                 {{#each-in record.anomaly.dimensions as |dimName dimList|}}
-                                  <li style="padding: 0;color: rgba(0,0,0,0.6);font-size: 12px;">{{dimName}}:<span style="margin-left: 5px;word-break: break-all;">{{dimList}}</span></li>
+                                  <li style="padding: 0;color: rgba(0,0,0,0.6);font-size: 12px;">{{dimName}}: {{dimList}}</li>
                                 {{else}}
                                     -
                                 {{/each-in}}
@@ -242,17 +242,26 @@
                             {{#if showCustomizeEmailTemplate}}
                               {{#if showWow}}
                                 <td style="padding: 0 3px 3px 10px;">
-                                  <p style="margin: 0;">{{record.anomaly.offsets.wow}}</p>
+                                  <p style="margin: 0;">{{record.anomaly.offsets.wow.value}}</p>
+                                  <p  style="margin: 0;" class="te-anomaly-table__value-label te-anomaly-table__value-label--{{calculate-direction record.anomaly.offsets.wow.change}}">
+                                    ({{record.anomaly.offsets.wow.humanizedChangeDisplay}})
+                                  </p>
                                 </td>
                               {{/if}}
                               {{#if showWo2w}}
                                 <td style="padding: 0 3px 3px 10px;">
-                                  <p style="margin: 0;">{{record.anomaly.offsets.wo2w}}</p>
+                                  <p style="margin: 0;">{{record.anomaly.offsets.wo2w.value}}</p>
+                                  <p  style="margin: 0;" class="te-anomaly-table__value-label te-anomaly-table__value-label--{{calculate-direction record.anomaly.offsets.wo2w.change}}">
+                                    ({{record.anomaly.offsets.wo2w.humanizedChangeDisplay}})
+                                  </p>
                                 </td>
                               {{/if}}
                               {{#if showMedian4w}}
                                 <td style="padding: 0 3px 3px 10px;">
-                                  <p style="margin: 0;">{{record.anomaly.offsets.median4w}}</p>
+                                  <p style="margin: 0;">{{record.anomaly.offsets.median4w.value}}</p>
+                                  <p  style="margin: 0;" class="te-anomaly-table__value-label te-anomaly-table__value-label--{{calculate-direction record.anomaly.offsets.median4w.change}}">
+                                    ({{record.anomaly.offsets.median4w.humanizedChangeDisplay}})
+                                  </p>
                                 </td>
                               {{/if}}
                             {{/if}}


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