Repository: ambari
Updated Branches:
  refs/heads/trunk 69e112bae -> 8f7fb3d26


AMBARI-11161. Changing MapReduce configs put dependencies bar at incorrect 
location(onechiporenko)


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

Branch: refs/heads/trunk
Commit: 8f7fb3d263057e23e6adeffcf4203e76169ba183
Parents: 69e112b
Author: Oleg Nechiporenko <[email protected]>
Authored: Fri May 15 13:38:24 2015 +0300
Committer: Oleg Nechiporenko <[email protected]>
Committed: Fri May 15 13:38:24 2015 +0300

----------------------------------------------------------------------
 .../app/views/main/service/info/configs.js      | 57 ++++++++++++++------
 .../test/views/main/service/info/config_test.js |  1 +
 2 files changed, 41 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8f7fb3d2/ambari-web/app/views/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/configs.js 
b/ambari-web/app/views/main/service/info/configs.js
index c623c4e..f51baa0 100644
--- a/ambari-web/app/views/main/service/info/configs.js
+++ b/ambari-web/app/views/main/service/info/configs.js
@@ -20,49 +20,72 @@ var App = require('app');
 var batchUtils = require('utils/batch_scheduled_requests');
 
 App.MainServiceInfoConfigsView = Em.View.extend({
+
   templateName: require('templates/main/service/info/configs'),
+
   didInsertElement: function () {
-    var controller = this.get('controller');
-    controller.loadStep();
+    this.get('controller').loadStep();
   },
 
+  /**
+   * Number of components that should be restarted
+   * @type {number}
+   */
   componentsCount: null,
+
+  /**
+   * Number of hosts with components that should be restarted
+   * @type {number}
+   */
   hostsCount: null,
-  isStopCommand:true,
 
+  /**
+   * @type {boolean}
+   */
+  isStopCommand: true,
+
+  /**
+   * @method updateComponentInformation
+   */
   updateComponentInformation: function() {
     var hc = this.get('controller.content.restartRequiredHostsAndComponents');
-    var hostsCount = 0;
     var componentsCount = 0;
-    for (var host in hc) {
-      hostsCount++;
+    var hosts = Em.keys(hc);
+    hosts.forEach(function (host) {
       componentsCount += hc[host].length;
-    }
-    this.set('componentsCount', componentsCount);
-    this.set('hostsCount', hostsCount);
+    });
+    this.setProperties({
+      componentsCount: componentsCount,
+      hostsCount: hosts.length
+    });
   }.observes('controller.content.restartRequiredHostsAndComponents'),
 
-  rollingRestartSlaveComponentName : function() {
+  /**
+   * @type {string}
+   */
+  rollingRestartSlaveComponentName: function() {
     return 
batchUtils.getRollingRestartComponentName(this.get('controller.content.serviceName'));
   }.property('controller.content.serviceName'),
 
+  /**
+   * @type {string}
+   */
   rollingRestartActionName : function() {
-    var label = null;
     var componentName = this.get('rollingRestartSlaveComponentName');
-    if (componentName) {
-      label = 
Em.I18n.t('rollingrestart.dialog.title').format(App.format.role(componentName));
-    }
-    return label;
+    return componentName ? 
Em.I18n.t('rollingrestart.dialog.title').format(App.format.role(componentName)) 
: '';
   }.property('rollingRestartSlaveComponentName'),
 
   /**
+   * When some config has dependencies and `.dependencies-info-bar` should be 
shown and should be placed sticky to top
    * @method onHasChangedDependenciesUpdated
    */
   onHasChangedDependenciesUpdated: function () {
     if (this.get('controller.hasChangedDependencies')) {
-      $(".dependencies-info-bar-wrapper").stick_in_parent({parent: 
'#serviceConfig', offset_top: 60});
       Em.run.next(function () {
-        $(window).scrollTop(window.scrollY + 1); // 
'.dependencies-info-bar-wrapper' position should be recalculated
+        $(".dependencies-info-bar-wrapper").stick_in_parent({parent: 
'#serviceConfig', offset_top: 60});
+        Em.run.next(function () {
+          $(window).scrollTop(window.scrollY + 1); // 
'.dependencies-info-bar-wrapper' position should be recalculated
+        });
       });
     }
     else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f7fb3d2/ambari-web/test/views/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/config_test.js 
b/ambari-web/test/views/main/service/info/config_test.js
index fe01e84..583dfa5 100644
--- a/ambari-web/test/views/main/service/info/config_test.js
+++ b/ambari-web/test/views/main/service/info/config_test.js
@@ -73,4 +73,5 @@ describe('App.MainServiceInfoConfigsView', function() {
       });
     });
   });
+
 });

Reply via email to