You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2016/04/18 12:13:01 UTC
ambari git commit: AMBARI-15920 Save creds checkbox is enabled,
even though ambari is not config'd to save. (atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk 044094604 -> ba3490399
AMBARI-15920 Save creds checkbox is enabled, even though ambari is not config'd to save. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ba349039
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ba349039
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ba349039
Branch: refs/heads/trunk
Commit: ba349039921c10a844e0ca37cd664e1656d6465a
Parents: 0440946
Author: Andrii Tkach <at...@apache.org>
Authored: Fri Apr 15 18:33:22 2016 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Mon Apr 18 13:11:12 2016 +0300
----------------------------------------------------------------------
.../main/admin/kerberos/step2_controller.js | 5 +-
.../common/kdc_credentials_controller_mixin.js | 49 ++++++++++++----
.../app/views/common/configs/services_config.js | 4 +-
.../app/views/main/admin/kerberos/step2_view.js | 10 ++--
.../kdc_credentials_controller_mixin_test.js | 61 +++++++++++++++++++-
5 files changed, 106 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba349039/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 c95823f..52177b7 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
@@ -93,9 +93,12 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend(App.KDCCred
this.filterConfigs(this.get('configs'));
if (!this.get('wizardController.skipClientInstall')) {
- this.initilizeKDCStoreProperties(this.get('configs'));
+ this.initializeKDCStoreProperties(this.get('configs'));
}
this.applyServicesConfigs(this.get('configs'));
+ if (!this.get('wizardController.skipClientInstall')) {
+ this.updateKDCStoreProperties(this.get('stepConfigs').findProperty('serviceName', 'KERBEROS').get('configs'));
+ }
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba349039/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js b/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js
index 86ae83c..822b67c 100644
--- a/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js
+++ b/ambari-web/app/mixins/common/kdc_credentials_controller_mixin.js
@@ -104,30 +104,57 @@ App.KDCCredentialsControllerMixin = Em.Mixin.create({
},
/**
+ * initialize additional properties regarding KDC credential storage
+ * @method initializeKDCStoreProperties
+ * @param {App.ServiceConfigProperty[]} configs list of configs
+ */
+ initializeKDCStoreProperties: function(configs) {
+ this.generateKDCStoreProperties().forEach(function(configObject) {
+ var configProperty = configs.findProperty('name', configObject.name);
+ if (!Em.isNone(configProperty)) {
+ Em.setProperties(configProperty, configObject);
+ } else {
+ configs.pushObject(configObject);
+ }
+ });
+ },
+
+ /**
* Generate additional properties regarding KDC credential storage
- *
+ * @method updateKDCStoreProperties
* @param {App.ServiceConfigProperty[]} configs list of configs
*/
- initilizeKDCStoreProperties: function(configs) {
- var self = this;
+ updateKDCStoreProperties: function(configs) {
+ this.generateKDCStoreProperties().forEach(function(configObject) {
+ var configProperty = configs.findProperty('name', configObject.name);
+ if (!Em.isNone(configProperty)) {
+ Em.setProperties(configProperty, configObject);
+ }
+ });
+ },
+
+ /**
+ * generate additional properties regarding KDC credential storage
+ * @method generateKDCStoreProperties
+ * @returns {Array} properties
+ */
+ generateKDCStoreProperties: function() {
+ var properties = [];
+
this.get('credentialsStoreConfigs').forEach(function(item) {
var configObject = App.config.createDefaultConfig(item.name, 'krb5-conf.xml', false);
$.extend(configObject, item);
if (item.name === 'persist_credentials') {
- if (self.get('isStorePersisted')) {
+ if (this.get('isStorePersisted')) {
configObject.hintMessage = Em.I18n.t('admin.kerberos.credentials.store.hint.supported');
} else {
configObject.hintMessage = Em.I18n.t('admin.kerberos.credentials.store.hint.not.supported');
configObject.isEditable = false;
}
}
- var configProperty = configs.findProperty('name', configObject.name);
- if (!Em.isNone(configProperty)) {
- Em.setProperties(configProperty, configObject);
- } else {
- configs.pushObject(configObject);
- }
- });
+ properties.push(configObject);
+ }, this);
+ return properties;
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba349039/ambari-web/app/views/common/configs/services_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/services_config.js b/ambari-web/app/views/common/configs/services_config.js
index 1b5a930..77ccff8 100644
--- a/ambari-web/app/views/common/configs/services_config.js
+++ b/ambari-web/app/views/common/configs/services_config.js
@@ -23,9 +23,7 @@ App.ServicesConfigView = Em.View.extend({
templateName: require('templates/common/configs/services_config'),
didInsertElement: function () {
- Em.run.next(this, function() {
- this.get('controller') && this.get('controller').loadStep();
- });
+ this.get('controller').loadStep();
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba349039/ambari-web/app/views/main/admin/kerberos/step2_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/kerberos/step2_view.js b/ambari-web/app/views/main/admin/kerberos/step2_view.js
index 924fcef..8533035 100644
--- a/ambari-web/app/views/main/admin/kerberos/step2_view.js
+++ b/ambari-web/app/views/main/admin/kerberos/step2_view.js
@@ -20,12 +20,10 @@ var App = require('app');
require('views/wizard/step7_view');
+/**
+ * controller.loadStep() called from internal view App.ServicesConfigView
+ */
App.KerberosWizardStep2View = App.WizardStep7View.extend({
- templateName: require('templates/main/admin/kerberos/step2'),
-
- didInsertElement: function() {
- var controller = this.get('controller');
- controller.loadStep();
- }
+ templateName: require('templates/main/admin/kerberos/step2')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba349039/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js b/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
index e3a1960..eda0f13 100644
--- a/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
+++ b/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
@@ -33,7 +33,7 @@ describe('App.KDCCredentialsControllerMixin', function() {
mixedObject.destroy();
});
- describe('#initilizeKDCStoreProperties', function() {
+ describe('#initializeKDCStoreProperties', function() {
[
{
isStorePersisted: true,
@@ -63,7 +63,7 @@ describe('App.KDCCredentialsControllerMixin', function() {
return test.isStorePersisted;
}.property()
});
- mixedObject.initilizeKDCStoreProperties(configs);
+ mixedObject.initializeKDCStoreProperties(configs);
config = configs.findProperty('name', 'persist_credentials');
});
@@ -76,6 +76,63 @@ describe('App.KDCCredentialsControllerMixin', function() {
});
});
+ describe('#updateKDCStoreProperties', function() {
+ [
+ {
+ isStorePersisted: true,
+ e: {
+ isEditable: true,
+ hintMessage: Em.I18n.t('admin.kerberos.credentials.store.hint.supported')
+ },
+ message: 'Persistent store available, config should be editable, and appropriate hint shown',
+ configs: [
+ Em.Object.create({
+ name: 'persist_credentials',
+ isEditable: false,
+ hintMessage: ''
+ })
+ ]
+ },
+ {
+ isStorePersisted: false,
+ e: {
+ isEditable: false,
+ hintMessage: Em.I18n.t('admin.kerberos.credentials.store.hint.not.supported')
+ },
+ message: 'Only temporary store available, config should be disabled, and appropriate hint shown',
+ configs: [
+ Em.Object.create({
+ name: 'persist_credentials',
+ isEditable: true,
+ hintMessage: ''
+ })
+ ]
+ }
+ ].forEach(function(test) {
+ describe(test.message, function() {
+
+ var config;
+
+ beforeEach(function () {
+ var configs = test.configs;
+ mixedObject.reopen({
+ isStorePersisted: function() {
+ return test.isStorePersisted;
+ }.property()
+ });
+ mixedObject.updateKDCStoreProperties(configs);
+ config = configs.findProperty('name', 'persist_credentials');
+ });
+
+ Object.keys(test.e).forEach(function(key) {
+ it(key, function () {
+ assert.equal(Em.get(config, key), test.e[key], 'validate attribute: ' + key);
+ });
+ });
+ });
+ });
+ });
+
describe('#createKDCCredentials', function() {
function createConfig (name, value) {