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-10269. Config overrides have isOriginalSCP field as true, but should be false (onechiporenko)
Date Mon, 30 Mar 2015 12:08:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk d2e2a7914 -> d794a8470


AMBARI-10269. Config overrides have isOriginalSCP field as true, but should be false (onechiporenko)


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

Branch: refs/heads/trunk
Commit: d794a8470e671d4188317c5a525cdabc92fa5407
Parents: d2e2a79
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Mon Mar 30 14:35:55 2015 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Mon Mar 30 14:35:55 2015 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 96 +++++++++-----------
 .../configs/widgets/slider_config_widget.hbs    |  8 +-
 ambari-web/app/views.js                         |  1 +
 .../configs/selectable_popup_body_view.js       | 58 ++++++++++++
 .../configs/widgets/config_widget_view.js       |  8 ++
 .../widgets/slider_config_widget_view.js        |  2 +-
 6 files changed, 117 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d794a847/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 670d06e..28c1a63 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -165,6 +165,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
 
   /**
    * Dropdown menu items in filter combobox
+   * @type {{attributeName: string, attributeValue: string, name: string, selected: boolean}[]}
    */
   filterColumns: function () {
     var filterColumns = [];
@@ -183,7 +184,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
   }.property('propertyFilters', 'isCompareMode'),
 
   /**
-   * indicate wtether service config version belongs to default config group
+   * indicate whether service config version belongs to default config group
    * @method isVersionDefault
    * @param version
    * @return {Boolean}
@@ -202,26 +203,29 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
 
   /**
    * clear and set properties to default value
+   * @method clearStep
    */
   clearStep: function () {
     if (this.get('requestInProgress') && this.get('requestInProgress').readyState
!== 4) {
       this.get('requestInProgress').abort();
       this.set('requestInProgress', null);
     }
-    this.set("saveInProgress", false);
-    this.set('modifiedFileNames', []);
-    this.set('isInit', true);
-    this.set('hash', null);
-    this.set('forceTransition', false);
-    this.set('dataIsLoaded', false);
-    this.set('versionLoaded', false);
-    this.set('filter', '');
+    this.setProperties({
+      saveInProgress: false,
+      modifiedFileNames: [],
+      isInit: true,
+      hash: null,
+      forceTransition: false,
+      dataIsLoaded: false,
+      versionLoaded: false,
+      filter: '',
+      loadedGroupToOverrideSiteToTagMap: {},
+      serviceConfigVersionNote: ''
+    });
     this.get('filterColumns').setEach('selected', false);
     this.get('stepConfigs').clear();
     this.get('allConfigs').clear();
     this.get('uiConfigs').clear();
-    this.set('loadedGroupToOverrideSiteToTagMap', {});
-    this.set('serviceConfigVersionNote', '');
     if (this.get('serviceConfigTags')) {
       this.set('serviceConfigTags', null);
     }
@@ -237,6 +241,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
    * {String}
    */
   hash: null,
+
   /**
    * Is this initial config group changing
    * {Boolean}
@@ -245,6 +250,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
 
   /**
    * On load function
+   * @method loadStep
    */
   loadStep: function () {
     console.log("TRACE: Loading configure for service");
@@ -943,10 +949,12 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
     this.get('stepConfigs').pushObject(serviceConfig);
     this.set('selectedService', this.get('stepConfigs').objectAt(0));
     this.checkForSecureConfig(this.get('selectedService'));
-    this.set('dataIsLoaded', true);
-    this.set('versionLoaded', true);
-    this.set('hash', this.getHash());
-    this.set('isInit', false);
+    this.setProperties({
+      dataIsLoaded: true,
+      versionLoaded: true,
+      hash: this.getHash(),
+      isInit: false
+    });
   },
 
   /**
@@ -1009,7 +1017,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
     var defaultGroupSelected = this.get('selectedConfigGroup.isDefault');
     configs.forEach(function (_serviceConfigProperty) {
       var serviceConfigProperty = this.createConfigProperty(_serviceConfigProperty, defaultGroupSelected);
-      componentConfig.configs.pushObject(serviceConfigProperty);
+      componentConfig.get('configs').pushObject(serviceConfigProperty);
       serviceConfigProperty.validate();
     }, this);
     componentConfig.set('initConfigsLength', componentConfig.get('configs.length'));
@@ -1025,10 +1033,10 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
   createConfigProperty: function (_serviceConfigProperty, defaultGroupSelected) {
     if (!_serviceConfigProperty) return null;
 
-    var overrides = _serviceConfigProperty.overrides;
+    var overrides = Em.get(_serviceConfigProperty, 'overrides');
     // we will populate the override properties below
     Em.set(_serviceConfigProperty, 'overrides', null);
-    _serviceConfigProperty.isOverridable = Em.isNone(_serviceConfigProperty.isOverridable)
? true : _serviceConfigProperty.isOverridable;
+    Em.set(_serviceConfigProperty, 'isOverridable', Em.isNone(Em.get(_serviceConfigProperty,
'isOverridable')) ? true : Em.get(_serviceConfigProperty, 'isOverridable'));
 
     var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
 
@@ -1144,14 +1152,15 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
    * @returns {*}
    */
   createNewSCP: function (override, _serviceConfigProperty, serviceConfigProperty, defaultGroupSelected)
{
-    var newSCP = App.ServiceConfigProperty.create(_serviceConfigProperty);
-    newSCP.set('value', override.value);
-    newSCP.set('isFinal', override.isFinal);
-    newSCP.set('supportsFinal', serviceConfigProperty.get('supportsFinal'));
-    newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
-    newSCP.set('parentSCP', serviceConfigProperty);
-    newSCP.set('overrides', null);
-    newSCP.set('group', Em.get(override, 'group'));
+    var newSCP = App.ServiceConfigProperty.create(_serviceConfigProperty, {
+      value: Em.get(override, 'value'),
+      isFinal: Em.get(override, 'isFinal'),
+      group: Em.get(override, 'group'),
+      supportsFinal: serviceConfigProperty.get('supportsFinal'),
+      isOriginalSCP: false,
+      parentSCP: serviceConfigProperty,
+      overrides: null
+    });
     if (defaultGroupSelected) {
       newSCP.set('isEditable', false);
     }
@@ -2562,26 +2571,10 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
   },
 
   showItemsShouldBeRestarted: function (content, header) {
-    App.ModalPopup.show({
+    return App.ModalPopup.show({
       content: content,
       header: header,
-      bodyClass: Em.View.extend({
-        templateName: require('templates/common/selectable_popup'),
-        textareaVisible: false,
-        textTrigger: function () {
-          this.set('textareaVisible', !this.get('textareaVisible'));
-        },
-        putContentToTextarea: function () {
-          var content = this.get('parentView.content');
-          if (this.get('textareaVisible')) {
-            var wrapper = $(".task-detail-log-maintext");
-            $('.task-detail-log-clipboard').html(content).width(wrapper.width()).height(wrapper.height());
-            Em.run.next(function () {
-              $('.task-detail-log-clipboard').select();
-            });
-          }
-        }.observes('textareaVisible')
-      }),
+      bodyClass: App.SelectablePopupBodyView,
       secondary: null
     });
   },
@@ -2601,13 +2594,14 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
         serviceConfigProperty.set('overrides', overrides);
       }
       // create new override with new value
-      var newSCP = App.ServiceConfigProperty.create(serviceConfigProperty);
-      newSCP.set('value', value || '');
-      newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
-      newSCP.set('parentSCP', serviceConfigProperty);
-      newSCP.set('isEditable', true);
-      newSCP.set('group', group);
-      newSCP.set('overrides', null);
+      var newSCP = App.ServiceConfigProperty.create(serviceConfigProperty, {
+        value: value || '',
+        isOriginalSCP: false,
+        parentSCP: serviceConfigProperty,
+        isEditable: true,
+        group: group,
+        overrides: null
+      });
       console.debug("createOverrideProperty(): Added:", newSCP, " to main-property:", serviceConfigProperty);
       overrides.pushObject(newSCP);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d794a847/ambari-web/app/templates/common/configs/widgets/slider_config_widget.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/widgets/slider_config_widget.hbs b/ambari-web/app/templates/common/configs/widgets/slider_config_widget.hbs
index 67f296a..54ac741 100644
--- a/ambari-web/app/templates/common/configs/widgets/slider_config_widget.hbs
+++ b/ambari-web/app/templates/common/configs/widgets/slider_config_widget.hbs
@@ -17,8 +17,8 @@
 }}
 
 <div class="widget slider-widget">
