You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2015/01/22 23:38:06 UTC

ambari git commit: AMBARI-9276. Memory leaks in Firefox after some time on Alerts page. (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 859279a37 -> 943a16ba8


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


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

Branch: refs/heads/trunk
Commit: 943a16ba868b33a4e8aa0b8d31e822be93e2f9f5
Parents: 859279a
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Jan 22 20:23:31 2015 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Jan 23 00:31:33 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |  1 -
 .../main/alert_definitions_controller.js        |  6 +--
 .../alerts/manage_alert_groups_controller.js    |  2 +-
 .../main/host/host_alerts_controller.js         |  2 +-
 .../mappers/alert_definition_summary_mapper.js  |  2 +-
 .../app/mappers/alert_definitions_mapper.js     | 40 +++++---------
 ambari-web/app/models/alert_definition.js       | 56 +++++--------------
 ambari-web/app/models/alert_group.js            | 35 +-----------
 .../app/views/main/alert_definitions_view.js    |  4 +-
 .../app/views/main/service/info/summary.js      |  2 +-
 .../alert_definition_summary_mapper_test.js     | 46 +++++++---------
 .../mappers/alert_definitions_mapper_test.js    | 50 +++++------------
 ambari-web/test/models/alert_group_test.js      | 57 --------------------
 .../views/main/service/info/summary_test.js     |  4 +-
 14 files changed, 68 insertions(+), 239 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index ccfffe3..674f676 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -235,7 +235,6 @@ var files = ['test/init_model_test',
   'test/models/alert_test',
   'test/models/alert_config_test',
   'test/models/alert_definition_test',
-  'test/models/alert_group_test',
   'test/models/alert_instance_test',
   'test/models/authentication_test',
   'test/models/cluster_states_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/app/controllers/main/alert_definitions_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alert_definitions_controller.js b/ambari-web/app/controllers/main/alert_definitions_controller.js
index 4b76d2d..1c670a4 100644
--- a/ambari-web/app/controllers/main/alert_definitions_controller.js
+++ b/ambari-web/app/controllers/main/alert_definitions_controller.js
@@ -47,11 +47,7 @@ App.MainAlertDefinitionsController = Em.ArrayController.extend({
    * </ul>
    * @type {App.AlertDefinition[]}
    */
-  content: function () {
-    var definitions = App.AlertDefinition.getAllDefinitions();
-    definitions.sort(App.AlertDefinition.getSortDefinitionsByStatus(true));
-    return definitions;
-  }.property('mapperTimestamp'),
+  content: App.AlertDefinition.find(),
 
   /**
    * Enable/disable alertDefinition confirmation popup

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/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 373569c..fddd6bb 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
@@ -301,7 +301,7 @@ App.ManageAlertGroupsController = Em.Controller.extend({
     if (selectedAlertGroup.get('default')) return [];
     var usedDefinitionsMap = {};
     var availableDefinitions = [];
-    var sharedDefinitions = App.AlertDefinition.getAllDefinitions();
+    var sharedDefinitions = App.AlertDefinition.find();
 
     selectedAlertGroup.get('definitions').forEach(function (def) {
       usedDefinitionsMap[def.name] = true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/app/controllers/main/host/host_alerts_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/host_alerts_controller.js b/ambari-web/app/controllers/main/host/host_alerts_controller.js
index e753c05..2a47914 100644
--- a/ambari-web/app/controllers/main/host/host_alerts_controller.js
+++ b/ambari-web/app/controllers/main/host/host_alerts_controller.js
@@ -39,7 +39,7 @@ App.MainHostAlertsController = Em.ArrayController.extend({
    * @method routeToAlertDefinition
    */
   routeToAlertDefinition: function (event) {
-    var alertDefinition = App.AlertDefinition.getAllDefinitions().findProperty('id', event.context);
+    var alertDefinition = App.AlertDefinition.find().findProperty('id', event.context);
     App.router.transitionTo('main.alerts.alertDetails', alertDefinition);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/app/mappers/alert_definition_summary_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_definition_summary_mapper.js b/ambari-web/app/mappers/alert_definition_summary_mapper.js
index e85ab29..0642ee6 100644
--- a/ambari-web/app/mappers/alert_definition_summary_mapper.js
+++ b/ambari-web/app/mappers/alert_definition_summary_mapper.js
@@ -23,7 +23,7 @@ App.alertDefinitionSummaryMapper = App.QuickDataMapper.create({
 
   map: function(data) {
     if (!data.alerts_summary_grouped) return;
-    var alertDefinitions = App.AlertDefinition.getAllDefinitions();
+    var alertDefinitions = App.AlertDefinition.find();
     data.alerts_summary_grouped.forEach(function(alertDefinitionSummary) {
       var alertDefinition = alertDefinitions.findProperty('id', alertDefinitionSummary.definition_id);
       if (alertDefinition) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/app/mappers/alert_definitions_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_definitions_mapper.js b/ambari-web/app/mappers/alert_definitions_mapper.js
index 5155180..c4679c1 100644
--- a/ambari-web/app/mappers/alert_definitions_mapper.js
+++ b/ambari-web/app/mappers/alert_definitions_mapper.js
@@ -26,12 +26,6 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
   metricsSourceModel: App.AlertMetricsSourceDefinition,
   metricsUriModel: App.AlertMetricsUriDefinition,
 
-  portModel: App.PortAlertDefinition,
-  metricsModel: App.MetricsAlertDefinition,
-  webModel: App.WebAlertDefinition,
-  aggregateModel: App.AggregateAlertDefinition,
-  scriptModel: App.ScriptAlertDefinition,
-
   config: {
     id: 'AlertDefinition.id',
     name: 'AlertDefinition.name',
@@ -53,7 +47,7 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
 
   portConfig: {
     default_port: 'AlertDefinition.source.default_port',
-    uri: 'AlertDefinition.source.uri'
+    port_uri: 'AlertDefinition.source.uri'
   },
 
   aggregateConfig: {
@@ -76,17 +70,13 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
     if (json && json.items) {
 
       var self = this,
-          portAlertDefinitions = [],
-          metricsAlertDefinitions = [],
-          webAlertDefinitions = [],
-          aggregateAlertDefinitions = [],
-          scriptAlertDefinitions = [],
+          alertDefinitions = [],
           alertReportDefinitions = [],
           alertMetricsSourceDefinitions = [],
           alertMetricsUriDefinitions = [],
           alertGroupsMap = App.cache['previousAlertGroupsMap'],
-          alertDefinitions = App.AlertDefinition.getAllDefinitions(),
-          alertDefinitionsToDelete = alertDefinitions.mapProperty('id'),
+          existingAlertDefinitions = App.AlertDefinition.find(),
+          alertDefinitionsToDelete = existingAlertDefinitions.mapProperty('id'),
           rawSourceData = {};
 
       json.items.forEach(function (item) {
@@ -123,7 +113,7 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
           alertDefinition.groups = alertGroupsMap[alertDefinition.id];
         }
 
-        var oldAlertDefinition = alertDefinitions.findProperty('id', alertDefinition.id);
+        var oldAlertDefinition = existingAlertDefinitions.findProperty('id', alertDefinition.id);
         if (oldAlertDefinition) {
           // new values will be parsed in the another mapper, so for now just use old values
           alertDefinition.summary = oldAlertDefinition.get('summary');
@@ -135,7 +125,7 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
         // map properties dependent on Alert Definition type
         switch (item.AlertDefinition.source.type) {
           case 'PORT':
-            portAlertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('portConfig'))));
+            alertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('portConfig'))));
             break;
           case 'METRIC':
             // map App.AlertMetricsSourceDefinition's
@@ -162,20 +152,20 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
             alertDefinition.uri_id = item.AlertDefinition.id + 'uri';
             item.AlertDefinition.source.uri.id = alertDefinition.uri_id;
             alertMetricsUriDefinitions.push(this.parseIt(item, this.get('uriConfig')));
-            metricsAlertDefinitions.push(alertDefinition);
+            alertDefinitions.push(alertDefinition);
             break;
           case 'WEB':
             // map App.AlertMetricsUriDefinition
             alertDefinition.uri_id = item.AlertDefinition.id + 'uri';
             item.AlertDefinition.source.uri.id = alertDefinition.uri_id;
             alertMetricsUriDefinitions.push(this.parseIt(item, this.get('uriConfig')));
-            webAlertDefinitions.push(alertDefinition);
+            alertDefinitions.push(alertDefinition);
             break;
           case 'AGGREGATE':
-            aggregateAlertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('aggregateConfig'))));
+            alertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('aggregateConfig'))));
             break;
           case 'SCRIPT':
-            scriptAlertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('scriptConfig'))));
+            alertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('scriptConfig'))));
             break;
           default:
             console.error('Incorrect Alert Definition type:', item.AlertDefinition);
