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 2019/04/08 23:44:09 UTC

[incubator-pinot] branch master updated: [TE] frontend - harleyjj/anomalies - update filters and feedback status to be consistent (#4090)

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 9c3b7a8  [TE] frontend - harleyjj/anomalies - update filters and feedback status to be consistent (#4090)
9c3b7a8 is described below

commit 9c3b7a8b6a50ffd9dd582636d3e8e7a03c516e37
Author: Harley Jackson <ha...@gmail.com>
AuthorDate: Mon Apr 8 16:44:04 2019 -0700

    [TE] frontend - harleyjj/anomalies - update filters and feedback status to be consistent (#4090)
    
    Makes feedback filters consistent with the feedback dropdown in anomaly-summary
    Makes sure graphs in anomalies route always have blue for current and orange for predicted
---
 .../app/pods/anomalies/controller.js               | 24 ++++++++++++++++++++++
 .../thirdeye-frontend/app/pods/anomalies/route.js  | 18 ++++++++++++----
 .../pods/components/anomaly-summary/component.js   |  4 ++--
 thirdeye/thirdeye-frontend/app/utils/anomaly.js    |  2 +-
 4 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/thirdeye/thirdeye-frontend/app/pods/anomalies/controller.js b/thirdeye/thirdeye-frontend/app/pods/anomalies/controller.js
index 91b9ca5..b07e391 100644
--- a/thirdeye/thirdeye-frontend/app/pods/anomalies/controller.js
+++ b/thirdeye/thirdeye-frontend/app/pods/anomalies/controller.js
@@ -16,6 +16,7 @@ import { isPresent } from '@ember/utils';
 import Controller from '@ember/controller';
 import { reads } from '@ember/object/computed';
 import { setUpTimeRangeOptions, powerSort } from 'thirdeye-frontend/utils/manage-alert-utils';
+import {  anomalyResponseObjNew } from 'thirdeye-frontend/utils/anomaly';
 import moment from 'moment';
 
 const TIME_PICKER_INCREMENT = 5; // tells date picker hours field how granularly to display time
@@ -295,6 +296,17 @@ export default Controller.extend({
           filterKeys = [...filterKeys, ...group];
         });
         Object.assign(filter, { filterKeys });
+      } else if (filter.name === "statusFilterMap"){
+        let anomalyPropertyArray = Object.keys(anomaliesById.searchFilters[filter.name]);
+        anomalyPropertyArray = anomalyPropertyArray.map(prop => {
+          // get the right object
+          const mapping = anomalyResponseObjNew.filter(e => (e.status === prop));
+          // map the status to name
+          return mapping.length > 0 ? mapping[0].name : prop;
+        });
+        const filterKeys = [ ...new Set(powerSort(anomalyPropertyArray, null))];
+        // Add filterKeys prop to each facet or filter block
+        Object.assign(filter, { filterKeys });
       } else {
         const anomalyPropertyArray = Object.keys(anomaliesById.searchFilters[filter.name]);
         const filterKeys = [ ...new Set(powerSort(anomalyPropertyArray, null))];
@@ -321,6 +333,18 @@ export default Controller.extend({
         addedIds = [...addedIds, ...anomaliesById.searchFilters.dimensionFilterMap[type][dimension]];
       });
       return addedIds;
+    } else if (filterType === 'statusFilterMap'){
+      let addedIds = [];
+      const translatedFilters = selectedFilters.map(f => {
+        // get the right object
+        const mapping = anomalyResponseObjNew.filter(e => (e.name === f));
+        // map the name to status
+        return mapping.length > 0 ? mapping[0].status : f;
+      });
+      translatedFilters.forEach(filter => {
+        addedIds = [...addedIds, ...anomaliesById.searchFilters[filterType][filter]];
+      });
+      return addedIds;
     } else {
       let addedIds = [];
       selectedFilters.forEach(filter => {
diff --git a/thirdeye/thirdeye-frontend/app/pods/anomalies/route.js b/thirdeye/thirdeye-frontend/app/pods/anomalies/route.js
index bc43585..4a26050 100644
--- a/thirdeye/thirdeye-frontend/app/pods/anomalies/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/anomalies/route.js
@@ -3,7 +3,7 @@ import Route from '@ember/routing/route';
 import moment from 'moment';
 import { inject as service } from '@ember/service';
 import { powerSort } from 'thirdeye-frontend/utils/manage-alert-utils';
-import {  getAnomalyIdsByTimeRange } from 'thirdeye-frontend/utils/anomaly';
+import {  getAnomalyIdsByTimeRange, anomalyResponseObjNew } from 'thirdeye-frontend/utils/anomaly';
 
 const start = moment().subtract(1, 'day').valueOf();
 const end = moment().valueOf();
@@ -27,14 +27,14 @@ export default Route.extend({
     const filterBlocksLocal = [
       {
         name: 'statusFilterMap',
-        title: 'Anomaly Status',
+        title: 'Feedback Status',
         type: 'select',
         matchWidth: true,
         filterKeys: []
       },
       {
         name: 'functionFilterMap',
-        title: 'Functions',
+        title: 'Alert Names',
         type: 'select',
         filterKeys: []
       },
@@ -70,6 +70,17 @@ export default Route.extend({
           filterKeys = [...filterKeys, ...group];
         });
         Object.assign(filter, { filterKeys });
+      } else if (filter.name === "statusFilterMap"){
+        let anomalyPropertyArray = Object.keys(model.anomaliesById.searchFilters[filter.name]);
+        anomalyPropertyArray = anomalyPropertyArray.map(prop => {
+          // get the right object
+          const mapping = anomalyResponseObjNew.filter(e => (e.status === prop));
+          // map the status to name
+          return mapping.length > 0 ? mapping[0].name : prop;
+        });
+        const filterKeys = [ ...new Set(powerSort(anomalyPropertyArray, null))];
+        // Add filterKeys prop to each facet or filter block
+        Object.assign(filter, { filterKeys });
       } else {
         const anomalyPropertyArray = Object.keys(model.anomaliesById.searchFilters[filter.name]);
         const filterKeys = [ ...new Set(powerSort(anomalyPropertyArray, null))];
@@ -82,7 +93,6 @@ export default Route.extend({
     Object.assign(model, {
       initialFiltersLocal: filterBlocksLocal
     });
-
     // Send filters to controller
     controller.setProperties({
       model,
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 cce5376..0f3e4fb 100644
--- a/thirdeye/thirdeye-frontend/app/pods/components/anomaly-summary/component.js
+++ b/thirdeye/thirdeye-frontend/app/pods/components/anomaly-summary/component.js
@@ -138,7 +138,7 @@ export default Component.extend({
           timestamps: current.timestamp,
           values: current.value,
           type: 'line',
-          color: toColor(anomalyData.metricUrn)
+          color: 'blue'
         };
       }
 
@@ -147,7 +147,7 @@ export default Component.extend({
           timestamps: predicted.timestamp,
           values: predicted.value,
           type: 'line',
-          color: 'light-' + toColor(anomalyData.metricUrn)
+          color: 'orange'
         };
       }
       return series;
diff --git a/thirdeye/thirdeye-frontend/app/utils/anomaly.js b/thirdeye/thirdeye-frontend/app/utils/anomaly.js
index 0cd30e2..b7ec6f4 100644
--- a/thirdeye/thirdeye-frontend/app/utils/anomaly.js
+++ b/thirdeye/thirdeye-frontend/app/utils/anomaly.js
@@ -57,7 +57,7 @@ export const anomalyResponseObjNew = [
   },
   { name: 'Expected permanent change',
     value: 'ANOMALY_NEW_TREND',
-    status: 'Confirmed - New Trend'
+    status: 'New Trend'
   },
   { name: 'No change observed',
     value: 'NOT_ANOMALY',


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