-  {{#if view.config.isOriginalSCP}}
-    <p>{{view.configLabel}}</p>
+  {{#if view.isOriginalSCP}}
+    <p>{{formatWordBreak view.configLabel}}</p>
   {{/if}}
   <div>
     <div {{bindAttr class="view.isMirrorValueValid::error :control-group :pull-left"}}>
@@ -29,7 +29,7 @@
         {{/if}}
       </div>
     </div>
-    {{#if view.config.isOriginalSCP}}
+    {{#if view.isOriginalSCP}}
       {{view App.RestoreConfigView visibleBinding="view.undoAllowed"}}
     {{/if}}
     {{#if view.overrideAllowed}}
@@ -48,7 +48,7 @@
   <div class="ui-slider-wrapper">
     {{view Ember.TextField valueBinding="view.config.value" class="input-mini slider-input"}}
   </div>
-  {{#if view.config.overrides.length}}
+  {{#if view.isOriginalSCP}}
     {{view App.SliderConfigWidgetOverrideView
       serviceConfigPropertyBinding="view.config"
       isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault"

http://git-wip-us.apache.org/repos/asf/ambari/blob/d794a847/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index b074010..ef98340 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -51,6 +51,7 @@ require('views/common/configs/overriddenProperty_view');
 require('views/common/configs/compare_property_view');
 require('views/common/configs/config_history_flow');
 require('views/common/configs/restore_config_view');
+require('views/common/configs/selectable_popup_body_view');
 require('views/common/configs/custom_category_views/notification_configs_view');
 require('views/common/configs/widgets/config_widget_view');
 require('views/common/configs/widgets/checkbox_config_widget_view');

http://git-wip-us.apache.org/repos/asf/ambari/blob/d794a847/ambari-web/app/views/common/configs/selectable_popup_body_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/selectable_popup_body_view.js b/ambari-web/app/views/common/configs/selectable_popup_body_view.js
new file mode 100644
index 0000000..e527563
--- /dev/null
+++ b/ambari-web/app/views/common/configs/selectable_popup_body_view.js
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+/**
+ * Body-view for popups where shown content may be switched to textarea-view
+ * @type {Ember.View}
+ */
+App.SelectablePopupBodyView = Em.View.extend({
+
+  templateName: require('templates/common/selectable_popup'),
+
+  /**
+   * True - if editable textarea is visible, false - otherwise
+   * @type {boolean}
+   */
+  textareaVisible: false,
+
+  /**
+   * Switch <code>textareaVisible</code> value
+   * @method textTrigger
+   */
+  textTrigger: function () {
+    this.toggleProperty('textareaVisible');
+  },
+
+  /**
+   * Set data to the visible textarea
+   * @method putContentToTextarea
+   */
+  putContentToTextarea: function () {
+    var content = this.get('parentView.content');
+    if (this.get('textareaVisible')) {
+      var wrapper = $(".task-detail-log-maintext");
+      $('.task-detail-log-clipboard').html(content).width(wrapper.width()).height(wrapper.height());
+      Em.run.next(function () {
+        $('.task-detail-log-clipboard').select();
+      });
+    }
+  }.observes('textareaVisible')
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/d794a847/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 d4d10ca..b7b1dc7 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
@@ -30,6 +30,14 @@ App.ConfigWidgetView = Em.View.extend({
   config: null,
 
   /**
+   * Alias to <code>config.isOriginalSCP</code>
+   * Should be used in the templates
+   * Don't use original <code>config.isOriginalSCP</code> in the widget-templates!!!
+   * @type {boolean}
+   */
+  isOriginalSCPBinding: 'config.isOriginalSCP',
+
+  /**
    * Config name to display.
    * @type {String}
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/d794a847/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 118f50f..fad30aa 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
@@ -165,7 +165,7 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
       ticksLabels.push(index % 2 === 0 ? tick + ' ' + unit : '');
     });
 
-    var slider = new Slider('#' + this.get('elementId') + ' input.slider-input', {
+    var slider = new Slider(this.$('input.slider-input')[0], {
       value: parseFunction(this.get('config.value')),
       ticks: ticks,
       tooltip: 'hide',


Mime
View raw message