You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2014/12/02 17:42:34 UTC
ambari git commit: AMBARI-8511. Alerts UI: Disabling alert-definition
not updating alert-instance counts (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 3eaaef1d4 -> c6f574349
AMBARI-8511. Alerts UI: Disabling alert-definition not updating alert-instance counts (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c6f57434
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c6f57434
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c6f57434
Branch: refs/heads/trunk
Commit: c6f574349f0c7a71694f55fd2f12fc84f13ee16f
Parents: 3eaaef1
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Tue Dec 2 18:13:34 2014 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Tue Dec 2 18:17:27 2014 +0200
----------------------------------------------------------------------
.../mappers/alert_definition_summary_mapper.js | 8 ++++++++
.../alert_definition_summary_mapper_test.js | 18 +++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c6f57434/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 9e18b0d..3404f41 100644
--- a/ambari-web/app/mappers/alert_definition_summary_mapper.js
+++ b/ambari-web/app/mappers/alert_definition_summary_mapper.js
@@ -41,5 +41,13 @@ App.alertDefinitionSummaryMapper = App.QuickDataMapper.create({
});
}
});
+
+ // clear summary for disabled alert definitions
+ alertDefinitions.forEach(function (definition) {
+ if (!definition.get('enabled')) {
+ definition.set('summary', {});
+ }
+ });
+
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c6f57434/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 36e8d2d..b04b7e3 100644
--- a/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
+++ b/ambari-web/test/mappers/alert_definition_summary_mapper_test.js
@@ -24,11 +24,12 @@ describe('App.alertDefinitionSummaryMapper', function () {
describe('#map', function() {
var testModels = [
- App.PortAlertDefinition.createRecord({id: 1, type: 'PORT'}),
- App.MetricsAlertDefinition.createRecord({id: 2, type: 'METRICS'}),
- App.WebAlertDefinition.createRecord({id: 3, type: 'WEB'}),
- App.AggregateAlertDefinition.createRecord({id: 4, type: 'AGGREGATE'}),
- App.ScriptAlertDefinition.createRecord({id: 5, type: 'SCRIPT'})
+ 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}})
],
dataToMap = {
alerts_summary_grouped: [
@@ -120,6 +121,13 @@ describe('App.alertDefinitionSummaryMapper', function () {
});
+ it('should clear summary for disabled definitions', function () {
+
+ App.alertDefinitionSummaryMapper.map(dataToMap);
+ expect(App.ScriptAlertDefinition.find().findProperty('id', 6).get('summary')).to.eql({});
+
+ });
+
});
});