You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pinot.apache.org by GitBox <gi...@apache.org> on 2018/11/16 21:44:57 UTC

[GitHub] jihaozh closed pull request #3509: [TE] frontend - aaronucsd/share - added % (+/-) for offsets against c…

jihaozh closed pull request #3509: [TE] frontend - aaronucsd/share - added % (+/-) for offsets against c…
URL: https://github.com/apache/incubator-pinot/pull/3509
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 b140b2625c..5f2e7c897d 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 3879228237..804262c0ab 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}}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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