You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ap...@apache.org on 2018/11/15 03:06:11 UTC

[incubator-pinot] branch master updated: [TE] frontend harleyjj/manage remove WoW and change buildMetricDataUrl to take user inputs (#3485)

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

apucher 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 3fee99d  [TE] frontend harleyjj/manage remove WoW and change buildMetricDataUrl to take user inputs (#3485)
3fee99d is described below

commit 3fee99dcf2bcce9a5d292519cdfced30e726056b
Author: Harley Jackson <ha...@gmail.com>
AuthorDate: Wed Nov 14 19:06:06 2018 -0800

    [TE] frontend harleyjj/manage remove WoW and change buildMetricDataUrl to take user inputs (#3485)
---
 .../app/pods/components/anomaly-graph/component.js | 23 +++++++++-------------
 .../pods/components/self-serve-graph/template.hbs  |  2 +-
 .../app/pods/manage/alert/explore/route.js         |  2 ++
 .../app/utils/manage-alert-utils.js                | 22 ++++++++++-----------
 .../tests/acceptance/self-serve-onboarding-test.js |  2 +-
 5 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/thirdeye/thirdeye-frontend/app/pods/components/anomaly-graph/component.js b/thirdeye/thirdeye-frontend/app/pods/components/anomaly-graph/component.js
index f5f3c75..6218f6a 100644
--- a/thirdeye/thirdeye-frontend/app/pods/components/anomaly-graph/component.js
+++ b/thirdeye/thirdeye-frontend/app/pods/components/anomaly-graph/component.js
@@ -159,12 +159,11 @@ export default Component.extend({
     const legendText = this.get('legendText');
 
     const {
-      dotted = { text: 'expected', color: 'blue'},
       solid = { text: 'current', color: 'blue' }
     }  = legendText;
 
     chart.insert('div', '.chart').attr('class', 'anomaly-graph__legend').selectAll('span')
-      .data([dotted, solid])
+      .data([solid])
       .enter().append('svg')
       .attr('class', 'anomaly-graph__legend-item')
       .attr('width', 80)
@@ -187,7 +186,7 @@ export default Component.extend({
           .attr('x2', 30)
           .attr('y2', 10)
           .attr('stroke-dasharray', (d) => {
-            const dasharrayNum = (d === dotted) ? '10%' : 'none';
+            const dasharrayNum = 'none';
             return dasharrayNum;
           });
       });
@@ -254,7 +253,8 @@ export default Component.extend({
       primaryMetric,
       ...relatedMetric,
       ...selectedMetrics,
-      ...selectedDimensions];
+      ...selectedDimensions
+    ];
 
     data.forEach((datum) => {
       const name = datum.metricName || datum.name;
@@ -279,7 +279,7 @@ export default Component.extend({
   dimensions: [],
   selectedDimensions: [],
 
-  showGraphLegend: true,
+  showGraphLegend: false,
   colors: {},
   showSubChart: false,
   subchartStart: null,
@@ -388,7 +388,7 @@ export default Component.extend({
     const showGraphLegend = this.get('showGraphLegend');
     return {
       position: 'inset',
-      show: showGraphLegend
+      show: false
     };
   }),
 
@@ -541,8 +541,7 @@ export default Component.extend({
     'showLegend',
     'height',
     function() {
-      const height = this.get('height')
-        || this.get('showLegend') ? 400 : 200;
+      const height = this.get('height') || 400;
       return {
         height
       };
@@ -562,13 +561,11 @@ export default Component.extend({
       if (primaryMetric.isSelected) {
         const { baselineValues, currentValues } = primaryMetric.subDimensionContributionMap['All'];
         return [
-          [`${primaryMetric.metricName}-current`, ...currentValues],
-          [`${primaryMetric.metricName}-expected`, ...baselineValues]
+          [`${primaryMetric.metricName}-current`, ...currentValues]
         ];
       }
       return [
-        [`${primaryMetric.metricName}-current`],
-        [`${primaryMetric.metricName}-expected`]
+        [`${primaryMetric.metricName}-current`]
       ];
     }
   ),
@@ -588,7 +585,6 @@ export default Component.extend({
 
         const { baselineValues, currentValues } = metric.subDimensionContributionMap['All'];
         columns.push([`${metric.metricName}-current`, ...currentValues]);
-        columns.push([`${metric.metricName}-expected`, ...baselineValues]);
       });
       return columns;
     }
@@ -606,7 +602,6 @@ export default Component.extend({
       selectedDimensions.forEach((dimension) => {
         const { baselineValues, currentValues } = dimension;
         columns.push([`${dimension.name}-current`, ...currentValues]);
-        columns.push([`${dimension.name}-expected`, ...baselineValues]);
       });
       return columns;
     }
diff --git a/thirdeye/thirdeye-frontend/app/pods/components/self-serve-graph/template.hbs b/thirdeye/thirdeye-frontend/app/pods/components/self-serve-graph/template.hbs
index 8ab3707..05146d6 100644
--- a/thirdeye/thirdeye-frontend/app/pods/components/self-serve-graph/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/components/self-serve-graph/template.hbs
@@ -21,7 +21,7 @@
         showDimensions=false
         isLoading=loading
         showSubchart=true
-        showLegend=true
+        showLegend=false
         enableZoom=true
         legendText=legendText
         componentId=componentId
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/route.js b/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/route.js
index ef3eb01..2bfab38 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/route.js
@@ -274,6 +274,8 @@ export default Route.extend({
         const maxTime = isReplayDone && metricId ? await fetch(maxTimeUrl).then(checkStatus) : moment().valueOf();
         Object.assign(model, { metricDataUrl: buildMetricDataUrl({
           maxTime,
+          endStamp: config.endStamp,
+          startStamp: config.startStamp,
           id: metricId,
           filters: config.filters,
           granularity: config.bucketUnit,
diff --git a/thirdeye/thirdeye-frontend/app/utils/manage-alert-utils.js b/thirdeye/thirdeye-frontend/app/utils/manage-alert-utils.js
index 572e3b5..3171387 100644
--- a/thirdeye/thirdeye-frontend/app/utils/manage-alert-utils.js
+++ b/thirdeye/thirdeye-frontend/app/utils/manage-alert-utils.js
@@ -210,23 +210,21 @@ export function evalObj() {
  * @returns {String} metric data call params/url
  */
 export function buildMetricDataUrl(graphConfig) {
-  const { id, maxTime, filters, dimension, granularity } = graphConfig;
+  const { id, maxTime, startStamp, endStamp, filters, dimension, granularity } = graphConfig;
   // Chosen dimension
   const selectedDimension = dimension || 'All';
   // Do not send a filters param if value not present
   const filterQs = filters ? `&filters=${encodeURIComponent(filters)}` : '';
-  // Load only a week of data if granularity is high
+  // Load only a week of data in default if granularity is high
   const startTimeBucket = granularity && granularity.toLowerCase().includes('minute') ? 'week' : 'months';
-  // For end date, choose either maxTime or end of yesterday
-  const currentEnd = moment(maxTime).isValid() ? moment(maxTime).valueOf() : buildDateEod(1, 'day').valueOf();
-  // For graph start date, take either 1 week or 1 month, depending on granularity
-  const currentStart = moment(currentEnd).subtract(1, startTimeBucket).valueOf();
-  // Baseline starts 1 week before our start date
-  const baselineStart = moment(currentStart).subtract(1, 'week').valueOf();
-  // Baseline ends 1 week before our end date
-  const baselineEnd = moment(currentEnd).subtract(1, 'week');
-  // Now build the metric data url
-  return `/timeseries/compare/${id}/${currentStart}/${currentEnd}/${baselineStart}/${baselineEnd}?dimension=` +
+  // set maxData as maxTime or default
+  const maxData = maxTime && moment(maxTime).isValid() ? moment(maxTime).valueOf() : buildDateEod(1, 'day').valueOf();
+  // For end date, use end stamp if defined and valid, otherwise use maxData
+  const currentEnd = endStamp && moment(endStamp).isValid() ? moment(endStamp).valueOf() : moment(maxData).valueOf();
+  // For graph start date, use start stamp if defined and valid, otherwise pick it usimng startTimeBucket depending on granularity
+  const currentStart = startStamp && moment(startStamp).isValid() ? moment(startStamp).valueOf() : moment(currentEnd).subtract(1, startTimeBucket).valueOf();
+  // Now build the metric data url -> currentEnd and currentStart reused in the call since baseline no longer displayed on graph
+  return `/timeseries/compare/${id}/${currentStart}/${currentEnd}/${currentStart}/${currentEnd}?dimension=` +
          `${selectedDimension}&granularity=${granularity}${filterQs}`;
 }
 
diff --git a/thirdeye/thirdeye-frontend/tests/acceptance/self-serve-onboarding-test.js b/thirdeye/thirdeye-frontend/tests/acceptance/self-serve-onboarding-test.js
index dfd691d..2beea9c 100644
--- a/thirdeye/thirdeye-frontend/tests/acceptance/self-serve-onboarding-test.js
+++ b/thirdeye/thirdeye-frontend/tests/acceptance/self-serve-onboarding-test.js
@@ -61,7 +61,7 @@ module('Acceptance | create alert', function(hooks) {
     );
     assert.equal(
       $graphContainer.find('svg').length,
-      3,
+      2,
       'Graph and legend svg elements are rendered.'
     );
     assert.notOk(


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