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 e8beb64  [TE] frontend - harleyjj/manage-alert-explore - pin redirect 
link to manage/alert/explore route (#3955)
e8beb64 is described below

commit e8beb643a35744f621232b5ed715b1db2b87474f
Author: Harley Jackson <harleyy...@gmail.com>
AuthorDate: Tue Mar 12 14:44:53 2019 -0700

    [TE] frontend - harleyjj/manage-alert-explore - pin redirect link to 
manage/alert/explore route (#3955)
    
    1. Renames manage/explore-new to manage/explore
    2. Changes links in TE to manage/explore
    3. Pins modal to manage/alert/explore route for all alerts, redirects to 
new alert if new id is available
---
 .../self-serve-alert-details/template.hbs          |   2 +-
 .../self-serve-alert-yaml-details/template.hbs     |   2 +-
 .../app/pods/components/te-modal/template.hbs      |  14 ++-
 .../custom/anomalies-table/dimensions/template.hbs |   2 +-
 .../app/pods/manage/alert/explore/controller.js    |  21 +++-
 .../app/pods/manage/alert/explore/route.js         |   9 +-
 .../app/pods/manage/alert/explore/template.hbs     |  23 ++++
 .../app/pods/manage/explore-new/controller.js      |   9 --
 .../app/pods/manage/explore-new/route.js           | 135 ---------------------
 .../app/pods/manage/explore-new/template.hbs       |  37 ------
 .../app/pods/manage/yaml/template.hbs              |   2 +-
 thirdeye/thirdeye-frontend/app/router.js           |   2 +-
 .../app/styles/components/alert-report-modal.scss  |   6 +
 13 files changed, 63 insertions(+), 201 deletions(-)

diff --git 
a/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-details/template.hbs
 
b/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-details/template.hbs
index efe6cb4..560fa7c 100644
--- 
a/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-details/template.hbs
+++ 
b/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-details/template.hbs
@@ -13,7 +13,7 @@
       </div>
       {{#if (eq displayMode "list")}}
         {{#if alertData.isNewPipeline}}
-          {{#link-to "manage.explore-new" alertData.id}}
+          {{#link-to "manage.explore" alertData.id}}
             <div class="te-search-results__title-name" 
title={{alertData.functionName}}>{{alertData.functionName}}</div>
           {{/link-to}}
         {{else}}
diff --git 
a/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-yaml-details/template.hbs
 
b/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-yaml-details/template.hbs
index 2727da4..1a8f882 100644
--- 
a/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-yaml-details/template.hbs
+++ 
b/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-yaml-details/template.hbs
@@ -10,7 +10,7 @@
         {{/if}}
       </div>
       {{#if (eq displayMode "list")}}
-        {{#link-to "manage.explore-new" alertData.id}}
+        {{#link-to "manage.explore" alertData.id}}
           <div class="te-search-results__title-name" 
title={{alertData.detectionName}}>{{alertData.detectionName}}</div>
         {{/link-to}}
       {{/if}}
diff --git 
a/thirdeye/thirdeye-frontend/app/pods/components/te-modal/template.hbs 
b/thirdeye/thirdeye-frontend/app/pods/components/te-modal/template.hbs
index 678fd7b..60b5b1f 100644
--- a/thirdeye/thirdeye-frontend/app/pods/components/te-modal/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/components/te-modal/template.hbs
@@ -33,13 +33,15 @@
         <div class="row te-modal__footer">
           {{footerText}}
 
-          <button {{action "onCancel"}} type="Cancel" class="te-button 
te-button--small te-button--muted btn">
-            {{cancelButtonText}}
-          </button>
+          {{#unless noButtons}}
+            <button {{action "onCancel"}} type="Cancel" class="te-button 
te-button--small te-button--muted btn">
+              {{cancelButtonText}}
+            </button>
 
-          <button {{action "onSubmit"}} type="submit" class="te-button 
te-button--small te-button--submit btn" disabled={{isInvalid}}>
-            {{submitButtonText}}
-          </button>
+            <button {{action "onSubmit"}} type="submit" class="te-button 
te-button--small te-button--submit btn" disabled={{isInvalid}}>
+              {{submitButtonText}}
+            </button>
+          {{/unless}}
 
         </div>
       {{/if}}
diff --git 
a/thirdeye/thirdeye-frontend/app/pods/custom/anomalies-table/dimensions/template.hbs
 
b/thirdeye/thirdeye-frontend/app/pods/custom/anomalies-table/dimensions/template.hbs
index 0ee3aee..1a7f594 100644
--- 
a/thirdeye/thirdeye-frontend/app/pods/custom/anomalies-table/dimensions/template.hbs
+++ 
b/thirdeye/thirdeye-frontend/app/pods/custom/anomalies-table/dimensions/template.hbs
@@ -1,7 +1,7 @@
 <ul class="te-anomaly-table__list">
   <li class="te-anomaly-table__list-item" 
title="{{record.anomaly.functionName}}">
     {{#if record.anomaly.detectionConfigId}}
-      {{#link-to "manage.explore-new" record.anomaly.detectionConfigId 
class="te-anomaly-table__link"}}
+      {{#link-to "manage.explore" record.anomaly.detectionConfigId 
class="te-anomaly-table__link"}}
         {{record.anomaly.functionName}}
       {{/link-to}}
     {{else}}
diff --git 
a/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/controller.js 
b/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/controller.js
index 4c7c034..2a9dcf8 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/controller.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/controller.js
@@ -128,6 +128,24 @@ export default Controller.extend({
   },
 
   /**
+   * newLink: Id of new alert (for migrated alerts)
+   * @type {String}
+   */
+  newId: computed(
+    'alertData',
+    function() {
+      const alertData = get(this, 'alertData');
+      if(alertData && alertData.functionName) {
+        let pieces = alertData.functionName.split('_');
+        if (pieces.length > 0) {
+          return pieces[pieces.length-1];
+        }
+      }
+      return null;
+    }
+  ),
+
+  /**
    * Table pagination: number of pages to display
    * @type {Number}
    */
@@ -277,7 +295,6 @@ export default Controller.extend({
       } = this.getProperties('alertData', 'alertEvalMetrics', 
'DEFAULT_SEVERITY');
       const features = getWithDefault(alertData, 'alertFilter.features', null);
       const mttdStr = _.has(alertData, 'alertFilter.mttd') ? 
alertData.alertFilter.mttd.split(';') : null;
-      const severityUnitFeatures = (features && features.split(',')[1] !== 
'deviation') ? '%' : '';
       const severityUnit = (!mttdStr || mttdStr && mttdStr[1].split('=')[0] 
!== 'deviation') ? '%' : '';
       const mttdWeight = Number(extractSeverity(alertData, defaultSeverity));
       const convertedWeight = severityUnit === '%' ? mttdWeight * 100 : 
mttdWeight;
@@ -495,7 +512,7 @@ export default Controller.extend({
       });
       // Step 1: Report the anomaly
       return fetch(queryStringUrl, postProps('')).then((res) => 
checkStatus(res, 'post'))
-        .then((saveResult) => {
+        .then(() => {
           // Step 2: Automatically update anomaly feedback in that range
           return fetch(updateUrl, postProps('')).then((res) => 
checkStatus(res, 'post'));
         });
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 dad6ea0..c67b6a3 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/route.js
@@ -7,15 +7,12 @@ import RSVP from 'rsvp';
 import fetch from 'fetch';
 import moment from 'moment';
 import Route from '@ember/routing/route';
-import { isArray } from '@ember/array';
 import { later } from '@ember/runloop';
 import { task, timeout } from 'ember-concurrency';
 import { inject as service } from '@ember/service';
 import {
-  set,
   get,
-  setProperties,
-  getWithDefault
+  setProperties
 } from '@ember/object';
 import { isPresent, isNone, isBlank } from '@ember/utils';
 import {
@@ -45,7 +42,6 @@ import { getAnomalyDataUrl } from 
'thirdeye-frontend/utils/api/anomaly';
 /**
  * Shorthand for setting date defaults
  */
-const dateFormat = 'YYYY-MM-DD';
 const displayDateFormat = 'YYYY-MM-DD HH:mm';
 
 /**
@@ -327,7 +323,6 @@ export default Route.extend({
       baselineOptionsLoading: anomalyIds && anomalyIds.length > 0,
       responseOptions: anomalyResponseObj.map(response => response.name)
     });
-
     // Kick off controller defaults and replay status check
     controller.initialize();
 
@@ -603,7 +598,7 @@ export default Route.extend({
      * 
https://www.emberjs.com/api/ember/2.16/classes/Route/events/error?anchor=error
      * 
https://guides.emberjs.com/v2.18.0/routing/loading-and-error-substates/#toc_the-code-error-code-event
      */
-    error(error) {
+    error() {
       return true;
     }
   }
diff --git 
a/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/template.hbs 
b/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/template.hbs
index 454a3a7..0539b1a 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/alert/explore/template.hbs
@@ -107,6 +107,29 @@
         </div>
       {{/if}}
 
+      {{!-- Redirect Modal --}}
+      {{#te-modal
+        isShowingModal=true
+        headerText="Your Alert Has Been Migrated"
+        noButtons=true
+        isCancellable=false
+      }}
+        <main class="te-form alert-report-modal__redirect">
+          <legend class="te-report-title">This alert has been 
deprecated.</legend>
+          <div class="te-form__note">Please click the following link and 
update any bookmarks:
+            {{#if newId}}
+              {{#link-to "manage.explore" newId 
class="thirdeye-link-secondary"}}
+                Migrated Alert
+              {{/link-to}}
+            {{else}}
+              {{#link-to "manage.alerts" class="thirdeye-link-secondary"}}
+                Migrated Alert
+              {{/link-to}}
+            {{/if}}
+          </div>
+        </main>
+      {{/te-modal}}
+
       {{!-- Missing anomaly modal --}}
       {{#te-modal
         cancelButtonText="Cancel"
diff --git 
a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/controller.js 
b/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/controller.js
deleted file mode 100644
index 96ef85f..0000000
--- a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/controller.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Controller for Alert Landing and Details Page
- * @module manage/alert
- * @exports manage/alert
- */
-import Controller from '@ember/controller';
-
-export default Controller.extend({
-});
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js 
b/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js
deleted file mode 100644
index d219d42..0000000
--- a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * Handles the 'alert details' route.
- * @module manage/alert/route
- * @exports manage alert model
- */
-import Route from '@ember/routing/route';
-import RSVP from 'rsvp';
-import { set, get } from '@ember/object';
-import { inject as service } from '@ember/service';
-import yamljs from 'yamljs';
-import moment from 'moment';
-
-export default Route.extend({
-  notifications: service('toast'),
-
-  async model(params) {
-    const alertId = params.alert_id;
-    const postProps = {
-      method: 'get',
-      headers: { 'content-type': 'application/json' }
-    };
-    const notifications = get(this, 'notifications');
-    //detection alert fetch
-    const detectionUrl = `/detection/${alertId}`;
-    try {
-      const detection_result = await fetch(detectionUrl, postProps);
-      const detection_status  = get(detection_result, 'status');
-      const detection_json = await detection_result.json();
-      if (detection_status !== 200) {
-        notifications.error('Retrieval of alert yaml failed.', 'Error');
-      } else {
-        if (detection_json.yaml) {
-          const detectionInfo = yamljs.parse(detection_json.yaml);
-          const lastDetection = new Date(detection_json.lastTimestamp);
-          Object.assign(detectionInfo, {
-            isActive: detection_json.active,
-            createdBy: detection_json.createdBy,
-            updatedBy: detection_json.updatedBy,
-            exploreDimensions: detection_json.dimensions,
-            filters: this._formatYamlFilter(detectionInfo.filters),
-            dimensionExploration: 
this._formatYamlFilter(detectionInfo.dimensionExploration),
-            lastDetectionTime: lastDetection.toDateString() + ", " +  
lastDetection.toLocaleTimeString() + " (" + moment.tz.guess() + ")",
-            rawYaml: detection_json.yaml
-          });
-
-          this.setProperties({
-            alertId: alertId,
-            detectionInfo,
-            rawDetectionYaml: get(this, 'detectionInfo') ? get(this, 
'detectionInfo').rawYaml : null,
-            metricUrn: detection_json.properties.nested[0].nestedMetricUrns[0],
-            metricUrnList: detection_json.properties.nested[0].nestedMetricUrns
-          });
-
-        }
-      }
-    } catch (error) {
-      notifications.error('Retrieving alert yaml failed.', error);
-    }
-
-    //subscription group fetch
-    const subUrl = `/detection/subscription-groups/${alertId}`;//dropdown of 
subscription groups
-    try {
-      const settings_result = await fetch(subUrl, postProps);
-      const settings_status  = get(settings_result, 'status');
-      const settings_json = await settings_result.json();
-      if (settings_status !== 200) {
-        notifications.error('Retrieving subscription groups failed.', 'Error');
-      } else {
-        set(this, 'subscriptionGroups', settings_json);
-      }
-    } catch (error) {
-      notifications.error('Retrieving subscription groups failed.', error);
-    }
-
-    let subscribedGroups = "";
-    if (typeof get(this, 'subscriptionGroups') === 'object' && get(this, 
'subscriptionGroups').length > 0) {
-      const groups = get(this, 'subscriptionGroups');
-      for (let key in groups) {
-        if (groups.hasOwnProperty(key)) {
-          let group = groups[key];
-          if (subscribedGroups === "") {
-            subscribedGroups = group.name
-          } else {
-            subscribedGroups = subscribedGroups + ", " + group.name;
-          }
-        }
-      }
-    }
-
-    return RSVP.hash({
-      alertId,
-      alertData: get(this, 'detectionInfo'),
-      detectionYaml: get(this, 'rawDetectionYaml'),
-      subscribedGroups,
-      metricUrn: get(this, 'metricUrn'),
-      metricUrnList: get(this, 'metricUrnList') ? get(this, 'metricUrnList') : 
[]
-    });
-  },
-
-  /**
-   * The yaml filters formatter. Convert filters in the yaml file in to a 
legacy filters string
-   * For example, filters = {
-   *   "country": ["us", "cn"],
-   *   "browser": ["chrome"]
-   * }
-   * will be convert into "country=us;country=cn;browser=chrome"
-   *
-   * @method _formatYamlFilter
-   * @param {Map} filters multimap of filters
-   * @return {String} - formatted filters string
-   */
-  _formatYamlFilter(filters) {
-    if (filters){
-      const filterStrings = [];
-
-      Object.keys(filters).forEach(
-        function(filterKey) {
-          const filter = filters[filterKey];
-          if (filter && typeof filter === 'object') {
-
-            filter.forEach(
-              function (filterValue) {
-                filterStrings.push(filterKey + '=' + filterValue);
-              }
-            );
-          } else {
-            filterStrings.push(filterKey + '=' + filter);
-          }
-        }
-      );
-      return filterStrings.join(';');
-    }
-    return '';
-  }
-});
diff --git 
a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/template.hbs 
b/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/template.hbs
deleted file mode 100644
index d0f178b..0000000
--- a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/template.hbs
+++ /dev/null
@@ -1,37 +0,0 @@
-<section class="te-page__top te-search-results {{if isEditModeActive 
"te-search-results--slim"}}">
-  <div class="container">
-    {{#self-serve-alert-yaml-details
-      alertData=model.alertData
-      subscribedGroups=model.subscribedGroups
-      isLoadError=isLoadError
-    }}
-      <div class="te-search-results__cta">
-        {{#link-to "manage.yaml" model.alertId}}
-          <button class="te-button te-button--outline">Edit</button>
-        {{/link-to}}
-      </div>
-    {{/self-serve-alert-yaml-details}}
-  </div>
-</section>
-
-<section class="te-page__bottom">
-  <div class="container">
-    {{#if isLoadError}}
-      <div class="te-alert-page-pending">
-        <img src="{{rootURL}}assets/images/te-alert-error.png" 
class="te-alert-page-pending__image te-alert-page-pending__image--error" 
alt="error">
-        <h2 class="te-alert-page-pending__title">Oops, something went 
wrong</h2>
-        <p class="te-alert-page-pending__text">{{errorText}}</p>
-      </div>
-    {{else}}
-      {{alert-details
-        isPreviewMode=false
-        alertYaml=model.detectionYaml
-        showDetails=true
-        dataIsCurrent=true
-        alertId=model.alertId
-        metricUrn=model.metricUrn
-        metricUrnList=model.metricUrnList
-      }}
-    {{/if}}
-  </div>
-</section>
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/yaml/template.hbs 
b/thirdeye/thirdeye-frontend/app/pods/manage/yaml/template.hbs
index 9312dff..0a824fc 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/yaml/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/yaml/template.hbs
@@ -5,7 +5,7 @@
       isLoadError=isLoadError
     }}
     <div class="te-search-results__cta">
-      {{#link-to "manage.explore-new" model.alertId}}
+      {{#link-to "manage.explore" model.alertId}}
         <button class="te-button te-button--outline">Back to Overview</button>
       {{/link-to}}
     </div>
diff --git a/thirdeye/thirdeye-frontend/app/router.js 
b/thirdeye/thirdeye-frontend/app/router.js
index 5aca702..a517960 100644
--- a/thirdeye/thirdeye-frontend/app/router.js
+++ b/thirdeye/thirdeye-frontend/app/router.js
@@ -28,7 +28,7 @@ Router.map(function() {
     this.route('alerts', function() {
       this.route('performance');
     });
-    this.route('explore-new', { path: 'explore-new/:alert_id'});
+    this.route('explore', { path: 'explore/:alert_id'});
     this.route('yaml', { path: 'yaml/:alert_id' });
   });
 
diff --git 
a/thirdeye/thirdeye-frontend/app/styles/components/alert-report-modal.scss 
b/thirdeye/thirdeye-frontend/app/styles/components/alert-report-modal.scss
index 750b033..3c96b5a 100644
--- a/thirdeye/thirdeye-frontend/app/styles/components/alert-report-modal.scss
+++ b/thirdeye/thirdeye-frontend/app/styles/components/alert-report-modal.scss
@@ -6,6 +6,12 @@
     padding: 24px;
   }
 
+  &__redirect {
+    margin-top: 0;
+    border: none;
+    padding: 24px;
+  }
+
   &__field-wrapper {
     margin-top: 20px;
   }


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

Reply via email to