ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-12714. FE: Adding 100 definitions to the alert group takes to much time (onechiporenko)
Date Tue, 11 Aug 2015 09:24:17 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1.1 bd6e95ffd -> 6067dfacc


AMBARI-12714. FE: Adding 100 definitions to the alert group takes to much time (onechiporenko)


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

Branch: refs/heads/branch-2.1.1
Commit: 6067dfaccf067e77dbdacce423ebf3c68d2e5bb7
Parents: bd6e95f
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Tue Aug 11 12:16:05 2015 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Tue Aug 11 12:21:50 2015 +0300

----------------------------------------------------------------------
 .../alerts/manage_alert_groups_controller.js    | 39 +++++++++++---------
 .../manage_alert_groups_controller_test.js      |  3 +-
 2 files changed, 22 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6067dfac/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 b2ead3f..2ca2536 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
@@ -163,13 +163,15 @@ App.ManageAlertGroupsController = Em.Controller.extend({
    * @method loadAlertNotifications
    */
   loadAlertNotifications: function () {
-    this.set('isLoaded', false);
-    this.set('alertGroups', []);
-    this.set('originalAlertGroups', []);
-    this.set('selectedAlertGroup', null);
-    this.set('isRemoveButtonDisabled', true);
-    this.set('isRenameButtonDisabled', true);
-    this.set('isDuplicateButtonDisabled', true);
+    this.setProperties({
+      isLoaded: false,
+      alertGroups: [],
+      originalAlertGroups: [],
+      selectedAlertGroup: null,
+      isRemoveButtonDisabled: true,
+      isRenameButtonDisabled: true,
+      isDuplicateButtonDisabled: true
+    });
     return App.ajax.send({
       name: 'alerts.notifications',
       sender: this,
@@ -244,10 +246,12 @@ App.ManageAlertGroupsController = Em.Controller.extend({
         notifications: targets
       });
     });
-    this.set('alertGroups', alertGroups);
-    this.set('isLoaded', true);
-    this.set('originalAlertGroups', this.copyAlertGroups(this.get('alertGroups')));
-    this.set('selectedAlertGroup', this.get('alertGroups')[0]);
+    this.setProperties({
+      alertGroups: alertGroups,
+      isLoaded: true,
+      originalAlertGroups: this.copyAlertGroups(alertGroups),
+      selectedAlertGroup: this.get('alertGroups')[0]
+    });
   },
 
   /**
@@ -257,9 +261,11 @@ App.ManageAlertGroupsController = Em.Controller.extend({
   buttonObserver: function () {
     var selectedAlertGroup = this.get('selectedAlertGroup');
     var flag = selectedAlertGroup && selectedAlertGroup.get('default');
-    this.set('isRemoveButtonDisabled', flag);
-    this.set('isRenameButtonDisabled', flag);
-    this.set('isDuplicateButtonDisabled', false);
+    this.setProperties({
+      isRemoveButtonDisabled: flag,
+      isRenameButtonDisabled: flag,
+      isDuplicateButtonDisabled: false
+    });
   }.observes('selectedAlertGroup'),
 
   /**
@@ -433,10 +439,7 @@ App.ManageAlertGroupsController = Em.Controller.extend({
   addDefinitionsCallback: function (selectedDefs) {
     var group = this.get('selectedAlertGroup');
     if (selectedDefs) {
-      var alertGroupDefs = group.get('definitions');
-      selectedDefs.forEach(function (defObj) {
-        alertGroupDefs.pushObject(defObj);
-      }, this);
+      group.get('definitions').pushObjects(selectedDefs);
     }
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6067dfac/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
b/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
index 67d3397..dc1fc1f 100644
--- a/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/manage_alert_groups_controller_test.js
@@ -212,8 +212,7 @@ describe('App.ManageAlertGroupsController', function () {
     };
 
     var result = function (originalDefs, addedDefs) {
-      var result = originalDefs.concat(addedDefs);
-      return result;
+      return originalDefs.concat(addedDefs);
     };
 
     var tests = [


Mime
View raw message