ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhew...@apache.org
Subject ambari git commit: AMBARI-15605 UI Changes To Expose Alert Repeat Tolerance Counts (zhewang)
Date Tue, 05 Apr 2016 17:28:39 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 79c0a4f35 -> a2c6ea46f


AMBARI-15605 UI Changes To Expose Alert Repeat Tolerance Counts (zhewang)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a2c6ea46
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a2c6ea46
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a2c6ea46

Branch: refs/heads/trunk
Commit: a2c6ea46f0f180f75b1e76dc2adff2bd53258d36
Parents: 79c0a4f
Author: Zhe (Joe) Wang <zhewang@apache.org>
Authored: Tue Apr 5 10:27:43 2016 -0700
Committer: Zhe (Joe) Wang <zhewang@apache.org>
Committed: Tue Apr 5 10:28:09 2016 -0700

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js     |  2 +-
 ambari-web/app/mappers/alert_instances_mapper.js    |  4 +++-
 ambari-web/app/messages.js                          |  1 +
 ambari-web/app/models/alerts/alert_instance.js      | 10 ++++++++++
 .../templates/common/modal_popups/alerts_popup.hbs  |  5 +----
 .../templates/main/alerts/alert_instance/status.hbs | 10 ++++++++--
 .../templates/main/alerts/definition_details.hbs    |  6 +-----
 .../views/main/alerts/definition_details_view.js    | 16 ++++++++++++++++
 8 files changed, 41 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a2c6ea46/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index dcef1a2..dc0f7cf 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -560,7 +560,7 @@ App.UpdateController = Em.Controller.extend({
     var realUrl = '/alerts?fields=' +
       'Alert/component_name,Alert/definition_id,Alert/definition_name,Alert/host_name,Alert/id,Alert/instance,'
+
       'Alert/label,Alert/latest_timestamp,Alert/maintenance_state,Alert/original_timestamp,Alert/scope,'
+
-      'Alert/service_name,Alert/state,Alert/text' +
+      'Alert/service_name,Alert/state,Alert/text,Alert/repeat_tolerance,Alert/repeat_tolerance_remaining'
+
       '&Alert/state.in(CRITICAL,WARNING)&Alert/maintenance_state.in(OFF)&from='
+ queryParams.from + '&page_size=' + queryParams.page_size;
     var url = this.getUrl(testUrl, realUrl);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a2c6ea46/ambari-web/app/mappers/alert_instances_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_instances_mapper.js b/ambari-web/app/mappers/alert_instances_mapper.js
index 349d94d..269941b 100644
--- a/ambari-web/app/mappers/alert_instances_mapper.js
+++ b/ambari-web/app/mappers/alert_instances_mapper.js
@@ -40,7 +40,9 @@ App.alertInstanceMapper = App.QuickDataMapper.create({
     maintenance_state: 'Alert.maintenance_state',
     instance: 'Alert.instance',
     state: 'Alert.state',
-    text: 'Alert.text'
+    text: 'Alert.text',
+    repeat_tolerance: 'Alert.repeat_tolerance',
+    repeat_tolerance_remaining: 'Alert.repeat_tolerance_remaining'
   },
 
   map: function(json) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a2c6ea46/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 1653eeb..f68d97a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -326,6 +326,7 @@ Em.I18n.translations = {
   'models.alert_instance.tiggered.verbose': "Occurred on {0} <br> Checked on {1}",
   'models.alert_definition.triggered.verbose': "Occurred on {0}",
   'models.alert_definition.triggered.checked': "Status Changed: {0}\nLast Checked: {1}",
+  'models.alert_definition.check.retry': "Retried {0} out of {1} alerts before sending notifications",
 
   'passiveState.turnOn':'Turn On Maintenance Mode',
   'passiveState.turnOff':'Turn Off Maintenance Mode',

http://git-wip-us.apache.org/repos/asf/ambari/blob/a2c6ea46/ambari-web/app/models/alerts/alert_instance.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_instance.js b/ambari-web/app/models/alerts/alert_instance.js
index d8710a0..b366802 100644
--- a/ambari-web/app/models/alerts/alert_instance.js
+++ b/ambari-web/app/models/alerts/alert_instance.js
@@ -37,6 +37,8 @@ App.AlertInstance = DS.Model.extend({
   instance: DS.attr('string'),
   state: DS.attr('string'),
   text: DS.attr('string'),
+  repeatTolerance: DS.attr('number'),
+  repeatToleranceRemaining: DS.attr('number'),
   notification: DS.hasMany('App.AlertNotification'),
 
   /**
@@ -145,6 +147,14 @@ App.AlertInstance = DS.Model.extend({
     'DISABLED': 'icon-off'
   },
 
+  repeatToleranceReceived: function () {
+    return this.get('repeatTolerance') - this.get('repeatToleranceRemaining');
+  }.property('repeatToleranceRemaining', 'repeatTolerance'),
+
+  retryText: function () {
+    return this.get('state') === 'OK' ? '' : Em.I18n.t('models.alert_definition.check.retry').format(this.get('repeatToleranceReceived'),
this.get('repeatTolerance'));
+  }.property('state','repeatToleranceRemaining', 'repeatTolerance'),
+
   /**
    * Define if definition serviceName is Ambari
    * Used in some logic in templates to distinguish definitions with Ambari serviceName

http://git-wip-us.apache.org/repos/asf/ambari/blob/a2c6ea46/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs b/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
index 4debe10..2382de7 100644
--- a/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
+++ b/ambari-web/app/templates/common/modal_popups/alerts_popup.hbs
@@ -43,10 +43,7 @@
                     </div>
                   </div>
                   <div class="status-col" {{bindAttr title="instance.lastTriggered"}}>
-                    {{template "templates/main/alerts/alert_instance/status"}}
-                    <span>
-                      <time>{{instance.lastTriggeredForFormatted}}</time>
-                    </span>
+                      {{view App.AlertInstanceStateView instanceBinding="instance"}}
                   </div>
               </div>
             </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a2c6ea46/ambari-web/app/templates/main/alerts/alert_instance/status.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/alert_instance/status.hbs b/ambari-web/app/templates/main/alerts/alert_instance/status.hbs
index d82bc7b..73cb1e1 100644
--- a/ambari-web/app/templates/main/alerts/alert_instance/status.hbs
+++ b/ambari-web/app/templates/main/alerts/alert_instance/status.hbs
@@ -22,5 +22,11 @@
   {{#if instance.isMaintenanceStateOn}}
     <span class="icon-medkit"></span>
   {{/if}}
-  {{instance.shortStateMsg}}
-</div>
\ No newline at end of file
+  <span rel="StateTooltip" {{bindAttr data-original-title="instance.retryText"}}>
+    {{instance.shortStateMsg}}
+  </span>
+</div>
+<time class="timeago"
+      rel="tooltip" {{bindAttr data-original-title="instance.statusChangedAndLastCheckedFormatted"}}>
+    {{instance.lastTriggeredForFormatted}}
+</time>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/a2c6ea46/ambari-web/app/templates/main/alerts/definition_details.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/definition_details.hbs b/ambari-web/app/templates/main/alerts/definition_details.hbs
index 14b749d..0048226 100644
--- a/ambari-web/app/templates/main/alerts/definition_details.hbs
+++ b/ambari-web/app/templates/main/alerts/definition_details.hbs
@@ -212,11 +212,7 @@
                   {{/if}}
                 </td>
                 <td>
-                  {{template "templates/main/alerts/alert_instance/status"}}
-                  <time class="timeago"
-                        rel="tooltip" {{bindAttr data-original-title="instance.statusChangedAndLastCheckedFormatted"}}>
-                    {{instance.lastTriggeredForFormatted}}
-                  </time>
+                  {{view App.AlertInstanceStateView instanceBinding="instance"}}
                 </td>
                 <td>{{view view.parentView.lastDayCount hostNameBinding="instance.hostName"}}</td>
                 <td>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a2c6ea46/ambari-web/app/views/main/alerts/definition_details_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/definition_details_view.js b/ambari-web/app/views/main/alerts/definition_details_view.js
index 2fc75c1..656021c 100644
--- a/ambari-web/app/views/main/alerts/definition_details_view.js
+++ b/ambari-web/app/views/main/alerts/definition_details_view.js
@@ -318,4 +318,20 @@ App.AlertInstanceServiceHostView = Em.View.extend({
    */
   showSeparator: Em.computed.and('instance.serviceDisplayName', 'instance.hostName')
 
+});
+
+App.AlertInstanceStateView = Em.View.extend({
+
+  templateName: require('templates/main/alerts/alert_instance/status'),
+
+  didInsertElement: function () {
+    App.tooltip(this.$("[rel='StateTooltip']"));
+    App.tooltip(this.$("[rel='tooltip']"));
+  },
+
+  willDestroyElement: function() {
+    this.$("[rel='StateTooltip']").remove();
+    this.$("[rel='tooltip']").remove();
+  }
+
 });
\ No newline at end of file


Mime
View raw message