@@ -183,7 +173,7 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
       }, this);
 
       alertDefinitionsToDelete.forEach(function(definitionId) {
-        self.deleteRecord(alertDefinitions.findProperty('id', definitionId));
+        self.deleteRecord(existingAlertDefinitions.findProperty('id', definitionId));
       });
 
       // load all mapped data to model
@@ -191,11 +181,7 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
       App.store.loadMany(this.get('metricsSourceModel'), alertMetricsSourceDefinitions);
       this.setMetricsSourcePropertyLists(this.get('metricsSourceModel'), alertMetricsSourceDefinitions);
       App.store.loadMany(this.get('metricsUriModel'), alertMetricsUriDefinitions);
-      App.store.loadMany(this.get('portModel'), portAlertDefinitions);
-      App.store.loadMany(this.get('metricsModel'), metricsAlertDefinitions);
-      App.store.loadMany(this.get('webModel'), webAlertDefinitions);
-      App.store.loadMany(this.get('aggregateModel'), aggregateAlertDefinitions);
-      App.store.loadMany(this.get('scriptModel'), scriptAlertDefinitions);
+      App.store.loadMany(this.get('model'), alertDefinitions);
       this.setAlertDefinitionsRawSourceData(rawSourceData);
       if (App.router.get('mainAlertDefinitionsController')) {
         App.router.set('mainAlertDefinitionsController.mapperTimestamp', (new Date()).getTime());
@@ -220,7 +206,7 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
    * @param rawSourceData
    */
   setAlertDefinitionsRawSourceData: function (rawSourceData) {
-    var allDefinitions = App.AlertDefinition.getAllDefinitions();
+    var allDefinitions = App.AlertDefinition.find();
     for (var alertDefinitionId in rawSourceData) {
       if (rawSourceData.hasOwnProperty(alertDefinitionId)) {
         allDefinitions.findProperty('id', +alertDefinitionId).set('rawSourceData', rawSourceData[alertDefinitionId]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/app/models/alert_definition.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alert_definition.js b/ambari-web/app/models/alert_definition.js
index b525273..d8b774f 100644
--- a/ambari-web/app/models/alert_definition.js
+++ b/ambari-web/app/models/alert_definition.js
@@ -35,6 +35,19 @@ App.AlertDefinition = DS.Model.extend({
   reporting: DS.hasMany('App.AlertReportDefinition'),
   lastTriggered: DS.attr('number'),
 
+  //relates only to SCRIPT-type alert definition
+  location: DS.attr('string'),
+  //relates only to AGGREGATE-type alert definition
+  alertName: DS.attr('string'),
+  //relates only to WEB and METRIC types of alert definition
+  uri: DS.belongsTo('App.AlertMetricsUriDefinition'),
+  //relates only METRIC-type alert definition
+  jmx: DS.belongsTo('App.AlertMetricsSourceDefinition'),
+  ganglia: DS.belongsTo('App.AlertMetricsSourceDefinition'),
+  //relates only PORT-type alert definition
+  defaultPort: DS.attr('number'),
+  portUri: DS.attr('string'),
+
   /**
    * Raw data from AlertDefinition/source
    * used to format request content for updating alert definition
@@ -280,21 +293,6 @@ App.AlertDefinition = DS.Model.extend({
 App.AlertDefinition.reopenClass({
 
   /**
-   * Get all available AlertDefinitions
-   * @returns {Array|string}
-   * @method getAllDefinitions
-   */
-  getAllDefinitions: function () {
-    return Array.prototype.concat.call(
-        Array.prototype, App.PortAlertDefinition.find().toArray(),
-        App.MetricsAlertDefinition.find().toArray(),
-        App.WebAlertDefinition.find().toArray(),
-        App.AggregateAlertDefinition.find().toArray(),
-        App.ScriptAlertDefinition.find().toArray()
-    )
-  },
-
-  /**
    * Return function to sort list of AlertDefinitions by their status
    * It sorts according to <code>severityOrder</code>
    * @param {boolean} order true - DESC, false - ASC
@@ -339,35 +337,7 @@ App.AlertMetricsUriDefinition = DS.Model.extend({
   httpsPropertyValue: DS.attr('string')
 });
 
-App.PortAlertDefinition = App.AlertDefinition.extend({
-  defaultPort: DS.attr('number'),
-  uri: DS.attr('string')
-});
-
-App.MetricsAlertDefinition = App.AlertDefinition.extend({
-  jmx: DS.belongsTo('App.AlertMetricsSourceDefinition'),
-  ganglia: DS.belongsTo('App.AlertMetricsSourceDefinition'),
-  uri: DS.belongsTo('App.AlertMetricsUriDefinition')
-});
-
-App.WebAlertDefinition = App.AlertDefinition.extend({
-  uri: DS.belongsTo('App.AlertMetricsUriDefinition')
-});
-
-App.AggregateAlertDefinition = App.AlertDefinition.extend({
-  alertName: DS.attr('string')
-});
-
-App.ScriptAlertDefinition = App.AlertDefinition.extend({
-  location: DS.attr('string')
-});
-
 App.AlertDefinition.FIXTURES = [];
 App.AlertReportDefinition.FIXTURES = [];
 App.AlertMetricsSourceDefinition.FIXTURES = [];
-App.PortAlertDefinition.FIXTURES = [];
 App.AlertMetricsUriDefinition.FIXTURES = [];
-App.MetricsAlertDefinition.FIXTURES = [];
-App.WebAlertDefinition.FIXTURES = [];
-App.AggregateAlertDefinition.FIXTURES = [];
-App.ScriptAlertDefinition.FIXTURES = [];

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/app/models/alert_group.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alert_group.js b/ambari-web/app/models/alert_group.js
index 15e88b2..df038d6 100644
--- a/ambari-web/app/models/alert_group.js
+++ b/ambari-web/app/models/alert_group.js
@@ -44,40 +44,7 @@ App.AlertGroup = DS.Model.extend({
   /**
    * @type {App.AlertDefinition[]}
    */
-  definitions: function () {
-    return Array.prototype.concat.call(
-      Array.prototype, this.get('portAlertDefinitions').toArray(),
-      this.get('metricsAlertDefinitions').toArray(),
-      this.get('webAlertDefinitions').toArray(),
-      this.get('aggregateAlertDefinitions').toArray(),
-      this.get('scriptAlertDefinitions').toArray()
-    );
-  }.property('portAlertDefinitions.length', 'metricsAlertDefinitions.length', 'webAlertDefinitions.length', 'aggregateAlertDefinitions.length', 'scriptAlertDefinitions.length'),
-
-  /**
-   * @type {App.PortAlertDefinition[]}
-   */
-  portAlertDefinitions: DS.hasMany('App.PortAlertDefinition'),
-
-  /**
-   * @type {App.MetricsAlertDefinition[]}
-   */
-  metricsAlertDefinitions: DS.hasMany('App.MetricsAlertDefinition'),
-
-  /**
-   * @type {App.WebAlertDefinition[]}
-   */
-  webAlertDefinitions: DS.hasMany('App.WebAlertDefinition'),
-
-  /**
-   * @type {App.AggregateAlertDefinition[]}
-   */
-  aggregateAlertDefinitions: DS.hasMany('App.AggregateAlertDefinition'),
-
-  /**
-   * @type {App.ScriptAlertDefinition[]}
-   */
-  scriptAlertDefinitions: DS.hasMany('App.ScriptAlertDefinition'),
+  definitions: App.AlertDefinition.find(),
 
   /**
    * @type {App.AlertNotification[]}

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/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 e90d8a9..737c9f2 100644
--- a/ambari-web/app/views/main/alert_definitions_view.js
+++ b/ambari-web/app/views/main/alert_definitions_view.js
@@ -26,7 +26,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
   templateName: require('templates/main/alerts'),
 
   content: function() {
-    return this.get('controller.content');
+    return this.get('controller.content') ? this.get('controller.content').toArray().sort(App.AlertDefinition.getSortDefinitionsByStatus(true)) : [];
   }.property('controller.content.@each'),
 
   willInsertElement: function () {
@@ -503,7 +503,7 @@ App.MainAlertDefinitionsView = App.TableView.extend({
     Em.run.next(this, function () {
       App.tooltip($(".enable-disable-button, .timeago"));
     });
-  }.observes('pageContent.@each'),
+  }.observes('pageContent.@each.enabled', 'pageContent.@each.lastTriggeredFormatted'),
 
   updateFilter: function (iColumn, value, type) {
     if (!this.get('isInitialRendering')) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index cf40900..e661291 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -257,7 +257,7 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
    * @type {Boolean}
    */
   hasAlertDefinitions: function () {
-    return App.AlertDefinition.getAllDefinitions().someProperty('serviceName', this.get('controller.content.serviceName'));
+    return App.AlertDefinition.find().someProperty('serviceName', this.get('controller.content.serviceName'));
   }.property('controller.content.serviceName'),
 
   restartRequiredHostsAndComponents:function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/alert_definition_summary_mapper_test.js b/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
index af1d952..946839a 100644
--- a/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
+++ b/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
@@ -24,12 +24,12 @@ describe('App.alertDefinitionSummaryMapper', function () {
   describe('#map', function() {
 
     var testModels = [
-        App.PortAlertDefinition.createRecord({id: 1, enabled: true, type: 'PORT'}),
-        App.MetricsAlertDefinition.createRecord({id: 2, enabled: true, type: 'METRICS'}),
-        App.WebAlertDefinition.createRecord({id: 3, enabled: true, type: 'WEB'}),
-        App.AggregateAlertDefinition.createRecord({id: 4, enabled: true, type: 'AGGREGATE'}),
-        App.ScriptAlertDefinition.createRecord({id: 5, enabled: true, type: 'SCRIPT'}),
-        App.ScriptAlertDefinition.createRecord({id: 6, enabled: false, type: 'SCRIPT', summary: {OK: 1}})
+        App.AlertDefinition.createRecord({id: 1, enabled: true, type: 'PORT'}),
+        App.AlertDefinition.createRecord({id: 2, enabled: true, type: 'METRICS'}),
+        App.AlertDefinition.createRecord({id: 3, enabled: true, type: 'WEB'}),
+        App.AlertDefinition.createRecord({id: 4, enabled: true, type: 'AGGREGATE'}),
+        App.AlertDefinition.createRecord({id: 5, enabled: true, type: 'SCRIPT'}),
+        App.AlertDefinition.createRecord({id: 6, enabled: false, type: 'SCRIPT', summary: {OK: 1}})
       ],
       dataToMap = {
         alerts_summary_grouped: [
@@ -83,48 +83,40 @@ describe('App.alertDefinitionSummaryMapper', function () {
 
     beforeEach(function() {
 
-      sinon.stub(App.PortAlertDefinition, 'find', function() {return testModels.filterProperty('type', 'PORT');});
-      sinon.stub(App.MetricsAlertDefinition, 'find', function() {return testModels.filterProperty('type', 'METRICS');});
-      sinon.stub(App.WebAlertDefinition, 'find', function() {return testModels.filterProperty('type', 'WEB');});
-      sinon.stub(App.AggregateAlertDefinition, 'find', function() {return testModels.filterProperty('type', 'AGGREGATE');});
-      sinon.stub(App.ScriptAlertDefinition, 'find', function() {return testModels.filterProperty('type', 'SCRIPT');});
+      sinon.stub(App.AlertDefinition, 'find', function() {return testModels;});
 
     });
 
     afterEach(function() {
 
-      App.PortAlertDefinition.find.restore();
-      App.MetricsAlertDefinition.find.restore();
-      App.WebAlertDefinition.find.restore();
-      App.AggregateAlertDefinition.find.restore();
-      App.ScriptAlertDefinition.find.restore();
+      App.AlertDefinition.find.restore();
 
     });
 
     it('should map summary info for each alert', function() {
 
       App.alertDefinitionSummaryMapper.map(dataToMap);
-      expect(App.PortAlertDefinition.find().findProperty('id', 1).get('lastTriggered')).to.equal(2);
-      expect(App.PortAlertDefinition.find().findProperty('id', 1).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, WARNING: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, CRITICAL: {count: 0, maintenanceCount: 1}, UNKNOWN: {count: 0, maintenanceCount: 0}});
+      expect(App.AlertDefinition.find().findProperty('id', 1).get('lastTriggered')).to.equal(2);
+      expect(App.AlertDefinition.find().findProperty('id', 1).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, WARNING: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, CRITICAL: {count: 0, maintenanceCount: 1}, UNKNOWN: {count: 0, maintenanceCount: 0}});
 
-      expect(App.MetricsAlertDefinition.find().findProperty('id', 2).get('lastTriggered')).to.equal(3);
-      expect(App.MetricsAlertDefinition.find().findProperty('id', 2).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "HTTP 200 response in 0.000 seconds"}, WARNING: {count: 5, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, CRITICAL: {count: 1, maintenanceCount: 0}, UNKNOWN: {count: 1, maintenanceCount: 0}});
+      expect(App.AlertDefinition.find().findProperty('id', 2).get('lastTriggered')).to.equal(3);
+      expect(App.AlertDefinition.find().findProperty('id', 2).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "HTTP 200 response in 0.000 seconds"}, WARNING: {count: 5, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, CRITICAL: {count: 1, maintenanceCount: 0}, UNKNOWN: {count: 1, maintenanceCount: 0}});
 
-      expect(App.WebAlertDefinition.find().findProperty('id', 3).get('lastTriggered')).to.equal(4);
-      expect(App.WebAlertDefinition.find().findProperty('id', 3).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "HTTP 200 response in 0.000 seconds"}, WARNING: {count: 2, maintenanceCount: 2}, CRITICAL: {count: 3, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, UNKNOWN: {count: 4, maintenanceCount: 0}});
+      expect(App.AlertDefinition.find().findProperty('id', 3).get('lastTriggered')).to.equal(4);
+      expect(App.AlertDefinition.find().findProperty('id', 3).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "HTTP 200 response in 0.000 seconds"}, WARNING: {count: 2, maintenanceCount: 2}, CRITICAL: {count: 3, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, UNKNOWN: {count: 4, maintenanceCount: 0}});
 
-      expect(App.AggregateAlertDefinition.find().findProperty('id', 4).get('lastTriggered')).to.equal(2);
-      expect(App.AggregateAlertDefinition.find().findProperty('id', 4).get('summary')).to.eql({OK: {count: 4, maintenanceCount: 0, latestText : "HTTP 200 response in 0.000 seconds"}, WARNING: {count: 3, maintenanceCount: 0}, CRITICAL: {count: 2, maintenanceCount: 0}, UNKNOWN: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}});
+      expect(App.AlertDefinition.find().findProperty('id', 4).get('lastTriggered')).to.equal(2);
+      expect(App.AlertDefinition.find().findProperty('id', 4).get('summary')).to.eql({OK: {count: 4, maintenanceCount: 0, latestText : "HTTP 200 response in 0.000 seconds"}, WARNING: {count: 3, maintenanceCount: 0}, CRITICAL: {count: 2, maintenanceCount: 0}, UNKNOWN: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}});
 
-      expect(App.ScriptAlertDefinition.find().findProperty('id', 5).get('lastTriggered')).to.equal(4);
-      expect(App.ScriptAlertDefinition.find().findProperty('id', 5).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, WARNING: {count: 1, maintenanceCount: 0}, CRITICAL: {count: 1, maintenanceCount: 0}, UNKNOWN: {count: 1, maintenanceCount: 0}});
+      expect(App.AlertDefinition.find().findProperty('id', 5).get('lastTriggered')).to.equal(4);
+      expect(App.AlertDefinition.find().findProperty('id', 5).get('summary')).to.eql({OK: {count: 1, maintenanceCount: 0, latestText : "Connection failed: [Errno 111] Connection refused to c6407.ambari.apache.org:60000"}, WARNING: {count: 1, maintenanceCount: 0}, CRITICAL: {count: 1, maintenanceCount: 0}, UNKNOWN: {count: 1, maintenanceCount: 0}});
 
     });
 
     it('should clear summary for disabled definitions', function () {
 
       App.alertDefinitionSummaryMapper.map(dataToMap);
-      expect(App.ScriptAlertDefinition.find().findProperty('id', 6).get('summary')).to.eql({});
+      expect(App.AlertDefinition.find().findProperty('id', 6).get('summary')).to.eql({});
 
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/test/mappers/alert_definitions_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/alert_definitions_mapper_test.js b/ambari-web/test/mappers/alert_definitions_mapper_test.js
index a9ea04e..3f6ed93 100644
--- a/ambari-web/test/mappers/alert_definitions_mapper_test.js
+++ b/ambari-web/test/mappers/alert_definitions_mapper_test.js
@@ -189,23 +189,11 @@ describe('App.alertDefinitionsMapper', function () {
       App.alertDefinitionsMapper.setProperties({
         'model': {},
 
-        'portModel': {},
-        'metricsModel': {},
-        'webModel': {},
-        'aggregateModel': {},
-        'scriptModel': {},
-
         'reportModel': {},
         'metricsSourceModel': {},
         'metricsUriModel': {}
       });
 
-      sinon.stub(App.PortAlertDefinition, 'find', function() {return [];});
-      sinon.stub(App.MetricsAlertDefinition, 'find', function() {return [];});
-      sinon.stub(App.WebAlertDefinition, 'find', function() {return [];});
-      sinon.stub(App.AggregateAlertDefinition, 'find', function() {return [];});
-      sinon.stub(App.ScriptAlertDefinition, 'find', function() {return [];});
-
       sinon.stub(App.alertDefinitionsMapper, 'deleteRecord', Em.K);
 
       sinon.stub(App.store, 'commit', Em.K);
@@ -229,23 +217,11 @@ describe('App.alertDefinitionsMapper', function () {
       App.alertDefinitionsMapper.setProperties({
         'model': App.AlertDefinition,
 
-        'portModel': App.PortAlertDefinition,
-        'metricsModel': App.MetricsAlertDefinition,
-        'webModel': App.WebAlertDefinition,
-        'aggregateModel': App.AggregateAlertDefinition,
-        'scriptModel': App.ScriptAlertDefinition,
-
         'reportModel': App.AlertReportDefinition,
         'metricsSourceModel': App.AlertMetricsSourceDefinition,
         'metricsUriModel': App.AlertMetricsUriDefinition
       });
 
-      App.PortAlertDefinition.find.restore();
-      App.MetricsAlertDefinition.find.restore();
-      App.WebAlertDefinition.find.restore();
-      App.AggregateAlertDefinition.find.restore();
-      App.ScriptAlertDefinition.find.restore();
-
       App.alertDefinitionsMapper.deleteRecord.restore();
 
       App.router.get.restore();
@@ -297,7 +273,7 @@ describe('App.alertDefinitionsMapper', function () {
       });
 
       it('parsing metrics model', function() {
-        testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('metricsModel.content'));
+        testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('model.content'));
       });
 
       it('parse metrics source', function() {
@@ -343,7 +319,7 @@ describe('App.alertDefinitionsMapper', function () {
       });
 
       it('parsing web model', function() {
-        testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('webModel.content'));
+        testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('model.content'));
       });
 
 
@@ -373,7 +349,7 @@ describe('App.alertDefinitionsMapper', function () {
         ];
       App.alertDefinitionsMapper.map(data);
 
-      testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('aggregateModel.content'));
+      testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('model.content'));
 
     });
 
@@ -397,7 +373,7 @@ describe('App.alertDefinitionsMapper', function () {
         ];
       App.alertDefinitionsMapper.map(data);
 
-      testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('scriptModel.content'));
+      testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('model.content'));
 
     });
 
@@ -417,12 +393,12 @@ describe('App.alertDefinitionsMapper', function () {
             "interval":1,
             "type":"PORT",
             "default_port":2181,
-            "uri":"{{zookeeper-env/clientPort}}"
+            "port_uri":"{{zookeeper-env/clientPort}}"
           }
         ];
       App.alertDefinitionsMapper.map(data);
 
-      testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('portModel.content'));
+      testHelpers.nestedExpect(expected, App.alertDefinitionsMapper.get('model.content'));
 
     });
 
@@ -438,11 +414,11 @@ describe('App.alertDefinitionsMapper', function () {
 
       App.alertDefinitionsMapper.map(json);
 
-      expect(App.alertDefinitionsMapper.get('portModel.content')[0].groups).to.eql([1, 4]);
-      expect(App.alertDefinitionsMapper.get('metricsModel.content')[0].groups).to.eql([5, 1]);
-      expect(App.alertDefinitionsMapper.get('webModel.content')[0].groups).to.eql([4, 3]);
-      expect(App.alertDefinitionsMapper.get('aggregateModel.content')[0].groups).to.eql([3, 2]);
-      expect(App.alertDefinitionsMapper.get('scriptModel.content')[0].groups).to.eql([2, 5]);
+      expect(App.alertDefinitionsMapper.get('model.content')[0].groups).to.eql([5, 1]);
+      expect(App.alertDefinitionsMapper.get('model.content')[1].groups).to.eql([4, 3]);
+      expect(App.alertDefinitionsMapper.get('model.content')[2].groups).to.eql([3, 2]);
+      expect(App.alertDefinitionsMapper.get('model.content')[3].groups).to.eql([2, 5]);
+      expect(App.alertDefinitionsMapper.get('model.content')[4].groups).to.eql([1, 4]);
 
 
     });
@@ -455,14 +431,14 @@ describe('App.alertDefinitionsMapper', function () {
 
       beforeEach(function () {
 
-        sinon.stub(App.AlertDefinition, 'getAllDefinitions', function () {
+        sinon.stub(App.AlertDefinition, 'find', function () {
           return definitions;
         });
 
       });
 
       afterEach(function() {
-        App.AlertDefinition.getAllDefinitions.restore();
+        App.AlertDefinition.find.restore();
       });
 
       it('should delete PORT alert definition with id 100500', function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/test/models/alert_group_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/alert_group_test.js b/ambari-web/test/models/alert_group_test.js
deleted file mode 100644
index 37168c7..0000000
--- a/ambari-web/test/models/alert_group_test.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-require('models/alert_group');
-
-var model;
-
-describe('App.AlertGroup', function () {
-
-  beforeEach(function () {
-
-    model = App.AlertGroup.createRecord();
-
-  });
-
-  describe('#definitions', function () {
-
-    beforeEach(function () {
-
-      model.reopen({
-        portAlertDefinitions: [1],
-        metricsAlertDefinitions: [2, 3],
-        webAlertDefinitions: [4],
-        aggregateAlertDefinitions: [],
-        scriptAlertDefinitions: [6]
-      });
-
-    });
-
-    it('should concatenate all types of definitions', function () {
-      expect(model.get('definitions')).to.eql([1,2,3,4,6]);
-      model.set('aggregateAlertDefinitions', [5]);
-      expect(model.get('definitions')).to.eql([1,2,3,4,5,6]);
-      model.set('scriptAlertDefinitions', []);
-      expect(model.get('definitions')).to.eql([1,2,3,4,5]);
-    });
-
-  });
-
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/943a16ba/ambari-web/test/views/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js
index 1d40d5a..303fdfb 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -107,7 +107,7 @@ describe('App.MainServiceInfoSummaryView', function() {
   describe('#hasAlertDefinitions', function () {
 
     beforeEach(function () {
-      sinon.stub(App.AlertDefinition, 'getAllDefinitions', function () {
+      sinon.stub(App.AlertDefinition, 'find', function () {
         return [
           {
             serviceName: 'HDFS'
@@ -120,7 +120,7 @@ describe('App.MainServiceInfoSummaryView', function() {
     });
 
     afterEach(function () {
-      App.AlertDefinition.getAllDefinitions.restore();
+      App.AlertDefinition.find.restore();
     });
 
     it('should return true if at least one alert definition for this service exists', function () {