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/18 18:09:55 UTC

[incubator-pinot] branch master updated: [TE] frontend - harleyjj/share-dashboard - extend anomalies by subscription group to share-dashboard (#4132)

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 c18a785  [TE] frontend - harleyjj/share-dashboard - extend anomalies by subscription group to share-dashboard (#4132)
c18a785 is described below

commit c18a785481e9c527278e4cea8ad9ca00de068f66
Author: Harley Jackson <ha...@gmail.com>
AuthorDate: Thu Apr 18 11:09:49 2019 -0700

    [TE] frontend - harleyjj/share-dashboard - extend anomalies by subscription group to share-dashboard (#4132)
---
 .../app/pods/home/index/controller.js              | 12 ++++++++
 .../app/pods/home/index/template.hbs               |  2 +-
 .../app/pods/home/share-dashboard/controller.js    |  7 +++--
 .../app/pods/home/share-dashboard/route.js         | 34 ++++++++++++++++------
 .../app/pods/home/share-dashboard/template.hbs     |  6 +++-
 5 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/thirdeye/thirdeye-frontend/app/pods/home/index/controller.js b/thirdeye/thirdeye-frontend/app/pods/home/index/controller.js
index c1d5716..02f7f65 100644
--- a/thirdeye/thirdeye-frontend/app/pods/home/index/controller.js
+++ b/thirdeye/thirdeye-frontend/app/pods/home/index/controller.js
@@ -55,6 +55,18 @@ export default Controller.extend({
   ),
 
   /**
+   * Flag for showing share button
+   * @type {Boolean}
+   */
+  appOrSubGroup: computed(
+    'appName',
+    'subGroup',
+    function() {
+      return (get(this, 'appName') || get(this, 'subGroup'));
+    }
+  ),
+
+  /**
    * Grabs Ember Data objects from the application collection - peekAll will look at what's in the store without requesting from the backend
    * Sorts the array of application objects by the field "application" and returns it
    * @type {Array}
diff --git a/thirdeye/thirdeye-frontend/app/pods/home/index/template.hbs b/thirdeye/thirdeye-frontend/app/pods/home/index/template.hbs
index 05ec59e..989b054 100644
--- a/thirdeye/thirdeye-frontend/app/pods/home/index/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/home/index/template.hbs
@@ -10,7 +10,7 @@
       predefinedRanges=pill.predefinedRanges
       selectAction=(action "onRangeSelection")
     }}
-    {{#if appName}}
+    {{#if appOrSubGroup}}
       {{#link-to "home.share-dashboard" (query-params appName=appName duration=duration startDate=startDate endDate=endDate feedbackType=feedbackType shareId=null) tagName="button" type="button" class="pull-right te-button te-button--outline"}}
         Share
       {{/link-to}}
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 f676376..d3d0802 100644
--- a/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/controller.js
+++ b/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/controller.js
@@ -501,6 +501,9 @@ export default Controller.extend({
       if(get(this, 'model.appName')){
         currentUrl = currentUrl.concat(`appName=${get(this, 'model.appName')}`);
       }
+      if(get(this, 'model.subGroup')){
+        currentUrl = currentUrl.concat(`subGroup=${get(this, 'model.subGroup')}`);
+      }
       if(get(this, 'model.startDate')){
         currentUrl = currentUrl.concat(`&startDate=${get(this, 'model.startDate')}`);
       }
@@ -518,8 +521,8 @@ export default Controller.extend({
         set(this, 'showSharedTooltip', true);
         set(this, 'shareUrl', currentUrl);
         //update the route's params
-        const { appName, duration, startDate, endDate } = get(this, 'model');
-        this.transitionToRoute({ queryParams: { appName, duration, startDate, endDate, shareId: hashKey }});
+        const { appName, subGroup, duration, startDate, endDate } = get(this, 'model');
+        this.transitionToRoute({ queryParams: { appName, subGroup, duration, startDate, endDate, shareId: hashKey }});
       });
       //has to be here to tie user event with the copy action (vs in the promise return above)
       this._copyFromDummyInput(currentUrl);
diff --git a/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/route.js b/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/route.js
index 9953a5d..ec692dd 100644
--- a/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/route.js
@@ -30,7 +30,8 @@ export default Route.extend(AuthenticatedRouteMixin, {
     endDate: queryParamsConfig,
     duration: queryParamsConfig,
     feedbackType: queryParamsConfig,
-    shareId: queryParamsConfig
+    shareId: queryParamsConfig,
+    subGroup: queryParamsConfig
   },
   appName: null,
   startDate: moment().subtract(1, 'day').utc().valueOf(), //taylored for Last 24 hours vs Today -> moment().startOf('day').utc().valueOf(),
@@ -38,10 +39,12 @@ export default Route.extend(AuthenticatedRouteMixin, {
   duration: '1d', //Last 24 hours
   feedbackType: 'All Resolutions',
   shareId: null,
+  subGroup: null,
 
   async model(params) {
-    const { appName, startDate, endDate, duration, feedbackType, shareId } = params;//check params
+    const { appName, startDate, endDate, duration, feedbackType, shareId, subGroup } = params;//check params
     const applications = await get(this, 'anomaliesApiService').queryApplications(appName, startDate);// Get all applicatons available
+    const subscriptionGroups = await this.get('anomaliesApiService').querySubscriptionGroups(); // Get all subscription groups available
 
     return hash({
       appName,
@@ -50,7 +53,9 @@ export default Route.extend(AuthenticatedRouteMixin, {
       duration,
       applications,
       feedbackType,
-      shareId
+      shareId,
+      subscriptionGroups,
+      subGroup
     });
   },
 
@@ -62,18 +67,20 @@ export default Route.extend(AuthenticatedRouteMixin, {
     const duration = model.duration || get(this, 'duration');
     const feedbackType = model.feedbackType || get(this, 'feedbackType');
     const shareId = model.shareId || get(this, 'shareId');
+    const subGroup = model.subGroup || null;
     // Update props
     setProperties(this, {
       appName,
       startDate,
       endDate,
       duration,
-      feedbackType
+      feedbackType,
+      subGroup
     });
 
     return new RSVP.Promise(async (resolve, reject) => {
       try {
-        const anomalyMapping = appName ? await get(this, '_getAnomalyMapping').perform(model) : []; //DEMO:
+        const anomalyMapping = (appName || subGroup) ? await get(this, '_getAnomalyMapping').perform(model) : []; //DEMO:
         const shareMetaData = shareId ? await get(this, 'shareDashboardApiService').queryShareMetaById(shareId) : [];
         const shareTemplateConfig = appName ? await get(this, 'shareTemplateConfigApiService').queryShareTemplateConfigByAppName(appName) : {};
         const defaultParams = {
@@ -97,17 +104,25 @@ export default Route.extend(AuthenticatedRouteMixin, {
 
   _getAnomalyMapping: task (function * () {//TODO: need to add to anomaly util - LH
     let anomalyMapping = {};
+    let anomalies;
     //fetch the anomalies from the onion wrapper cache.
-    const applicationAnomalies = yield get(this, 'anomaliesApiService').queryAnomaliesByAppName(get(this, 'appName'), get(this, 'startDate'), get(this, 'endDate'));
+    if (this.get('appName') && this.get('subGroup')) {
+      //this functionality is not provided in the UI, but the user can manually type the params into URL simultaneously
+      anomalies = yield this.get('anomaliesApiService').queryAnomaliesByJoin(this.get('appName'), this.get('subGroup'), this.get('startDate'), this.get('endDate'));
+    } else if (this.get('appName')) {
+      anomalies = yield this.get('anomaliesApiService').queryAnomaliesByAppName(this.get('appName'), this.get('startDate'), this.get('endDate'));
+    } else {
+      anomalies = yield this.get('anomaliesApiService').queryAnomaliesBySubGroup(this.get('subGroup'), this.get('startDate'), this.get('endDate'));
+    }
     const humanizedObject = {
       queryDuration: get(this, 'duration'),
       queryStart: get(this, 'startDate'),
       queryEnd: get(this, 'endDate')
     };
-    set(this, 'applicationAnomalies', applicationAnomalies);
+    set(this, 'anomalies', anomalies);
     let index = 1;
 
-    applicationAnomalies.forEach(anomaly => {
+    anomalies.forEach(anomaly => {
       const metricName = get(anomaly, 'metricName');
       const metricId = get(anomaly, 'metricId');
       const functionName = get(anomaly, 'functionName');
@@ -227,7 +242,8 @@ export default Route.extend(AuthenticatedRouteMixin, {
       startDateDisplay:  moment(get(this, 'startDate')).format('MM/DD/YYYY'),
       endDateDisplay: moment(get(this, 'endDate')).format('MM/DD/YYYY'),
       appNameDisplay: get(this, 'appName'),
-      anomaliesCount: get(this, 'applicationAnomalies.content') ? get(this, 'applicationAnomalies.content').length : 0
+      subGroupDisplay: get(this, 'subGroup'),
+      anomaliesCount: get(this, 'anomalies.content') ? get(this, 'anomalies.content').length : 0
     });
   }
 });
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 d54f9f3..7001cb8 100644
--- a/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/home/share-dashboard/template.hbs
@@ -42,7 +42,7 @@
 </style>
 <div class="container share-dashboard-container">
   <header>
-    {{#link-to "home" (query-params appName=model.appName feedbackType=model.feedbackType duration=model.duration startDate=model.startDate endDate=model.endDate) class="te-anomaly-table__link"}}
+    {{#link-to "home" (query-params subGroup=model.subGroup appName=model.appName feedbackType=model.feedbackType duration=model.duration startDate=model.startDate endDate=model.endDate) class="te-anomaly-table__link"}}
       Back to Dashboard
     {{/link-to}}
   </header>
@@ -139,7 +139,11 @@
           </div>
           <div style="color: #FFF;">
             <div style="padding: 20px; background-color: #0073b1;text-align: left;">
+              {{#if appNameDisplay}}
               <h3 style="line-height: 20px;margin-bottom: 25x;">Application:<span  style="padding-left:10px;">{{appNameDisplay}}</span></h3>
+              {{else}}
+              <h3 style="line-height: 20px;margin-bottom: 25x;">Subscription Group:<span  style="padding-left:10px;">{{subGroupDisplay}}</span></h3>
+              {{/if}}
               <h4 style="line-height: 20px;">{{anomaliesFilteredCount}} anomalies were detected from {{startDateDisplay}} to {{endDateDisplay}}</h4>
               {{#if dashboard_summary_comment}}
                 <div id="div_dashboard_summary">


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