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 2015/05/29 11:54:02 UTC

ambari git commit: AMBARI-11525. Configs: Ticker bounds should be multiples of 0.25GB for memory properties (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 3dd19b160 -> d8da5af93


AMBARI-11525. Configs: Ticker bounds should be multiples of 0.25GB for memory properties (onechiporenko)


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

Branch: refs/heads/trunk
Commit: d8da5af93306f194f90365f6bf4123a123c53bca
Parents: 3dd19b1
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri May 29 12:50:03 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri May 29 12:50:03 2015 +0300

----------------------------------------------------------------------
 .../configs/widgets/slider_config_widget_view.js  | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d8da5af9/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
index 4ea542e..119ef5c 100644
--- a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
@@ -282,7 +282,7 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
       config = this.get('config'),
       valueAttributes = config.get('stackConfigProperty.valueAttributes'),
       parseFunction = this.get('parseFunction'),
-      ticks = [this.get('minMirrorValue')],
+      ticks = [this.valueForTick(this.get('minMirrorValue'))],
       ticksLabels = [],
       recommendedValue = this.valueForTick(+this.get('widgetRecommendedValue')),
       range = this.get('maxMirrorValue') - this.get('minMirrorValue'),
@@ -298,12 +298,14 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
       ticks.push(this.valueForTick(val));
     }
 
-    ticks.push(this.get('maxMirrorValue'));
+    ticks.push(this.valueForTick(this.get('maxMirrorValue')));
     ticks = ticks.uniq();
     ticks.forEach(function (tick, index, items) {
       ticksLabels.push((items.length < 5 || index % 2 === 0 || items.length - 1 == index) ? tick + ' ' + self.get('unitLabel') : '');
     });
 
+    ticks = ticks.uniq();
+
     // default marker should be added only if recommendedValue is in range [min, max]
     if (recommendedValue <= this.get('maxMirrorValue') && recommendedValue >= this.get('minMirrorValue') && recommendedValue != '') {
       // process additional tick for default value if it not defined in previous computation
@@ -330,7 +332,8 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
         ticks.insertAt(recommendedValueMirroredId, this.valueForTick((ticks[recommendedValueMirroredId] + ticks[recommendedValueMirroredId - 1]) / 2));
         // get new index for default value
         recommendedValueId = ticks.indexOf(recommendedValue);
-      } else {
+      }
+      else {
         recommendedValueId = ticks.indexOf(recommendedValue);
       }
     }
@@ -339,7 +342,7 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
      * Slider some times change config value while being created,
      * this may happens when slider recreating couple times during small period.
      * To cover this situation need to reset config value after slider initializing
-     * @type {Sting}
+     * @type {String}
      */
     var correctConfigValue = this.get('config.value');
 
@@ -406,7 +409,12 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
    * @returns {Number}
    */
   valueForTick: function(val) {
-    return this.get('unitType') === 'int' ? Math.round(val) : parseFloat(val.toFixed(3));
+    if (this.get('unitType') === 'int') {
+      return Math.round(val);
+    }
+    var mirrorStep = this.get('mirrorStep');
+    var r = Math.round(val / mirrorStep);
+    return parseFloat((r * mirrorStep).toFixed(3));
   },
 
   /**