ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [1/6] ambari git commit: AMBARI-10139. Service alerts popup: status label has redundant tooltip (alexantonenko)
Date Thu, 19 Mar 2015 23:41:23 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk faae1cbe0 -> 30bd08b51


AMBARI-10139. Service alerts popup: status label has redundant tooltip (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 30bd08b510ef089280a9b26ff8adff4b49f0a04b
Parents: a35d929
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Mar 19 23:28:10 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Fri Mar 20 01:40:59 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/models/alert_instance.js                   |  9 +++++++++
 ambari-web/app/templates/main/host/host_alerts.hbs        |  6 +++---
 .../templates/main/service/info/service_alert_popup.hbs   |  2 +-
 ambari-web/app/views/main/alert_definitions_view.js       |  4 +++-
 ambari-web/test/models/alert_instance_test.js             | 10 ++++++++++
 5 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/30bd08b5/ambari-web/app/models/alert_instance.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alert_instance.js b/ambari-web/app/models/alert_instance.js
index 46585b7..33df293 100644
--- a/ambari-web/app/models/alert_instance.js
+++ b/ambari-web/app/models/alert_instance.js
@@ -118,6 +118,15 @@ App.AlertInstance = DS.Model.extend({
   }.property('originalTimestamp'),
 
   /**
+  * escaped '<' and '>' special characters.
+  * @type {string}
+  */  
+  escapeSpecialCharactersFromTooltip: function () {
+    var displayedText = this.get('text');
+    return  displayedText.replace(/[<>]/g, '');
+  }.property('text'),
+
+  /**
    * Formatted lastChecked and lastTriggered timestamp
    * @returns {string}
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/30bd08b5/ambari-web/app/templates/main/host/host_alerts.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/host_alerts.hbs b/ambari-web/app/templates/main/host/host_alerts.hbs
index 344fb7a..675f02e 100644
--- a/ambari-web/app/templates/main/host/host_alerts.hbs
+++ b/ambari-web/app/templates/main/host/host_alerts.hbs
@@ -52,15 +52,15 @@
             <a href="#" {{action routeToAlertDefinition alertInstance.definitionId target="controller"}}>{{alertInstance.label}}</a>
           </td>
           <td>{{{alertInstance.status}}} <time class="timeago" {{bindAttr data-original-title="alertInstance.statusChangedAndLastCheckedFormatted"}}>{{alertInstance.lastTriggeredForFormatted}}</time></td>
-          <td><span class="alert-text" {{bindAttr data-original-title="alertInstance.text"}}
class="alert-text">{{alertInstance.text}}</span></td>
+          <td><span class="alert-text" {{bindAttr data-original-title="alertInstance.escapeSpecialCharactersFromTooltip"}}
class="alert-text">{{alertInstance.text}}</span></td>
         </tr>
       {{/each}}
     {{else}}
       <tr>
-        <td class="first"></td>
-        <td colspan="3">
+        <td class="first">
           {{t alerts.table.noAlerts}}
         </td>
+        <td colspan="3"></td>
       </tr>
     {{/if}}
     </tbody>

http://git-wip-us.apache.org/repos/asf/ambari/blob/30bd08b5/ambari-web/app/templates/main/service/info/service_alert_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/service_alert_popup.hbs b/ambari-web/app/templates/main/service/info/service_alert_popup.hbs
index 6f02970..8090b59 100644
--- a/ambari-web/app/templates/main/service/info/service_alert_popup.hbs
+++ b/ambari-web/app/templates/main/service/info/service_alert_popup.hbs
@@ -29,7 +29,7 @@
               {{alert.latestText}}
             </div>
           </div>
-          <div class="span5 status-col" rel="alert-status-tooltip" {{bindAttr title="alert.lastTriggered"}}>
+          <div class="span5 status-col" rel="alert-status-tooltip" >
             <span class="timeago" {{bindAttr data-original-title="alert.lastTriggeredVerboseDisplay"}}>
               <span class="status-icon">{{{alert.status}}}</span>
               <time>{{alert.lastTriggeredForFormatted}}</time>

http://git-wip-us.apache.org/repos/asf/ambari/blob/30bd08b5/ambari-web/app/views/main/alert_definitions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alert_definitions_view.js b/ambari-web/app/views/main/alert_definitions_view.js
index 6b0cecd..28d15df 100644
--- a/ambari-web/app/views/main/alert_definitions_view.js
+++ b/ambari-web/app/views/main/alert_definitions_view.js
@@ -56,7 +56,6 @@ App.MainAlertDefinitionsView = App.TableView.extend({
     Em.run.next(function () {
       self.set('isInitialRendering', false);
       self.tooltipsUpdater();
-      self.addObserver('pageContent.length', self, 'tooltipsUpdater');
     });
   },
 
@@ -494,6 +493,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
     if (this.get('paginationLeftClass') === 'paginate_previous') {
       this._super();
     }
+    this.tooltipsUpdater();
   },
 
   /**
@@ -504,6 +504,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
     if (this.get('paginationRightClass') === 'paginate_next') {
       this._super();
     }
+    this.tooltipsUpdater();
   },
 
   /**
@@ -520,6 +521,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
     if (!this.get('isInitialRendering')) {
       this._super(iColumn, value, type);
     }
+    this.tooltipsUpdater();
   }
 
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/30bd08b5/ambari-web/test/models/alert_instance_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/alert_instance_test.js b/ambari-web/test/models/alert_instance_test.js
index e87e71f..dc692e2 100644
--- a/ambari-web/test/models/alert_instance_test.js
+++ b/ambari-web/test/models/alert_instance_test.js
@@ -81,4 +81,14 @@ describe('App.AlertInstance', function () {
 
   });
 
+  describe('#escapeSpecialCharactersFromTooltip', function () {
+    it('it Should Display Alert Without special characters "<" and ">"', function ()
{
+
+      model.set('text', '<urlopen error [Errno 111] Connection refused>');
+      var resultedText = model.get('escapeSpecialCharactersFromTooltip');
+
+      expect(resultedText).to.equal('urlopen error [Errno 111] Connection refused');
+    });
+  });
+
 });


Mime
View raw message