You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ak...@apache.org on 2019/03/07 01:27:56 UTC

[incubator-pinot] branch master updated: [TE] Include description and last detection time in alert header, remove application (#3918)

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

akshayrai09 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 74c5b9b  [TE] Include description and last detection time in alert header, remove application (#3918)
74c5b9b is described below

commit 74c5b9bd302a28ea65b589ae8639e30744abaebd
Author: Akshay Rai <ak...@gmail.com>
AuthorDate: Wed Mar 6 17:27:52 2019 -0800

    [TE] Include description and last detection time in alert header, remove application (#3918)
---
 .../self-serve-alert-yaml-details/template.hbs     | 17 ++++----
 .../app/pods/manage/explore-new/route.js           | 51 +++++++++++-----------
 2 files changed, 34 insertions(+), 34 deletions(-)

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 caac5a1..91da016 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
@@ -14,6 +14,7 @@
           <div class="te-search-results__title-name" title={{alertData.functionName}}>{{alertData.functionName}}</div>
         {{/link-to}}
       {{/if}}
+      <h4 class="te-alert-page__subtitle">{{alertData.description}}</h4>
     </div>
   </div>
   {{yield}}
@@ -53,14 +54,6 @@
     </div>
     <div class="col-xs-12 col-sm-7">
       <li class="te-search-results__row">
-        <div class="te-search-results__option te-search-results__option--{{modeSubClass}} te-search-results__option--left">Application</div>
-        <div class="te-search-results__value{{valueClassSuffix}}" title={{alertData.application}}>
-          <span class="{{unless alertData.application 'te-search-results__prop--missing' 'te-search-results__prop'}}">
-            {{if alertData.application alertData.application 'N/A'}}
-          </span>
-        </div>
-      </li>
-      <li class="te-search-results__row">
         <div class="te-search-results__option te-search-results__option--{{modeSubClass}} te-search-results__option--left">Owner</div>
         <div class="te-search-results__value{{valueClassSuffix}}" title={{alertData.createdBy}}>
           <span class="{{unless alertData.createdBy 'te-search-results__prop--missing' 'te-search-results__prop'}}">
@@ -76,6 +69,14 @@
           </span>
         </div>
       </li>
+      <li class="te-search-results__row">
+        <div class="te-search-results__option te-search-results__option--{{modeSubClass}} te-search-results__option--left">Last detection</div>
+        <div class="te-search-results__value{{valueClassSuffix}}" title={{alertData.lastDetectionTime}}>
+          <span class="{{unless alertData.lastDetectionTime 'te-search-results__prop--missing' 'te-search-results__prop'}}">
+            {{if alertData.lastDetectionTime alertData.lastDetectionTime 'N/A'}}
+          </span>
+        </div>
+      </li>
     </div>
   </ul>
 {{/if}}
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js b/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js
index 2a59ba2..7b65a14 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js
@@ -19,38 +19,37 @@ export default Route.extend({
       headers: { 'content-type': 'application/json' }
     };
     const notifications = get(this, 'notifications');
-
     //detection alert fetch
-    const alertUrl = `/detection/${alertId}`;
+    const detectionUrl = `/detection/${alertId}`;
     try {
-      const alert_result = await fetch(alertUrl, postProps);
-      const alert_status  = get(alert_result, 'status');
-      const alert_json = await alert_result.json();
-      if (alert_status !== 200) {
+      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 (alert_json.yaml) {
-          const yaml = yamljs.parse(alert_json.yaml);
-          Object.assign(yaml, {
-            application: alert_json.name,
-            isActive: alert_json.active,
-            createdBy: alert_json.createdBy,
-            updatedBy: alert_json.updatedBy,
-            functionName: yaml.detectionName,
-            collection: yaml.dataset,
-            type: yaml.pipelineType,
-            exploreDimensions: alert_json.dimensions,
-            filters: this._formatYamlFilter(yaml.filters),
-            dimensionExploration: this._formatYamlFilter(yaml.dimensionExploration),
-            yaml: alert_json.yaml
+        if (detection_json.yaml) {
+          const detectionYaml = yamljs.parse(detection_json.yaml);
+          const lastDetection = new Date(detection_json.lastTimestamp);
+          Object.assign(detectionYaml, {
+            lastDetectionTime: lastDetection.toDateString() + ", " +  lastDetection.toLocaleTimeString() + " (" + Intl.DateTimeFormat().resolvedOptions().timeZone + ")",
+            isActive: detection_json.active,
+            createdBy: detection_json.createdBy,
+            updatedBy: detection_json.updatedBy,
+            functionName: detectionYaml.detectionName,
+            collection: detectionYaml.dataset,
+            type: detectionYaml.pipelineType,
+            exploreDimensions: detection_json.dimensions,
+            filters: this._formatYamlFilter(detectionYaml.filters),
+            dimensionExploration: this._formatYamlFilter(detectionYaml.dimensionExploration),
+            yaml: detection_json.yaml
           });
 
           this.setProperties({
-            detectionYaml: yaml,
-            alertData: alert_json,
+            alertHeaderFields: detectionYaml,
             alertId: alertId,
-            metricUrn: alert_json.properties.nested[0].nestedMetricUrns[0],
-            metricUrnList: alert_json.properties.nested[0].nestedMetricUrns
+            metricUrn: detection_json.properties.nested[0].nestedMetricUrns[0],
+            metricUrnList: detection_json.properties.nested[0].nestedMetricUrns
           });
 
         }
@@ -81,8 +80,8 @@ export default Route.extend({
     return RSVP.hash({
       alertId,
       subscriptionGroupId,
-      alertData: get(this, 'detectionYaml'),
-      detectionYaml: get (this, 'detectionYaml') ? get(this, 'detectionYaml').yaml : null,
+      alertData: get(this, 'alertHeaderFields'),
+      detectionYaml: get(this, 'detectionYaml') ? get(this, 'detectionYaml').yaml : null,
       subscriptionGroups: get(this, 'subscriptionGroups'),
       subscriptionGroupYamlDisplay,
       metricUrn: get(this, 'metricUrn'),


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