You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/06/12 14:58:58 UTC

ambari git commit: AMBARI-11878 Kerberos Wizard: Configure kerberos step infinite spinner shown.(ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk 25322e999 -> 0624e8cd3


AMBARI-11878 Kerberos Wizard: Configure kerberos step infinite spinner shown.(ababiichuk)


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

Branch: refs/heads/trunk
Commit: 0624e8cd360eb6b68d31641621cc5bd09ea66808
Parents: 25322e9
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Fri Jun 12 15:34:48 2015 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Fri Jun 12 15:34:48 2015 +0300

----------------------------------------------------------------------
 .../main/admin/kerberos/step2_controller.js     |  6 ++-
 .../main/admin/kerberos/wizard_controller.js    |  2 +-
 ambari-web/app/mixins/common/serverValidator.js |  4 ++
 ambari-web/app/utils/config.js                  |  2 +-
 .../test/mixins/common/serverValidator_test.js  | 45 ++++++++++++++++++++
 5 files changed, 55 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0624e8cd/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
index 7203924..a34dc30 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
@@ -67,6 +67,7 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
 
   clearStep: function () {
     this._super();
+    this.set('configs', []);
     this.get('serviceConfigTags').clear();
     this.set('servicesInstalled', false);
   },
@@ -78,9 +79,10 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({
    */
   loadStep: function () {
     console.log("TRACE: Loading step7: Configure Services");
+    if (!App.StackService.find().someProperty('serviceName', 'KERBEROS') || !this.get('isConfigsLoaded')) {
+      return;
+    }
     this.clearStep();
-    var kerberosStackService = App.StackService.find().findProperty('serviceName', 'KERBEROS');
-    if (!kerberosStackService) return;
     //STEP 1: Load advanced configs
     var advancedConfigs = this.get('content.advancedServiceConfig');
     //STEP 2: Load on-site configs by service from local DB

http://git-wip-us.apache.org/repos/asf/ambari/blob/0624e8cd/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
index d01c581..515fc0a 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
@@ -180,7 +180,7 @@ App.KerberosWizardController = App.WizardController.extend({
    * @param newValue
    */
   overrideVisibility: function (itemsArray, newValue, exceptions) {
-    newValue = newValue || false
+    newValue = newValue || false;
 
     for (var i = 0, len = itemsArray.length; i < len; i += 1) {
       if (!Ember.$.isEmptyObject(itemsArray[i])) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/0624e8cd/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index 47c6624..f67e997 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -114,6 +114,10 @@ App.ServerValidatorMixin = Em.Mixin.create({
    * @returns {*}
    */
   loadServerSideConfigsRecommendations: function() {
+    // if extended controller doesn't support recommendations ignore this call but keep promise chain
+    if (!this.get('isControllerSupportsEnhancedConfigs')) {
+      return $.Deferred().resolve().promise();
+    }
     return App.ajax.send({
       'name': 'config.recommendations',
       'sender': this,

http://git-wip-us.apache.org/repos/asf/ambari/blob/0624e8cd/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 1b49986..d599363 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -523,7 +523,7 @@ App.config = Em.Object.create({
           if (_preDefinedConfig.serviceName != 'MISC' && _preDefinedConfig.filename && !configTypes.contains(self.getConfigTagFromFileName(_preDefinedConfig.filename))) {
             return;
           }
-          preDefinedCfgs.push(_preDefinedConfig);
+          preDefinedCfgs.push($.extend(true, {}, _preDefinedConfig));
         }
       }, this);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0624e8cd/ambari-web/test/mixins/common/serverValidator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/serverValidator_test.js b/ambari-web/test/mixins/common/serverValidator_test.js
index e0fed81..a17698f 100644
--- a/ambari-web/test/mixins/common/serverValidator_test.js
+++ b/ambari-web/test/mixins/common/serverValidator_test.js
@@ -130,5 +130,50 @@ describe('App.ServerValidatorMixin', function() {
       });
     });
   });
+
+  describe('#loadServerSideConfigsRecommendations', function() {
+    describe('Request on recommendations for only specified controllers', function() {
+      beforeEach(function() {
+        sinon.stub(App.ajax, 'send', function(args) { return args; });
+      });
+
+      afterEach(function() {
+        App.ajax.send.restore();
+      });
+
+      [
+        {
+          controllerName: '',
+          injectEnhancedConfigsMixin: false,
+          e: false
+        },
+        {
+          controllerName: 'wizardStep7Controller',
+          injectEnhancedConfigsMixin: true,
+          e: true
+        },
+        {
+          controllerName: 'kerberosWizardStep2Controller',
+          injectEnhancedConfigsMixin: true,
+          e: false
+        }
+      ].forEach(function(test) {
+        it('controller "name": {0} using "EnhancedConfigsMixin": {1} recommendations called: {2}'.format(test.controllerName, test.injectEnhancedConfigsMixin, test.e), function() {
+          var mixed;
+          if (test.injectEnhancedConfigsMixin) {
+            mixed = Em.Object.extend(App.EnhancedConfigsMixin, App.ServerValidatorMixin);
+          } else {
+            mixed = Em.Object.extend(App.ServerValidatorMixin);
+          }
+          // mock controller name in mixed object directly
+          mixed.create({name: test.controllerName}).loadServerSideConfigsRecommendations();
+          expect(App.ajax.send.calledOnce).to.be.eql(test.e);
+          if (test.e) {
+            expect(App.ajax.send.args[0][0].name).to.be.eql('config.recommendations');
+          }
+        });
+      });
+    });
+  });
 });