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 2014/12/10 19:06:33 UTC
ambari git commit: AMBARI-8634. Kerberos wizard->Configure Identities
page: Invalidated properties should show error count and disable next button
(alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk b60f26ee9 -> da44fafcc
AMBARI-8634. Kerberos wizard->Configure Identities page: Invalidated properties should show error count and disable next button (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/da44fafc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/da44fafc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/da44fafc
Branch: refs/heads/trunk
Commit: da44fafcc965df016a01746147bd466d226a76c8
Parents: b60f26e
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Dec 10 16:23:03 2014 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Dec 10 20:06:09 2014 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
.../main/admin/kerberos/step4_controller.js | 15 +++---
.../main/admin/kerberos/wizard_controller.js | 1 +
.../app/templates/main/admin/kerberos/step4.hbs | 4 +-
.../admin/kerberos/step4_controller_test.js | 53 ++++++++++++++++++++
5 files changed, 66 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/da44fafc/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 c39af70..8615b35 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -51,6 +51,7 @@ var files = ['test/init_model_test',
'test/controllers/main/alerts/alert_instances_controller_test',
'test/controllers/main/alerts/add_alert_definition/step1_controller_test',
'test/controllers/main/alerts/manage_alert_notifications_controller_test',
+ 'test/controllers/main/admin/kerberos/step4_controller_test',
'test/controllers/main/admin/stack_and_upgrade_controller_test',
'test/controllers/main/admin/stack_version/stack_version_details_controller_test',
'test/controllers/main/admin/stack_version/repo_versions_controller_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/da44fafc/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 c612ca4..b16445b 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
@@ -16,11 +16,8 @@
* limitations under the License.
*/
-App.KerberosWizardStep4Controller = Em.Controller.extend(App.AddSecurityConfigs, {
+App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecurityConfigs, {
name: 'kerberosWizardStep4Controller',
- stepConfigs: [],
- selectedService: null,
- isRecommendedLoaded: false,
clearStep: function() {
this.set('isRecommendedLoaded', false);
@@ -45,7 +42,7 @@ App.KerberosWizardStep4Controller = Em.Controller.extend(App.AddSecurityConfigs,
* @returns {Em.Object}
*/
createServiceConfig: function(configCategories, configs) {
- return Em.Object.create({
+ return App.ServiceConfig.create({
displayName: 'Kerberos Descriptor',
name: 'KERBEROS',
serviceName: 'KERBEROS',
@@ -107,7 +104,13 @@ App.KerberosWizardStep4Controller = Em.Controller.extend(App.AddSecurityConfigs,
},
submit: function() {
+ this.saveConfigurations();
App.router.send('next');
- }
+ },
+ saveConfigurations: function() {
+ var configs = this.get('stepConfigs')[0].get('configs');
+ this.get('wizardController').setDBProperty('kerberosDescriptorConfigs', configs);
+ this.set('wizardController.content.kerberosDescriptorConfigs', configs);
+ }
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/da44fafc/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 fd8e119..a6505c7 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
@@ -41,6 +41,7 @@ App.KerberosWizardController = App.WizardController.extend({
services: null,
advancedServiceConfig: null,
serviceConfigProperties: [],
+ kerberosDescriptorConfigs: null,
failedTask: null
}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/da44fafc/ambari-web/app/templates/main/admin/kerberos/step4.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/kerberos/step4.hbs b/ambari-web/app/templates/main/admin/kerberos/step4.hbs
index e5c7bdb..1039b61 100644
--- a/ambari-web/app/templates/main/admin/kerberos/step4.hbs
+++ b/ambari-web/app/templates/main/admin/kerberos/step4.hbs
@@ -24,7 +24,7 @@
{{view App.ServicesConfigView}}
<div class="btn-area">
- <a id="submit-kerberos-step4" class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
- {{action submit target="controller"}}>{{t common.next}} →</a>
+ <button id="submit-kerberos-step4" class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
+ {{action submit target="controller"}}>{{t common.next}} →</button>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/da44fafc/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
new file mode 100644
index 0000000..4bced94
--- /dev/null
+++ b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
@@ -0,0 +1,53 @@
+/**
+ * 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('App.KerberosWizardStep4Controller', function() {
+
+ describe('#isSubmitDisabled', function() {
+ var controller = App.KerberosWizardStep4Controller.create({});
+ var configCategories = Em.A([
+ App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'})
+ ]);
+ var configs = Em.A([
+ App.ServiceConfigProperty.create({ name: 'prop1', value: 'someVal1', category: 'Advanced'})
+ ]);
+ controller.set('stepConfigs', [controller.createServiceConfig(configCategories, configs)]);
+
+ it('configuration errors are absent, submit should be not disabled', function() {
+ expect(controller.get('stepConfigs')[0].get('errorCount')).to.be.eql(0);
+ expect(controller.get('isSubmitDisabled')).to.be.false;
+ });
+
+ it('config has invalid value, submit should be disabled', function() {
+ var serviceConfig = controller.get('stepConfigs')[0];
+ serviceConfig.get('configs').findProperty('name', 'prop1').set('value', '');
+ expect(serviceConfig.get('errorCount')).to.be.eql(1);
+ expect(controller.get('isSubmitDisabled')).to.be.true;
+ });
+ });
+
+ describe('#createServiceConfig', function() {
+ var controller = App.KerberosWizardStep4Controller.create({});
+ it('should create instance of App.ServiceConfig', function() {
+ expect(controller.createServiceConfig([], [])).be.instanceof(App.ServiceConfig);
+ });
+ });
+});
+