You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2013/02/11 20:31:48 UTC
svn commit: r1444933 - in /incubator/ambari/trunk: ./ ambari-web/app/
ambari-web/app/controllers/main/ ambari-web/app/templates/main/
ambari-web/app/templates/main/host/ ambari-web/app/views/main/
Author: jaimin
Date: Mon Feb 11 19:31:48 2013
New Revision: 1444933
URL: http://svn.apache.org/r1444933
Log:
AMBARI-1374. Add filter by alerts on the Hosts page. (jaimin)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/controllers/main/host.js
incubator/ambari/trunk/ambari-web/app/messages.js
incubator/ambari/trunk/ambari-web/app/templates/main/host/alerts_popup.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/menu_item.hbs
incubator/ambari/trunk/ambari-web/app/views/main/host.js
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1444933&r1=1444932&r2=1444933&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Mon Feb 11 19:31:48 2013
@@ -40,6 +40,8 @@ Trunk (unreleased changes):
IMPROVEMENTS
+ AMBARI-1374. Add filter by alerts on the Hosts page. (jaimin)
+
AMBARI-1373. Since there is the ability to log in to Ambari Web as
different users the current user should be indicated. (jaimin)
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host.js?rev=1444933&r1=1444932&r2=1444933&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host.js Mon Feb 11 19:31:48 2013
@@ -51,6 +51,28 @@ App.MainHostController = Em.ArrayControl
}.property('componentsForFilter'),
/**
+ * Is true if alets filter is active
+ */
+ filteredByAlerts:false,
+
+ /**
+ * Is true if Hosts page was opened by clicking on alerts count badge
+ */
+ comeWithAlertsFilter: false,
+
+ /**
+ * Enable or disable filtering by alets
+ */
+ filterByAlerts: function () {
+ if (App.router.get('currentState.name') == 'index') {
+ this.set('filteredByAlerts', !this.get('filteredByAlerts'));
+ } else {
+ App.router.transitionTo('hosts.index');
+ this.set('comeWithAlertsFilter', true);
+ }
+ },
+
+ /**
* Filter hosts by componentName of <code>component</code>
* @param component App.HostComponent
*/
Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1444933&r1=1444932&r2=1444933&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Mon Feb 11 19:31:48 2013
@@ -444,6 +444,7 @@ Em.I18n.translations = {
'hosts.host.start.popup.body':'Are you sure?',
'hosts.host.stop.popup.body':'Are you sure?',
'hosts.host.alert.noAlerts':'No alerts',
+ 'hosts.host.alert.noAlerts.message':'There are no alerts for this host.',
'hosts.host.healthStatus.heartBeatNotReceived':'The server has not received a heartbeat from this host for more than 3 minutes.',
'hosts.host.healthStatus.mastersDown':"The following master components are down:\n",
'hosts.host.healthStatus.slavesDown':"The following slave components are down:\n",
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/host/alerts_popup.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/host/alerts_popup.hbs?rev=1444933&r1=1444932&r2=1444933&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/host/alerts_popup.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/host/alerts_popup.hbs Mon Feb 11 19:31:48 2013
@@ -22,4 +22,6 @@
{{view App.AlertItemView contentBinding="this"}}
{{/each}}
</ul>
+{{else}}
+ {{t hosts.host.alert.noAlerts.message}}
{{/if}}
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/menu_item.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/menu_item.hbs?rev=1444933&r1=1444932&r2=1444933&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/menu_item.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/menu_item.hbs Mon Feb 11 19:31:48 2013
@@ -19,7 +19,7 @@
<a href="#/main/{{unbound view.content.routing}}">
{{unbound view.content.label}}
{{#if view.alertsCount}}
- <span class="label label-important alerts-count">
+ <span {{action "filterByAlerts" target="App.router.mainHostController"}} class="label label-important alerts-count">
{{view.alertsCount}}
</span>
{{/if}}
Modified: incubator/ambari/trunk/ambari-web/app/views/main/host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/host.js?rev=1444933&r1=1444932&r2=1444933&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/host.js Mon Feb 11 19:31:48 2013
@@ -28,7 +28,13 @@ App.MainHostView = Em.View.extend({
oTable: null,
didInsertElement:function () {
- this.filter()
+ this.filter();
+ if (this.get('controller.comeWithAlertsFilter')) {
+ this.set('controller.comeWithAlertsFilter', false);
+ this.set('controller.filteredByAlerts', true);
+ } else {
+ this.set('controller.filteredByAlerts', false);
+ }
},
HostView:Em.View.extend({
@@ -214,6 +220,17 @@ App.MainHostView = Em.View.extend({
}
}),
+ /**
+ * Filter hosts by hosts with at least one alert
+ */
+ filterByAlerts:function() {
+ if (this.get('controller.filteredByAlerts')) {
+ this.updateFilter(7, '>0', 'number')
+ } else {
+ this.updateFilter(7, '', 'number')
+ }
+ }.observes('controller.filteredByAlerts'),
+
startIndex : function(){
return Math.random();
}.property(),
@@ -249,6 +266,7 @@ App.MainHostView = Em.View.extend({
associations[4] = 'memoryFormatted';
associations[5] = 'loadAvg';
associations[6] = 'hostComponents';
+ associations[7] = 'criticalAlertsCount';
return associations;
}.property(),
globalSearchValue:null,