Repository: ambari
Updated Branches:
  refs/heads/trunk ac1fbc23d -> ddba476c7


AMBARI-14649 OOZIE_SERVER START failed. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: ddba476c7b858faead028c9564f3ebbbf90ce8ab
Parents: ac1fbc2
Author: ababiichuk <ababiic...@hortonworks.com>
Authored: Wed Jan 13 17:31:49 2016 +0200
Committer: ababiichuk <ababiic...@hortonworks.com>
Committed: Wed Jan 13 17:31:49 2016 +0200

----------------------------------------------------------------------
 .../configs/config_recommendation_parser.js     |  2 +-
 ambari-web/app/views/common/controls_view.js    | 72 ++++++++++----------
 .../config_recommendation_parser_test.js        |  2 +-
 3 files changed, 39 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ddba476c/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/mixins/common/configs/config_recommendation_parser.js 
b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
index 51d0b44..b5e2f2d 100644
--- a/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
+++ b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
@@ -168,7 +168,7 @@ App.ConfigRecommendationParser = 
Em.Mixin.create(App.ConfigRecommendations, {
     App.assertExists(serviceName, 'serviceName');
 
     var coreObject = this._getCoreProperties(serviceName, recommendedValue, 
this._getInitialFromRecommendations(name, fileName)),
-      newConfig = App.config.getDefaultConfig(name, fileName, serviceName, 
coreObject),
+      newConfig = App.config.getDefaultConfig(name, serviceName, fileName, 
coreObject),
       addedPropertyObject = App.ServiceConfigProperty.create(newConfig);
 
     addedPropertyObject.validate();

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddba476c/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js 
b/ambari-web/app/views/common/controls_view.js
index 1bd789e..48493f0 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -92,14 +92,15 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
    * and in case there was changes shows popup with info about changed configs
    *
    * @param {App.ServiceConfigProperty} config
+   * @param [controller]
    * @returns {$.Deferred}
    */
-  sendRequestRorDependentConfigs: function(config) {
+  sendRequestRorDependentConfigs: function(config, controller) {
     if (!config || (!config.get('isValid') && 
config.get('isNotDefaultValue'))) return $.Deferred().resolve().promise();
-    if 
(['mainServiceInfoConfigsController','wizardStep7Controller'].contains(this.get('controller.name')))
 {
+    controller = controller || this.get('controller');
+    if (controller && 
['mainServiceInfoConfigsController','wizardStep7Controller'].contains(controller.get('name')))
 {
       var name = config.get('name');
       var saveRecommended = (config.get('value') === 
config.get('recommendedValue'));
-      var controller = this.get('controller');
       var type = App.config.getConfigTagFromFileName(config.get('filename'));
       var p = App.configsCollection.getConfig(App.config.configId(name, type));
        if ((p && Em.get(p, 'propertyDependedBy.length') > 0 || Em.get(p, 
'displayType') === 'user') && config.get('oldValue') !== config.get('value')) {
@@ -154,6 +155,33 @@ App.SupportsDependentConfigs = Ember.Mixin.create({
 });
 
 /**
+ * mixin is used to send request for recommendations
+ * when config value is updated by user
+ */
+App.ValueObserver = Em.Mixin.create(App.SupportsDependentConfigs, {
+
+  selected: false,
+
+  focusOut: function () {
+    this.set('selected', false);
+  },
+
+  focusIn: function () {
+    this.set('selected', true);
+  },
+
+  onValueUpdate: function () {
+    if (this.get('selected')) {
+      var self = this, config = this.get('serviceConfig'),
+        controller = this.get('controller');
+      delay(function(){
+        self.sendRequestRorDependentConfigs(config, controller);
+      }, 500);
+    }
+  }.observes('serviceConfig.value')
+});
+
+/**
  * mixin set class that serve as unique element identifier,
  * id not used in order to avoid collision with ember ids
  */
@@ -173,27 +201,20 @@ App.ServiceConfigCalculateId = Ember.Mixin.create({
  * Default input control
  * @type {*}
  */
-App.ServiceConfigTextField = 
Ember.TextField.extend(App.ServiceConfigPopoverSupport, 
App.ServiceConfigCalculateId, App.SupportsDependentConfigs, {
+App.ServiceConfigTextField = 
Ember.TextField.extend(App.ServiceConfigPopoverSupport, 
App.ServiceConfigCalculateId, App.ValueObserver, {
 
   valueBinding: 'serviceConfig.value',
   classNameBindings: 'textFieldClassName',
   placeholderBinding: 'serviceConfig.placeholder',
 
-  onValueUpdate: function () {
-    if ($(this.get('element')).is(':focus')) {
-      var self = this;
-      delay(function(){
-        self.sendRequestRorDependentConfigs(self.get('serviceConfig'));
-      }, 500);
-    }
-  }.observes('serviceConfig.value'),
-
   //Set editDone true for last edited config text field parameter
   focusOut: function () {
+    this._super();
     this.get('serviceConfig').set("editDone", true);
   },
   //Set editDone false for all current category config text field parameter
   focusIn: function () {
+    this._super();
     if (!this.get('serviceConfig.isOverridden') && 
!this.get('serviceConfig.isComparison')) {
       if (this.get('parentView.categoryConfigsAll')) {
         this.get("parentView.categoryConfigsAll").setEach("editDone", false);
@@ -217,20 +238,11 @@ App.ServiceConfigTextField = 
Ember.TextField.extend(App.ServiceConfigPopoverSupp
  * Customized input control with Units type specified
  * @type {Em.View}
  */
-App.ServiceConfigTextFieldWithUnit = 
Ember.View.extend(App.ServiceConfigPopoverSupport, 
App.SupportsDependentConfigs, {
+App.ServiceConfigTextFieldWithUnit = 
Ember.View.extend(App.ServiceConfigPopoverSupport, App.ValueObserver, {
   valueBinding: 'serviceConfig.value',
   classNames: ['input-append', 'with-unit'],
   placeholderBinding: 'serviceConfig.savedValue',
 
-  onValueUpdate: function () {
-    if ($(this.get('element')).is(':focus')) {
-      var self = this;
-      delay(function(){
-        self.sendRequestRorDependentConfigs(self.get('serviceConfig'));
-      }, 500);
-    }
-  }.observes('serviceConfig.value'),
-
   templateName: 
require('templates/wizard/controls_service_config_textfield_with_unit')
 });
 
@@ -277,17 +289,7 @@ App.ServiceConfigPasswordField = 
Ember.TextField.extend(App.ServiceConfigPopover
  * Textarea control
  * @type {*}
  */
-App.ServiceConfigTextArea = 
Ember.TextArea.extend(App.ServiceConfigPopoverSupport, 
App.ServiceConfigCalculateId, App.SupportsDependentConfigs, {
-
-
-  onValueUpdate: function () {
-    if ($(this.get('element')).is(':focus')) {
-      var self = this;
-      delay(function(){
-        self.sendRequestRorDependentConfigs(self.get('serviceConfig'));
-      }, 500);
-    }
-  }.observes('serviceConfig.value'),
+App.ServiceConfigTextArea = 
Ember.TextArea.extend(App.ServiceConfigPopoverSupport, 
App.ServiceConfigCalculateId, App.ValueObserver, {
 
   valueBinding: 'serviceConfig.value',
   rows: 4,
@@ -300,7 +302,7 @@ App.ServiceConfigTextArea = 
Ember.TextArea.extend(App.ServiceConfigPopoverSuppor
  * Textarea control for content type
  * @type {*}
  */
-App.ServiceConfigTextAreaContent = 
Ember.TextArea.extend(App.ServiceConfigPopoverSupport, 
App.ServiceConfigCalculateId, App.SupportsDependentConfigs, {
+App.ServiceConfigTextAreaContent = 
Ember.TextArea.extend(App.ServiceConfigPopoverSupport, 
App.ServiceConfigCalculateId, App.ValueObserver, {
 
   valueBinding: 'serviceConfig.value',
   rows: 20,

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddba476c/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js 
b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
index f406336..12959f6 100644
--- a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
+++ b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
@@ -275,7 +275,7 @@ describe('App.ConfigRecommendationParser', function() {
     });
     
     it('adds new config', function() {
-      expect(instanceObject._createNewProperty('name', 'serviceName', 
'fileName', 'recommendedValue', null)).to.eql(App.ServiceConfigProperty.create({
+      expect(instanceObject._createNewProperty('name', 'fileName', 
'serviceName', 'recommendedValue', 
null)).to.eql(App.ServiceConfigProperty.create({
         'value': 'recommendedValue',
         'recommendedValue': 'recommendedValue',
         'initialValue': 'initialValue',

Reply via email to