ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-11484. Configs: when doing override, it's hard to find config override (onechiporenko)
Date Thu, 28 May 2015 14:42:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b20dbb7fa -> 1f1742b1d


AMBARI-11484. Configs: when doing override, it's hard to find config override (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 1f1742b1d7f2eb4f4e5bfd1b64c565fcdcf18553
Parents: b20dbb7
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Thu May 28 17:33:14 2015 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Thu May 28 17:33:14 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/styles/widgets.less              | 20 ++++++++++++
 .../configs/widgets/config_widget_view.js       |  2 +-
 .../widgets/slider_config_widget_view.js        | 34 ++++++++++++++++----
 3 files changed, 48 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1742b1/ambari-web/app/styles/widgets.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/widgets.less b/ambari-web/app/styles/widgets.less
index efaf7b7..897c6e5 100644
--- a/ambari-web/app/styles/widgets.less
+++ b/ambari-web/app/styles/widgets.less
@@ -20,6 +20,8 @@
 @undo-btn-margin: 10px;
 @controls-min-width: 55px;
 @combo-widget-width: 100px;
+@overriden-property-bg-color: rgba(211, 237, 247, 0.39);
+@overriden-property-widget-padding: 8px;
 @green: #6ebd45;
 @slider-light-grey: #e6e6e6;
 @slider-dark-grey: #aaaaaa;
@@ -113,6 +115,24 @@
     margin-right: 0;
     padding-left: 20px;
   }
+  // background hack instead of increasing padding,
+  // because we have lack of space for widget container.
+  &.overridden-property {
+    background-color: @overriden-property-bg-color;
+    position: relative;
+    &:before {
+      height: 100%;
+      width: @overriden-property-widget-padding;
+      content: '';
+      position: absolute;
+      top: 0;
+      display: block;
+      background-color: @overriden-property-bg-color;
+    }
+    &:before {
+      left: -@overriden-property-widget-padding;
+    }
+  }
 }
 
 .directory-textarea-wrapper {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1742b1/ambari-web/app/views/common/configs/widgets/config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/config_widget_view.js b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
index 92dc8c1..5d1dcab 100644
--- a/ambari-web/app/views/common/configs/widgets/config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
@@ -117,7 +117,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
    */
   isComparisonBinding: 'config.isComparison',
 
-  classNameBindings:['isComparison:compare-mode'],
+  classNameBindings:['isComparison:compare-mode', 'config.overrides.length:overridden-property'],
 
   issueMessage: '',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f1742b1/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 d8434b5..7732026 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
@@ -27,6 +27,8 @@ var validator = require('utils/validator');
  */
 App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
 
+  classNames: ['widget-config'],
+
   templateName: require('templates/common/configs/widgets/slider_config_widget'),
 
   supportSwitchToCheckBox: true,
@@ -274,7 +276,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'), true)],
       ticksLabels = [],
       recommendedValue = this.valueForTick(+this.get('widgetRecommendedValue')),
       range = this.get('maxMirrorValue') - this.get('minMirrorValue'),
@@ -287,15 +289,24 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
     for (var i = 1; i <= 3; i++) {
       var val = this.get('minMirrorValue') + range * (i / (isSmallInt ? 3 : 4));
       // if value's type is float, ticks may be float too
-      ticks.push(this.valueForTick(val));
+      ticks.push(this.valueForTick(val, false));
     }
 
-    ticks.push(this.get('maxMirrorValue'));
+    ticks.push(this.valueForTick(this.get('maxMirrorValue'), false));
     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') : '');
     });
 
+    if(!isSmallInt) {
+      ticks.push(this.get('maxMirrorValue'));
+    }
+    var ticksLength = ticks.length;
+    ticks = ticks.uniq();
+    if (ticksLength === ticks.length) {
+      ticksLabels.insertAt(1, '');
+    }
+
     // 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
@@ -322,7 +333,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);
       }
     }
@@ -331,7 +343,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');
 
@@ -394,11 +406,19 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
    *
    * @method valueForTick
    * @param {Number} val
+   * @param {Boolean} [toGreater]
    * @private
    * @returns {Number}
    */
-  valueForTick: function(val) {
-    return this.get('unitType') === 'int' ? Math.round(val) : parseFloat(val.toFixed(3));
+  valueForTick: function(val, toGreater) {
+    toGreater = toGreater || false;
+    var func = toGreater ? Math.round : Math.floor;
+    if (this.get('unitType') === 'int') {
+      return func(val);
+    }
+    var mirrorStep = this.get('mirrorStep');
+    var r = func(val / mirrorStep);
+    return parseFloat((r * mirrorStep).toFixed(3));
   },
 
   /**


Mime
View raw message