Author: srimanth
Date: Thu Apr 11 20:57:29 2013
New Revision: 1467082
URL: http://svn.apache.org/r1467082
Log:
AMBARI-1893. Parsing new alerts format fails. (srimanth)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js
incubator/ambari/trunk/ambari-web/app/messages.js
incubator/ambari/trunk/ambari-web/app/models/alert.js
incubator/ambari/trunk/ambari-web/app/styles/application.less
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary_alert.hbs
Modified: incubator/ambari/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1467082&r1=1467081&r2=1467082&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Apr 11 20:57:29 2013
@@ -690,6 +690,8 @@ Trunk (unreleased changes):
BUG FIXES
+ AMBARI-1893. Parsing new alerts format fails. (srimanth)
+
AMBARI-1891. Impossibility to scroll metric window after browser width
changing. (srimanth)
Modified: incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js?rev=1467082&r1=1467081&r2=1467082&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js Thu Apr 11
20:57:29 2013
@@ -42,8 +42,7 @@ App.alertsMapper = App.QuickDataMapper.c
return;
}
if (json && json.items && json.items.length>0 && json.items[0].HostRoles
&& json.items[0].HostRoles.nagios_alerts) {
- var alertsString = json.items[0].HostRoles.nagios_alerts;
- var alerts = jQuery.parseJSON(alertsString).alerts;
+ var alerts = json.items[0].HostRoles.nagios_alerts.alerts;
if (App.Alert.find().content.length > 0) {
this.update(alerts);
} else {
@@ -61,6 +60,9 @@ App.alertsMapper = App.QuickDataMapper.c
case "2":
applyConfig['date'] = 'last_time_critical';
break;
+ case "3":
+ applyConfig['date'] = 'last_time_unknown';
+ break;
}
}
result.push(this.parseIt(item, applyConfig));
@@ -91,6 +93,9 @@ App.alertsMapper = App.QuickDataMapper.c
case "2":
applyConfig['date'] = 'last_time_critical';
break;
+ case "3":
+ applyConfig['date'] = 'last_time_unknown';
+ break;
}
}
newRecords.push(this.parseIt(item, applyConfig));
@@ -108,6 +113,9 @@ App.alertsMapper = App.QuickDataMapper.c
case "2":
existAlert.set('date',
DS.attr.transforms.date.from(item.last_time_critical));
break;
+ case "3":
+ existAlert.set('date',
DS.attr.transforms.date.from(item.last_time_unknown));
+ break;
default:
existAlert.set('date',
DS.attr.transforms.date.from(item.last_hard_state_change));
break;
Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1467082&r1=1467081&r2=1467082&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Thu Apr 11 20:57:29 2013
@@ -191,6 +191,7 @@ Em.I18n.translations = {
'services.alerts.OK.timePrefix': 'OK for ',
'services.alerts.WARN.timePrefix': 'WARN for ',
'services.alerts.CRIT.timePrefix': 'CRIT for ',
+ 'services.alerts.UNKNOWN.timePrefix': 'UNKNOWN for ',
'services.alerts.headingOfList': 'Alerts and Health Checks',
'services.alerts.goToService': 'Go to Service',
'services.alerts.goToNagios': 'Go to Nagios Web UI',
Modified: incubator/ambari/trunk/ambari-web/app/models/alert.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/alert.js?rev=1467082&r1=1467081&r2=1467082&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/alert.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/alert.js Thu Apr 11 20:57:29
2013
@@ -61,6 +61,13 @@ App.Alert = DS.Model.extend({
}.property('status'),
/**
+ * Used to show correct icon in UI
+ */
+ isCritical: function() {
+ return this.get('status') == '2';
+ }.property('status'),
+
+ /**
* Used to show only required alerts at the service level
*/
ignoredForServices: function() {
@@ -90,6 +97,9 @@ App.Alert = DS.Model.extend({
case "2":
prefix = this.t('services.alerts.CRIT.timePrefix');
break;
+ case "3":
+ prefix = this.t('services.alerts.UNKNOWN.timePrefix');
+ break;
}
var prevSuffix = $.timeago.settings.strings.suffixAgo;
$.timeago.settings.strings.suffixAgo = '';
Modified: incubator/ambari/trunk/ambari-web/app/styles/application.less
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/styles/application.less?rev=1467082&r1=1467081&r2=1467082&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/trunk/ambari-web/app/styles/application.less Thu Apr 11
20:57:29 2013
@@ -222,6 +222,10 @@ h1 {
color: #FF4B4B;
}
+.icon-question-sign {
+ color: #999;
+}
+
.tooltip {
z-index: 1050;
}
Modified:
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary_alert.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary_alert.hbs?rev=1467082&r1=1467081&r2=1467082&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary_alert.hbs
(original)
+++
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/summary_alert.hbs
Thu Apr 11 20:57:29 2013
@@ -25,7 +25,11 @@
{{#if isWarning}}
<i class="icon-warning-sign icon-large"></i>
{{else}}
- <i class="icon-remove icon-large"></i>
+ {{#if isCritical}}
+ <i class="icon-remove icon-large"></i>
+ {{else}}
+ <i class="icon-question-sign icon-large"></i>
+ {{/if}}
{{/if}}
{{/if}}
</div>