You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/06/09 21:59:57 UTC
[1/2] ambari git commit: AMBARI-11803. Kerberos: attempting to add
service includes warning about admin creds (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 721f8a36b -> 1862126a0
AMBARI-11803. Kerberos: attempting to add service includes warning about admin creds (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1862126a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1862126a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1862126a
Branch: refs/heads/trunk
Commit: 1862126a061dca808871d6efa331ee75ae8d5daa
Parents: a44784f
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Jun 9 19:43:26 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Jun 9 22:59:02 2015 +0300
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
.../main/admin/kerberos/step4_controller.js | 5 +-
.../app/controllers/wizard/step7_controller.js | 42 +-----------
ambari-web/app/mixins.js | 1 +
.../mixins/common/configs/toggle_isrequired.js | 59 +++++++++++++++++
.../test/controllers/wizard/step7_test.js | 51 ---------------
.../common/configs/toggle_isrequired_test.js | 68 ++++++++++++++++++++
7 files changed, 135 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1862126a/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index e86647b..04903e6 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -135,6 +135,7 @@ var files = ['test/init_model_test',
'test/mappers/configs/themes_mapper_test',
'test/mixins/common/configs/enhanced_configs_test',
'test/mixins/common/configs/configs_saver_test',
+ 'test/mixins/common/configs/toggle_isrequired_test',
'test/mixins/common/chart/storm_linear_time_test',
'test/mixins/common/widgets/widget_section_test',
'test/mixins/common/localStorage_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/1862126a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
index 32f1601..f5f232f 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
@@ -19,7 +19,7 @@
var App = require('app');
require('controllers/wizard/step7_controller');
-App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecurityConfigs, {
+App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecurityConfigs, App.ToggleIsRequiredMixin, {
name: 'kerberosWizardStep4Controller',
adminPropertyNames: [{name: 'admin_principal', displayName: 'Admin principal'}, {name: 'admin_password', displayName: 'Admin password'}],
@@ -40,6 +40,9 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
this.getDescriptorConfigs().then(function(properties) {
self.setStepConfigs(properties);
self.set('isRecommendedLoaded', true);
+ self.get('stepConfigs').forEach(function(service) {
+ self.overrideConfigIsRequired(service);
+ })
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/1862126a/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index c74bba2..fdc11c7 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -27,7 +27,7 @@ var App = require('app');
*
*/
-App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.EnhancedConfigsMixin, {
+App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.EnhancedConfigsMixin, App.ToggleIsRequiredMixin, {
name: 'wizardStep7Controller',
@@ -444,7 +444,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
service.set('selectedConfigGroup', this.get('preSelectedConfigGroup'));
this.loadComponentConfigs(service.get('configs'), serviceConfig, service);
// override if a property isRequired or not
- this._overrideConfigIsRequired(serviceName);
+ this.overrideConfigIsRequired(service);
service.set('configs', serviceConfig.get('configs'));
},
@@ -1445,43 +1445,5 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
$('a[href="#' + service.serviceName + '"]').tab('show');
}
}
- },
-
- /**
- * Override isRequired property of the configurations in given situation
- * @param serviceName - make changes only for properties from this service
- * @private
- */
- _overrideConfigIsRequired: function (serviceName) {
- var excludeProperties = [
- {
- name: 'KERBEROS', // affected service
- exclude: ['kdc_host', 'admin_server_host', 'admin_principal', 'admin_password'], // affected properties
- condition: 'false', // check this condition
- conditionalProperty: 'manage_identities' // against this property
- }
- ];
-
- var configs = this.get('stepConfigs'),
- service = excludeProperties.findProperty('name', serviceName),
- serviceConfigs = configs.findProperty('serviceName', serviceName);
- if (service && !Em.isEmpty(serviceConfigs.configs)) {
- var conditionProperty = serviceConfigs.configs.findProperty('name', service.conditionalProperty);
- if (conditionProperty && conditionProperty.get('savedValue') === service.condition) {
- service.exclude.forEach(function(property) {
- var serviceProperty = serviceConfigs.configs.findProperty('name', property);
- if (serviceProperty) {
- Em.set(serviceProperty, "isRequired", false);
- if (serviceProperty.get('value')==='') {
- // clear validation errors because validation does not clear isRequired validations
- Em.set(serviceProperty, "error", false);
- Em.set(serviceProperty, "errorMessage", '');
- }
- // validate property
- serviceProperty.validate();
- }
- })
- };
- }
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1862126a/ambari-web/app/mixins.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins.js b/ambari-web/app/mixins.js
index 2ff5de8..838ace5 100644
--- a/ambari-web/app/mixins.js
+++ b/ambari-web/app/mixins.js
@@ -45,6 +45,7 @@ require('mixins/wizard/wizard_menu_view');
require('mixins/wizard/assign_master_components');
require('mixins/common/configs/enhanced_configs');
require('mixins/common/configs/configs_saver');
+require('mixins/common/configs/toggle_isrequired');
require('mixins/common/widgets/widget_mixin');
require('mixins/common/widgets/widget_section');
require('mixins/unit_convert/base_unit_convert_mixin');
http://git-wip-us.apache.org/repos/asf/ambari/blob/1862126a/ambari-web/app/mixins/common/configs/toggle_isrequired.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/toggle_isrequired.js b/ambari-web/app/mixins/common/configs/toggle_isrequired.js
new file mode 100644
index 0000000..85d8f1d
--- /dev/null
+++ b/ambari-web/app/mixins/common/configs/toggle_isrequired.js
@@ -0,0 +1,59 @@
+/**
+ * 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');
+
+App.ToggleIsRequiredMixin = Em.Mixin.create({
+ /**
+ * Override isRequired property of the configurations in given situation
+ * @param serviceName - make changes only for properties from this service
+ */
+ overrideConfigIsRequired: function (serviceConfigs) {
+ var excludeProperties = [
+ {
+ name: 'KERBEROS', // affected service
+ exclude: ['kdc_host', 'admin_server_host', 'admin_principal', 'admin_password'] // affected properties
+ },
+ {
+ name: 'KERBEROS_GENERAL', // affected service
+ exclude: ['kdc_host', 'admin_server_host', 'admin_principal', 'admin_password'] // affected properties
+ }
+ ];
+ var serviceName = serviceConfigs.get('serviceName'),
+ service = excludeProperties.findProperty('name', serviceName),
+ configs = serviceConfigs.get('configs');
+
+ if (service && !Em.isEmpty(configs)) {
+ service.exclude.forEach(function (property) {
+ var serviceProperty = configs.findProperty('name', property);
+ if (serviceProperty) {
+ var value = serviceProperty.get('isRequired');
+ Em.set(serviceProperty, "isRequired", !value);
+ if (value && serviceProperty.get('value')==='') {
+ // clear validation errors because validation does not clear isRequired validations
+ Em.set(serviceProperty, "error", false);
+ Em.set(serviceProperty, "errorMessage", '');
+ }
+ // validate property
+ serviceProperty.validate();
+ }
+ });
+ }
+ }
+
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/1862126a/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 0d69d36..64c3e70 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -2106,55 +2106,4 @@ describe('App.InstallerStep7Controller', function () {
});
});
-
- describe('#_overrideConfigIsRequired', function () {
- var controller;
- beforeEach(function() {
- controller = App.WizardStep7Controller.create({});
- var configs = Em.A([
- App.ServiceConfigProperty.create({ name: 'manage_identities', value: 'true', savedValue: 'true', category: 'KDC', serviceName: 'KERBEROS'}),
- App.ServiceConfigProperty.create({ name: 'kdc_host', value: '', category: 'KDC', serviceName: 'KERBEROS'}),
- App.ServiceConfigProperty.create({ name: 'admin_server_host', value: '', category: 'KDC', serviceName: 'KERBEROS'}),
- App.ServiceConfigProperty.create({ name: 'admin_principal', value: '', category: 'KDC', serviceName: 'KERBEROS'}),
- App.ServiceConfigProperty.create({ name: 'admin_password', value: '', category: 'KDC', serviceName: 'KERBEROS'})
- ]);
- configs.forEach(function(config) {
- config.validate(); // make isRequired to trigger validation and to set every property's error flag to true
- });
- var serviceConfigs = Em.A([
- App.ServiceConfig.create({
- 'serviceName': 'KERBEROS',
- 'configs': configs
- })
- ]);
- controller.set('stepConfigs', serviceConfigs);
- });
-
-
- it('manage_identities = true should warn user that fields are required', function () {
- controller._overrideConfigIsRequired("KERBEROS");
-
- var allTrue = true;
- controller.get('stepConfigs')[0].configs.forEach(function(p) {
- allTrue = allTrue && !p.error;
- });
- // should have error
- expect(allTrue).to.be.false;
- });
-
- it('manage_identities = false should NOT warn user that fields are required', function () {
- // manage_identities = false
- Em.set(controller.get('stepConfigs')[0].configs.findProperty('name','manage_identities'), 'savedValue', 'false');
-
- controller._overrideConfigIsRequired("KERBEROS");
-
- var allTrue = true;
- controller.get('stepConfigs')[0].configs.forEach(function(p) {
- allTrue = allTrue && !p.error;
- });
-
- expect(allTrue).to.be.true;
- });
- });
-
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1862126a/ambari-web/test/mixins/common/configs/toggle_isrequired_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/toggle_isrequired_test.js b/ambari-web/test/mixins/common/configs/toggle_isrequired_test.js
new file mode 100644
index 0000000..c4bdd23
--- /dev/null
+++ b/ambari-web/test/mixins/common/configs/toggle_isrequired_test.js
@@ -0,0 +1,68 @@
+/**
+ * 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');
+
+describe('#_overrideConfigIsRequired', function () {
+ var controller,
+ instanceObject,
+ configs,
+ serviceConfig;
+
+ beforeEach(function() {
+ var mixinObject = Em.Controller.extend(App.ToggleIsRequiredMixin, {});
+
+ instanceObject = mixinObject.create({});
+
+ configs = Em.A([
+ App.ServiceConfigProperty.create({ name: 'kdc_host', value: '', category: 'KDC', serviceName: 'KERBEROS', isRequired: true}),
+ App.ServiceConfigProperty.create({ name: 'admin_server_host', value: '', category: 'KDC', serviceName: 'KERBEROS', isRequired: true}),
+ App.ServiceConfigProperty.create({ name: 'admin_principal', value: '', category: 'KDC', serviceName: 'KERBEROS', isRequired: true}),
+ App.ServiceConfigProperty.create({ name: 'admin_password', value: '', category: 'KDC', serviceName: 'KERBEROS', isRequired: true})
+ ]);
+
+ configs.forEach(function(config) {
+ config.validate(); // make isRequired to trigger validation and to set every property's error flag to true
+ });
+ serviceConfig = App.ServiceConfig.create({
+ 'serviceName': 'KERBEROS',
+ 'configs': configs
+ });
+
+ });
+
+ it('should make isRequired = false for kerberos properties', function () {
+ instanceObject.overrideConfigIsRequired(serviceConfig);
+ // toggle isRequired to false
+ configs.forEach(function(p) {
+ expect(p.isRequired).to.be.false;
+ expect(p.error).to.be.false;
+ });
+ });
+
+ it('should make isRequired = true for kerberos properties', function () {
+ // toggle to false
+ instanceObject.overrideConfigIsRequired(serviceConfig);
+ // toggle to true
+ instanceObject.overrideConfigIsRequired(serviceConfig);
+
+ configs.forEach(function(p) {
+ expect(p.isRequired).to.be.true;
+ });
+ });
+});
\ No newline at end of file
[2/2] ambari git commit: AMBARI-11802. Configs: dependent configs
dialog issues (alexantonenko)
Posted by al...@apache.org.
AMBARI-11802. Configs: dependent configs dialog issues (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a44784f0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a44784f0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a44784f0
Branch: refs/heads/trunk
Commit: a44784f0d0fb291987fe545c29bdb054bd9b7d4b
Parents: 721f8a3
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Jun 9 19:37:05 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Jun 9 22:59:02 2015 +0300
----------------------------------------------------------------------
ambari-web/app/messages.js | 7 ++++---
.../templates/common/modal_popups/dependent_configs_list.hbs | 4 ++--
.../common/modal_popups/dependent_configs_list_popup.js | 8 ++++++--
3 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a44784f0/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index fa3d2e5..88c716d 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -253,7 +253,7 @@ Em.I18n.translations = {
'common.stdout': "stdout",
'common.stderr': "stderr",
'common.structuredOut': "structured_out",
- 'common.fileName': 'File name',
+ 'common.fileName': 'File Name',
'common.days': "Days",
'common.hours': "Hours",
'common.minutes': "Minutes",
@@ -360,10 +360,11 @@ Em.I18n.translations = {
'popup.invalid.KDC.admin.password': 'Admin password',
'popup.dependent.configs.header': 'Dependent Configurations',
- 'popup.dependent.configs.title': 'Configurations depending on changes made are show below. It is recommended to update these values. Properties that are not selected have user supplied value different than the recommendation',
+ 'popup.dependent.configs.title': 'Based on your configuration changes, Ambari is recommending the following dependent configuration changes. <br/> Ambari will update all checked configuration changes to the <b>Recommended Value</b>. Uncheck any configuration to retain the <b>Current Value</b>.',
'popup.dependent.configs.table.saveProperty': 'Save property',
'popup.dependent.configs.table.initValue': 'Initial value',
- 'popup.dependent.configs.table.recommendedValue': 'Recommended value',
+ 'popup.dependent.configs.table.currentValue': 'Current Value',
+ 'popup.dependent.configs.table.recommendedValue': 'Recommended Value',
'popup.dependent.configs.select.config.group.header': 'Select Config Group',
'popup.dependent.configs.select.config.group': 'Please select to which config group would you like to save dependent properties',
http://git-wip-us.apache.org/repos/asf/ambari/blob/a44784f0/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs b/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
index ba3b240..b5a8220 100644
--- a/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
+++ b/ambari-web/app/templates/common/modal_popups/dependent_configs_list.hbs
@@ -23,12 +23,12 @@
<table class="table table-striped">
<thead>
<tr>
- <th class="check-box-col">{{view view.ToggleAll}}</th>
+ <th class="check-box-col">{{view view.toggleAll}}</th>
<th>{{t common.property}}</th>
<th>{{t common.service}}</th>
<th>{{t common.configGroup}}</th>
<th>{{t common.fileName}}</th>
- <th>{{t popup.dependent.configs.table.initValue}}</th>
+ <th>{{t popup.dependent.configs.table.currentValue}}</th>
<th>{{t popup.dependent.configs.table.recommendedValue}}</th>
</tr>
</thead>
http://git-wip-us.apache.org/repos/asf/ambari/blob/a44784f0/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js b/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
index 90729e6..f552abf 100644
--- a/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
+++ b/ambari-web/app/views/common/modal_popups/dependent_configs_list_popup.js
@@ -35,13 +35,17 @@ App.showDependentConfigsPopup = function (configs, primary, secondary) {
bodyClass: Em.View.extend({
templateName: require('templates/common/modal_popups/dependent_configs_list'),
- ToggleAll: Em.Checkbox.extend({
+ toggleAll: Em.Checkbox.extend({
didInsertElement: function () {
this.set('checked', !this.get('parentView.parentView.configs').someProperty('saveRecommended', false));
},
click: function () {
this.get('parentView.parentView.configs').setEach('saveRecommended', this.get('checked'));
- }
+ },
+ updateCheckbox: function () {
+ console.log('should update its status');
+ this.set('checked', !this.get('parentView.parentView.configs').someProperty('saveRecommended', false));
+ }.observes('parentView.parentView.configs.@each.saveRecommended')
})
}),
onPrimary: function () {