You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/08/12 13:21:02 UTC

[2/5] ambari git commit: Revert "AMBARI-12714. FE: Adding 100 definitions to the alert group takes to much time (onechiporenko)"

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

This reverts commit 6067dfaccf067e77dbdacce423ebf3c68d2e5bb7.


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

Branch: refs/heads/branch-2.1.1
Commit: 1f2870cd0c90229348a6f5658b9c57db2b47952c
Parents: 5c2a792
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Aug 12 14:19:41 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Aug 12 14:19:41 2015 +0300

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


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

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f2870cd/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 dc1fc1f..67d3397 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,7 +212,8 @@ describe('App.ManageAlertGroupsController', function () {
     };
 
     var result = function (originalDefs, addedDefs) {
-      return originalDefs.concat(addedDefs);
+      var result = originalDefs.concat(addedDefs);
+      return result;
     };
 
     var tests = [