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 2013/12/12 17:45:17 UTC

git commit: AMBARI-4054. Need to show stale-config indicator on hosts page. (onechiporenko)

Updated Branches:
  refs/heads/trunk 06c22ff5a -> 92ea2fdd6


AMBARI-4054. Need to show stale-config indicator on hosts page. (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 92ea2fdd6589695e8dc72038c5cd5e70f99034dd
Parents: 06c22ff
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Thu Dec 12 18:42:06 2013 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Thu Dec 12 18:45:13 2013 +0200

----------------------------------------------------------------------
 ambari-web/app/messages.js                     |   6 +-
 ambari-web/app/models/host.js                  |   4 +
 ambari-web/app/styles/application.less         |  20 ++--
 ambari-web/app/templates/main/host.hbs         | 117 +++++++++++---------
 ambari-web/app/templates/main/host/summary.hbs |   2 +-
 ambari-web/app/utils/host_progress_popup.js    |   1 +
 ambari-web/app/views/main/host.js              |  78 +++++++++----
 ambari-web/app/views/main/host/summary.js      |  10 +-
 8 files changed, 150 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/92ea2fdd/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index ca90553..bc6bf0a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -161,6 +161,7 @@ Em.I18n.translations = {
   'common.properties': 'properties',
   'common.conf.group': 'Configuration Group',
   'common.ignore': 'Ignore',
+  'common.restart': 'Restart',
 
   'requestInfo.installComponents':'Install Components',
   'requestInfo.installServices':'Install Services',
@@ -1288,7 +1289,10 @@ Em.I18n.translations = {
 
   'hosts.host.add':'Add New Hosts',
   'hosts.table.noHosts':'No hosts to display',
-  
+
+  'hosts.table.restartComponents.withNames':'Restart {0}',
+  'hosts.table.restartComponents.withoutNames':'{0} components should be restarted',
+
   'hosts.selectHostsDialog.title': 'Select Configuration Group Hosts',
   'hosts.selectHostsDialog.message': 'Select hosts that should belong to this {0} Configuration Group.  All hosts belonging to this group will have the same set of {0} configurations.',
   'hosts.selectHostsDialog.filter.placeHolder': 'Filter...',

http://git-wip-us.apache.org/repos/asf/ambari/blob/92ea2fdd/ambari-web/app/models/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host.js b/ambari-web/app/models/host.js
index a90c554..995f835 100644
--- a/ambari-web/app/models/host.js
+++ b/ambari-web/app/models/host.js
@@ -61,6 +61,10 @@ App.Host = DS.Model.extend({
     return App.router.get('clusterController.alerts').filterProperty('hostName', this.get('hostName')).filterProperty('isOk', false).filterProperty('ignoredForHosts', false).length;
   }.property('App.router.clusterController.alerts.length'),
 
+  componentsWithStaleConfigsCount: function() {
+    return this.get('hostComponents').filterProperty('staleConfigs', true).length;
+  }.property('hostComponents.@each'),
+
   publicHostNameFormatted: function() {
     return this.get('publicHostName').length < 43 ? this.get('publicHostName') : this.get('publicHostName').substr(0, 40) + '...';
   }.property('publicHostName'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/92ea2fdd/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 3bfde98..09c1fcb 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2730,9 +2730,13 @@ table.graphs {
     th:first-child + th{
       width: 19%;
     }
-    .col2,.col3,.col4,.col5,.col6,
+    .col2,
     td:first-child + td + td,
-    th:first-child + th + th,
+    th:first-child + th + th{
+      width:3%;
+      min-width:13px!important;
+    }
+    .col3,.col4,.col5,.col6,.col7,
     td:first-child + td + td + td,
     th:first-child + th + th + th,
     td:first-child + td + td + td + td,
@@ -2740,13 +2744,15 @@ table.graphs {
     td:first-child + td + td + td + td + td,
     th:first-child + th + th + th + th + th,
     td:first-child + td + td + td + td + td + td,
-    th:first-child + th + th + th + th + th + th{
-      width: 12%;
-    }
-    .col7,
+    th:first-child + th + th + th + th + th + th,
     td:first-child + td + td + td + td + td + td + td,
     th:first-child + th + th + th + th + th + th + th{
-      width: 18%;
+      width: 12%;
+    }
+    .col8,
+    td:first-child + td + td + td + td + td + td + td + td,
+    th:first-child + th + th + th + th + th + th + th + th{
+      width: 15%;
     }
 
     td.name {

http://git-wip-us.apache.org/repos/asf/ambari/blob/92ea2fdd/ambari-web/app/templates/main/host.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host.hbs b/ambari-web/app/templates/main/host.hbs
index 9738b86..1bf69f7 100644
--- a/ambari-web/app/templates/main/host.hbs
+++ b/ambari-web/app/templates/main/host.hbs
@@ -21,7 +21,7 @@
   <div class="box-header row">
     <div class="health-status-bar pull-left">
       <div class="pull-left">
-         <span {{bindAttr class=":category-item view.filtersUsed::active"}}><a {{action clearFilters target="view"}} href="#">{{t common.all}} ({{content.length}})</a></span>
+        <span {{bindAttr class=":category-item view.filtersUsed::active"}}><a {{action clearFilters target="view"}} href="#">{{t common.all}} ({{content.length}})</a></span>
       </div>
       {{view view.alertFilter}}
       {{#view view.statusFilter categoriesBinding="view.categories"}}
@@ -33,7 +33,11 @@
                 {{#if category.alerts}}
                   <span class="label label-important">{{t hosts.host.alerts.st}}</span>
                 {{else}}
-                  <span {{bindAttr class=":health-status category.healthStatusValue"}}> &nbsp;&nbsp;&nbsp; </span>
+                  {{#if category.restart}}
+                    <span class="muted icon-refresh"></span>
+                  {{else}}
+                    <span {{bindAttr class=":health-status category.healthStatusValue"}}> &nbsp;&nbsp;&nbsp; </span>
+                  {{/if}}
                 {{/if}}
                 {{category.label}}
               </a>
@@ -55,68 +59,75 @@
 
   <table class="datatable table table-bordered table-striped" id="hosts-table">
     <thead>
-        {{#view view.sortView classNames="label-row" contentBinding="view.filteredContent"}}
-          <th class="first"> </th>
-          {{view view.parentView.nameSort}}
-          {{view view.parentView.ipSort}}
-          {{view view.parentView.cpuSort}}
-          {{view view.parentView.memorySort}}
-          {{view view.parentView.diskUsageSort}}
-          {{view view.parentView.loadAvgSort}}
-          <th>{{t common.components}}</th>
+      {{#view view.sortView classNames="label-row" contentBinding="view.filteredContent"}}
+        <th class="first"> </th>
+        {{view view.parentView.nameSort}}
+        <th> </th>
+        {{view view.parentView.ipSort}}
+        {{view view.parentView.cpuSort}}
+        {{view view.parentView.memorySort}}
+        {{view view.parentView.diskUsageSort}}
+        {{view view.parentView.loadAvgSort}}
+        <th>{{t common.components}}</th>
       {{/view}}
-    <tr id="filter-row">
-      <th class="first"> </th>
-      <th>{{view view.nameFilterView}}</th>
-      <th>{{view view.ipFilterView}}</th>
-      <th>{{view view.cpuFilterView}}</th>
-      <th>{{view view.ramFilterView}}</th>
-      <th></th>
-      <th>{{view view.loadAvgFilterView}}</th>
-      <th>{{view view.componentsFilterView}}</th>
-    </tr>
+      <tr id="filter-row">
+        <th class="first"> </th>
+        <th>{{view view.nameFilterView}}</th>
+        <th> </th>
+        <th>{{view view.ipFilterView}}</th>
+        <th>{{view view.cpuFilterView}}</th>
+        <th>{{view view.ramFilterView}}</th>
+        <th> </th>
+        <th>{{view view.loadAvgFilterView}}</th>
+        <th>{{view view.componentsFilterView}}</th>
+      </tr>
     </thead>
     <tbody>
     {{#if view.pageContent}}
-    {{#each host in view.pageContent}}
-    {{#view view.HostView contentBinding="host"}}
+      {{#each host in view.pageContent}}
+        {{#view view.HostView contentBinding="host"}}
 
-      <td class="first">
-        <span rel="HealthTooltip" {{bindAttr class="host.healthClass"}} {{bindAttr data-original-title="host.healthToolTip" }}></span>
-      </td>
+          <td class="first">
+            <span rel="HealthTooltip" {{bindAttr class="host.healthClass"}} {{bindAttr data-original-title="host.healthToolTip" }}></span>
+          </td>
 
-      <td class="name">
-        <a title="{{unbound host.publicHostName}}" href="#" {{action "showDetails" host}}>{{unbound host.publicHostNameFormatted}}</a>
-        {{#if host.criticalAlertsCount}}
-          <span class="label label-important alerts-count" {{action "showAlertsPopup" host target="controller"}}>{{host.criticalAlertsCount}}</span>
-        {{/if}}
-      </td>
-      <td>{{host.ip}}</td>
-      <td>{{host.cpu}}</td>
-      <td>{{host.memoryFormatted}}</td>
+          <td class="name">
+            <a title="{{unbound host.publicHostName}}" href="#" {{action "showDetails" host}}>{{unbound host.publicHostNameFormatted}}</a>
+            {{#if host.criticalAlertsCount}}
+              <span class="label label-important alerts-count" {{action "showAlertsPopup" host target="controller"}}>{{host.criticalAlertsCount}}</span>
+            {{/if}}
+          </td>
+          <td class="restart">
+            {{#if host.componentsWithStaleConfigsCount}}
+              <span class="muted icon-refresh" rel="ComponentsTooltip" {{bindAttr title="view.restartRequiredComponentsMessage"}}></span>
+            {{/if}}
+          </td>
+          <td>{{host.ip}}</td>
+          <td>{{host.cpu}}</td>
+          <td>{{host.memoryFormatted}}</td>
 
-      <td>
-        <div class="progress progress-info" title="{{unbound host.diskInfoBar}}" rel="UsageTooltip">
-          <div class="bar" {{bindAttr style="view.usageStyle"}}></div>
-        </div>
-      </td>
+          <td>
+            <div class="progress progress-info" {{bindAttr title="host.diskInfoBar"}} rel="UsageTooltip">
+              <div class="bar" {{bindAttr style="view.usageStyle"}}></div>
+            </div>
+          </td>
 
-      <td>{{host.loadAvg}}</td>
-      <td>
-        <a href="#" class="host-components-expander" {{action toggleComponents target="view"}}> <span class="caret right"></span>{{view.componentsMessage}}</a>
-        <div id="host-{{unbound host.hostName}}" class="host-components">
-          {{{view.labels}}}
-        </div>
-      </td>
-    {{/view}}
-    {{/each}}
+          <td>{{host.loadAvg}}</td>
+          <td>
+            <a href="#" class="host-components-expander" {{action toggleComponents target="view"}}> <span class="caret right"></span>{{view.componentsMessage}}</a>
+            <div id="host-{{unbound host.hostName}}" class="host-components">
+              {{{view.labels}}}
+            </div>
+          </td>
+        {{/view}}
+      {{/each}}
     {{else}}
-    <tr>
+      <tr>
         <td class="first"></td>
-        <td colspan="7">
-            {{t hosts.table.noHosts}}
+        <td colspan="8">
+          {{t hosts.table.noHosts}}
         </td>
-    </tr>
+      </tr>
     {{/if}}
     </tbody>
   </table>

http://git-wip-us.apache.org/repos/asf/ambari/blob/92ea2fdd/ambari-web/app/templates/main/host/summary.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/summary.hbs b/ambari-web/app/templates/main/host/summary.hbs
index e4a1bb2..3fda928 100644
--- a/ambari-web/app/templates/main/host/summary.hbs
+++ b/ambari-web/app/templates/main/host/summary.hbs
@@ -27,7 +27,7 @@
         <div class="host-components">
         {{#if view.sortedComponents.length}}
 
-          {{#if view.needToRestartComponentsCount}}
+          {{#if view.content.componentsWithStaleConfigsCount}}
               <div class="alert alert-warning clearfix">
                 <i class="icon-refresh"></i> {{view.needToRestartMessage}}
                 <br/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/92ea2fdd/ambari-web/app/utils/host_progress_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js
index f8bebe7..31ec071 100644
--- a/ambari-web/app/utils/host_progress_popup.js
+++ b/ambari-web/app/utils/host_progress_popup.js
@@ -481,6 +481,7 @@ App.HostPopup = Em.Object.create({
       isLoaded: !isBackgroundOperations,
       isOpen: false,
       didInsertElement: function(){
+        this._super();
         this.set('isOpen', true);
       },
       headerClass: Ember.View.extend({

http://git-wip-us.apache.org/repos/asf/ambari/blob/92ea2fdd/ambari-web/app/views/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js
index 586e3c3..da6483b 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -81,7 +81,7 @@ App.MainHostView = App.TableView.extend({
     content:null,
     tagName: 'tr',
     didInsertElement: function(){
-      App.tooltip(this.$("[rel='HealthTooltip'], [rel='UsageTooltip']"));
+      App.tooltip(this.$("[rel='HealthTooltip'], [rel='UsageTooltip'], [rel='ComponentsTooltip']"));
     },
 
     toggleComponents: function(event) {
@@ -99,6 +99,16 @@ App.MainHostView = App.TableView.extend({
       }
     }.property('content.hostComponents.@each'),
 
+    restartRequiredComponentsMessage: function() {
+      var restartRequiredComponents = this.get('content.hostComponents').filterProperty('staleConfigs', true);
+      var count = restartRequiredComponents.length;
+      if (count <= 5) {
+        var word = (count == 1) ? Em.I18n.t('common.component') : Em.I18n.t('common.components');
+        return Em.I18n.t('hosts.table.restartComponents.withNames').format(restartRequiredComponents.getEach('displayName').join(', ')) + ' ' + word.toLowerCase();
+      }
+      return Em.I18n.t('hosts.table.restartComponents.withoutNames').format(count);
+    }.property('content.hostComponents.@each.staleConfigs'),
+
     labels: function() {
       return this.get('content.hostComponents').getEach('displayName').join("<br />");
     }.property('content.hostComponents.@each'),
@@ -117,14 +127,24 @@ App.MainHostView = App.TableView.extend({
     hostsCount: function () {
       var statusString = this.get('healthStatusValue');
       var alerts = this.get('alerts');
-      if(alerts){
+      var restart = this.get('restart');
+      if(alerts) {
         return this.get('view.content').filterProperty('criticalAlertsCount').get('length');
-      } else if (statusString == "") {
-        return this.get('view.content').get('length');
-      } else {
-        return this.get('view.content').filterProperty('healthClass', statusString ).get('length');
       }
-    }.property('view.content.@each.healthClass', 'view.content.@each.criticalAlertsCount'),
+      else {
+        if (restart) {
+          return this.get('view.content').filterProperty('componentsWithStaleConfigsCount').get('length');
+        }
+        else {
+          if (statusString == "") {
+            return this.get('view.content').get('length');
+          }
+          else {
+            return this.get('view.content').filterProperty('healthClass', statusString ).get('length');
+          }
+        }
+      }
+    }.property('view.content.@each.healthClass', 'view.content.@each.criticalAlertsCount', 'view.content.@each.hostComponents.@each.staleConfigs'),
 
     label: function () {
       return "%@ (%@)".fmt(this.get('value'), this.get('hostsCount'));
@@ -147,7 +167,8 @@ App.MainHostView = App.TableView.extend({
       self.categoryObject.create({value: Em.I18n.t('hosts.host.healthStatusCategory.red'), healthStatusValue: 'health-status-DEAD-RED', isVisible: true}),
       self.categoryObject.create({value: Em.I18n.t('hosts.host.healthStatusCategory.orange'), healthStatusValue: 'health-status-DEAD-ORANGE', isVisible: true}),
       self.categoryObject.create({value: Em.I18n.t('hosts.host.healthStatusCategory.yellow'), healthStatusValue: 'health-status-DEAD-YELLOW', isVisible: true}),
-      self.categoryObject.create({value: Em.I18n.t('hosts.host.alerts.label'), healthStatusValue: 'health-status-WITH-ALERTS', last: true, alerts: true, isVisible: true })
+      self.categoryObject.create({value: Em.I18n.t('hosts.host.alerts.label'), healthStatusValue: 'health-status-WITH-ALERTS', alerts: true, isVisible: true }),
+      self.categoryObject.create({value: Em.I18n.t('common.restart'), healthStatusValue: 'health-status-RESTART', restart: true, last: true, isVisible: true })
     ];
 
     return categories;
@@ -174,12 +195,22 @@ App.MainHostView = App.TableView.extend({
     selectCategory: function(event){
       var category = event.context;
       this.set('value', category.get('healthStatusValue'));
-      if(category.get('alerts')){
+      if(category.get('alerts')) {
         this.get('parentView').updateFilter(0, '', 'string');
         this.get('parentView').updateFilter(7, '>0', 'number');
-      } else {
-        this.get('parentView').updateFilter(7, '', 'number');
-        this.get('parentView').updateFilter(0, category.get('healthStatusValue'), 'string');
+        this.get('parentView').updateFilter(8, '', 'number');
+      }
+      else {
+        if(category.get('restart')) {
+          this.get('parentView').updateFilter(0, '', 'string');
+          this.get('parentView').updateFilter(7, '', 'number');
+          this.get('parentView').updateFilter(8, '>0', 'number');
+        }
+        else {
+          this.get('parentView').updateFilter(7, '', 'number');
+          this.get('parentView').updateFilter(8, '', 'number');
+          this.get('parentView').updateFilter(0, category.get('healthStatusValue'), 'string');
+        }
       }
     },
     clearFilter: function() {
@@ -206,14 +237,22 @@ App.MainHostView = App.TableView.extend({
     }
   }),
 
-
   /**
-   * Count of the hosts with alerts
+   * view of the staleConfigs filter implemented as a category of host statuses
    */
-  hostsWithAlertsCount: function() {
-    return this.get('content.length') - this.get('content').filterProperty('criticalAlertsCount', 0).length;
-  }.property('content.@each.criticalAlertsCount'),
-
+  restartFilter: Em.View.extend({
+    column: 8,
+    value: null,
+    classNames: ['noDisplay'],
+    showClearFilter: function(){
+      var mockEvent = {
+        context: this.get('parentView.categories').findProperty('healthStatusValue', 'health-status-RESTART')
+      };
+      if(this.get('value')) {
+        this.get('parentView.childViews').findProperty('column', 0).selectCategory(mockEvent);
+      }
+    }
+  }),
 
   /**
    * Filter view for name column
@@ -409,6 +448,7 @@ App.MainHostView = App.TableView.extend({
     associations[5] = 'loadAvg';
     associations[6] = 'hostComponents';
     associations[7] = 'criticalAlertsCount';
+    associations[8] = 'componentsWithStaleConfigsCount';
     return associations;
   }.property()
-});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/92ea2fdd/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index c416e88..6f22732 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -34,10 +34,6 @@ App.MainHostSummaryView = Em.View.extend({
     window.open(gangliaMobileUrl);
   },
 
-  needToRestartComponentsCount: function() {
-    return this.get('content.hostComponents').filterProperty('staleConfigs', true).length;
-  }.property('content.hostComponents.@each.staleConfigs'),
-
   stopComponentsIsDisabled: function () {
     var staleComponents = this.get('content.hostComponents').filterProperty('staleConfigs', true);
     if(!staleComponents.findProperty('workStatus','STARTED')){
@@ -58,14 +54,14 @@ App.MainHostSummaryView = Em.View.extend({
 
   needToRestartMessage: function() {
     var componentsCount, word;
-    componentsCount = this.get('needToRestartComponentsCount');
+    componentsCount = this.get('content.componentsWithStaleConfigsCount');
     if (componentsCount > 1) {
       word = Em.I18n.t('common.components').toLowerCase();
     } else {
       word = Em.I18n.t('common.component').toLowerCase();
     }
-    return Em.I18n.t('hosts.host.details.needToRestart').format(this.get('needToRestartComponentsCount'), word);
-  }.property('needToRestartComponentsCount'),
+    return Em.I18n.t('hosts.host.details.needToRestart').format(this.get('content.componentsWithStaleConfigsCount'), word);
+  }.property('content.componentsWithStaleConfigsCount'),
 
   /**
    * @type: [{String}]