You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2014/11/21 16:56:00 UTC
ambari git commit: AMBARI-8412. Unable to add hosts through UI
(onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk c507a1017 -> 7da19ffd8
AMBARI-8412. Unable to add hosts through UI (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7da19ffd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7da19ffd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7da19ffd
Branch: refs/heads/trunk
Commit: 7da19ffd8594d40911738d9848d93f7ba13bfb61
Parents: c507a10
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Nov 21 17:42:27 2014 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Nov 21 17:42:27 2014 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
.../main/host/addHost/step4_controller.js | 8 ++++-
ambari-web/app/mappers/stack_service_mapper.js | 7 ++--
ambari-web/app/routes/add_host_routes.js | 14 ++++----
.../main/host/addHost/step4_controller_test.js | 36 ++++++++++++++++++++
5 files changed, 56 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7da19ffd/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 c831716..0619981 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -79,6 +79,7 @@ var files = ['test/init_model_test',
'test/controllers/main/host/add_controller_test',
'test/controllers/main/host/configs_service_test',
'test/controllers/main/host/details_test',
+ 'test/controllers/main/host/addHost/step4_controller_test',
'test/controllers/main/service/add_controller_test',
'test/controllers/main/service/manage_config_groups_controller_test',
'test/controllers/main/service/reassign_controller_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/7da19ffd/ambari-web/app/controllers/main/host/addHost/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/addHost/step4_controller.js b/ambari-web/app/controllers/main/host/addHost/step4_controller.js
index 9744458..7025a3a 100644
--- a/ambari-web/app/controllers/main/host/addHost/step4_controller.js
+++ b/ambari-web/app/controllers/main/host/addHost/step4_controller.js
@@ -27,7 +27,8 @@ App.AddHostStep4Controller= Em.Controller.extend({
App.ajax.send({
name: 'config_groups.all_fields',
sender: this,
- success: 'successLoadingConfigGroup'
+ success: 'successLoadingConfigGroup',
+ error: 'errorLoadingConfigGroup'
});
},
@@ -36,6 +37,11 @@ App.AddHostStep4Controller= Em.Controller.extend({
this.set('isConfigGroupLoaded', true);
},
+ errorLoadingConfigGroup: function(data) {
+ App.router.get('addHostController.content').set('configGroups', []);
+ this.set('isConfigGroupLoaded', true);
+ },
+
configGroupsLoading: function () {
var df = $.Deferred();
if (this.get('isConfigGroupLoaded')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/7da19ffd/ambari-web/app/mappers/stack_service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_service_mapper.js b/ambari-web/app/mappers/stack_service_mapper.js
index eab2576..43cfd86 100644
--- a/ambari-web/app/mappers/stack_service_mapper.js
+++ b/ambari-web/app/mappers/stack_service_mapper.js
@@ -76,6 +76,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({
var model = this.get('model');
var result = [];
var stackServiceComponents = [];
+ var nonInstallableServices = ['KERBEROS'];
this.rearrangeServicesForDisplayOrder(json.items, App.StackService.displayOrder);
json.items.forEach(function (item) {
var stackService = item.StackServices;
@@ -92,8 +93,10 @@ App.stackServiceMapper = App.QuickDataMapper.create({
stackService.stack_id = stackService.stack_name + '-' + stackService.stack_version;
stackService.service_components = serviceComponents;
// @todo: replace with server response value after API implementation
- stackService.is_installable = !['KERBEROS'].contains(stackService.service_name);
- stackService.is_selected = stackService.is_installable;
+ if (nonInstallableServices.contains(stackService.service_name)) {
+ stackService.is_installable = false;
+ stackService.is_selected = false;
+ }
result.push(this.parseIt(stackService, this.get('config')));
}, this);
App.store.loadMany(this.get('component_model'), stackServiceComponents);
http://git-wip-us.apache.org/repos/asf/ambari/blob/7da19ffd/ambari-web/app/routes/add_host_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_host_routes.js b/ambari-web/app/routes/add_host_routes.js
index a91b618..2abbff6 100644
--- a/ambari-web/app/routes/add_host_routes.js
+++ b/ambari-web/app/routes/add_host_routes.js
@@ -210,19 +210,19 @@ module.exports = App.WizardRoute.extend({
var controller = router.get('addHostController');
var addHostStep4Controller = router.get('addHostStep4Controller');
controller.setCurrentStep('4');
- addHostStep4Controller.loadConfigGroups();
- addHostStep4Controller.set('isConfigGroupLoaded', false);
- addHostStep4Controller.configGroupsLoading().done(function () {
- controller.dataLoading().done(function () {
+ controller.dataLoading().done(function () {
+ addHostStep4Controller.loadConfigGroups();
+ addHostStep4Controller.set('isConfigGroupLoaded', false);
+ addHostStep4Controller.configGroupsLoading().done(function () {
controller.loadAllPriorSteps();
controller.loadServiceConfigGroups();
addHostStep4Controller.set('wizardController', controller);
controller.connectOutlet('addHostStep4', controller.get('content'));
- })
- })
+ });
+ });
},
back: function(router){
- router.transitionTo('step3');
+ router.transitionTo('step3');
},
next: function (router) {
var addHostController = router.get('addHostController');
http://git-wip-us.apache.org/repos/asf/ambari/blob/7da19ffd/ambari-web/test/controllers/main/host/addHost/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/addHost/step4_controller_test.js b/ambari-web/test/controllers/main/host/addHost/step4_controller_test.js
new file mode 100644
index 0000000..7d9ffc7
--- /dev/null
+++ b/ambari-web/test/controllers/main/host/addHost/step4_controller_test.js
@@ -0,0 +1,36 @@
+/**
+ * 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.AddHostStep4Controller', function() {
+ var controller;
+
+ describe('#errorLoadingConfigGroup()', function() {
+ before(function() {
+ controller = App.AddHostStep4Controller.create({});
+ controller.errorLoadingConfigGroup();
+ });
+ it('should set config groups on failed request', function() {
+ expect(App.router.get('addHostController.content.configGroups')).to.eql([]);
+ });
+ it('should set `isConfigGroupLoaded` to true', function() {
+ expect(controller.get('isConfigGroupLoaded')).to.true;
+ });
+ });
+});