ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-9276. Memory leaks in Firefox after some time on Alerts page. Additional patch. (akovalenko)
Date Fri, 30 Jan 2015 12:04:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk bfa0e4aec -> cb4df42ff


AMBARI-9276. Memory leaks in Firefox after some time on Alerts page. Additional patch. (akovalenko)


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

Branch: refs/heads/trunk
Commit: cb4df42ff706c6b05590b6951149504269db509c
Parents: bfa0e4a
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Thu Jan 29 20:38:29 2015 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Fri Jan 30 13:54:40 2015 +0200

----------------------------------------------------------------------
 .../alert_definitions_actions_controller.js     |  1 +
 .../alerts/manage_alert_groups_controller.js    |  6 ++++
 .../app/views/main/alert_definitions_view.js    | 34 ++++++++++++--------
 3 files changed, 28 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cb4df42f/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
b/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
index b8a8af6..96df2ac 100644
--- a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
+++ b/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
@@ -154,6 +154,7 @@ App.MainAlertDefinitionActionsController = Em.ArrayController.extend({
                 });
               }
               App.router.get('updateController').updateAlertGroups(function () {
+                App.router.get('manageAlertGroupsController').toggleProperty('changeTrigger');
                 App.router.get('updateController').updateAlertDefinitions(function() {
                   App.router.get('updateController').updateAlertNotifications(Em.K);
                 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb4df42f/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js b/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
index fddd6bb..b2ead3f 100644
--- a/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
+++ b/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
@@ -31,6 +31,12 @@ App.ManageAlertGroupsController = Em.Controller.extend({
   isLoaded: false,
 
   /**
+   * Property used to trigger Alert Groups Filter content updating
+   * @type {Boolean}
+   */
+  changeTrigger: false,
+
+  /**
    * @type {App.AlertGroup[]}
    */
   alertGroups: [],

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb4df42f/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 737c9f2..05d4186 100644
--- a/ambari-web/app/views/main/alert_definitions_view.js
+++ b/ambari-web/app/views/main/alert_definitions_view.js
@@ -53,12 +53,17 @@ App.MainAlertDefinitionsView = App.TableView.extend({
 
   didInsertElement: function () {
     var self = this;
-    this.tooltipsUpdater();
     Em.run.next(function () {
       self.set('isInitialRendering', false);
+      self.tooltipsUpdater();
+      self.addObserver('pageContent.length', self, 'tooltipsUpdater');
     });
   },
 
+  willDestroyElement: function () {
+    this.removeObserver('pageContent.length', this, 'tooltipsUpdater');
+  },
+
   /**
    * Save <code>startIndex</code> to the localStorage
    * @method saveStartIndex
@@ -401,27 +406,30 @@ App.MainAlertDefinitionsView = App.TableView.extend({
      * @method updateContent
      */
     updateContent: function() {
-      var alertGroups = App.AlertGroup.find().map(function (group) {
-        return Em.Object.create({
+      var defaultGroups = [];
+      var customGroups = [];
+      App.AlertGroup.find().forEach(function (group) {
+        var item = Em.Object.create({
           value: group.get('id'),
-          label: group.get('displayNameDefinitions'),
-          default: group.get('default')
+          label: group.get('displayNameDefinitions')
         });
+        if (group.get('default')) {
+          defaultGroups.push(item);
+        } else {
+          customGroups.push(item);
+        }
       });
-      var defaultGroups = alertGroups.filterProperty('default');
-      defaultGroups.forEach(function(defaultGroup) {
-        alertGroups.removeObject(defaultGroup);
-      });
-      var sortedGroups = defaultGroups.sortProperty('label').concat(alertGroups.sortProperty('label'));
+      defaultGroups = defaultGroups.sortProperty('label');
+      customGroups = customGroups.sortProperty('label');
 
       this.set('content', [
         Em.Object.create({
           value: '',
           label: Em.I18n.t('common.all') + ' (' + this.get('parentView.controller.content.length')
+ ')'
         })
-      ].concat(sortedGroups));
+      ].concat(defaultGroups, customGroups));
       this.onValueChange();
-    }.observes('App.router.clusterController.isLoaded', 'controller.mapperTimestamp'),
+    }.observes('App.router.clusterController.isLoaded', 'App.router.manageAlertGroupsController.changeTrigger'),
 
     selectCategory: function (event) {
       var category = event.context;
@@ -503,7 +511,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
     Em.run.next(this, function () {
       App.tooltip($(".enable-disable-button, .timeago"));
     });
-  }.observes('pageContent.@each.enabled', 'pageContent.@each.lastTriggeredFormatted'),
+  },
 
   updateFilter: function (iColumn, value, type) {
     if (!this.get('isInitialRendering')) {


Mime
View raw message