You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2015/04/14 13:47:03 UTC
ambari git commit: AMBARI-10462. Provide Select Hosts step for Ranger
Admin HA Wizard. (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk cc0384d1a -> 09579d107
AMBARI-10462. Provide Select Hosts step for Ranger Admin HA Wizard. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/09579d10
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/09579d10
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/09579d10
Branch: refs/heads/trunk
Commit: 09579d107f5aa1c300d6b7684c29441e536c0f23
Parents: cc0384d
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Tue Apr 14 13:57:32 2015 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue Apr 14 14:46:40 2015 +0300
----------------------------------------------------------------------
.../nameNode/wizard_controller.js | 45 -------------------
.../rangerAdmin/step2_controller.js | 17 +++++++-
.../rangerAdmin/wizard_controller.js | 39 ++++++++++++-----
.../controllers/main/service/add_controller.js | 44 -------------------
ambari-web/app/controllers/wizard.js | 46 ++++++++++++++++++++
ambari-web/app/messages.js | 1 +
.../mixins/wizard/assign_master_components.js | 31 +++++++++----
.../app/routes/ra_high_availability_routes.js | 8 +++-
.../highAvailability/rangerAdmin/step2.hbs | 21 ---------
.../highAvailability/rangerAdmin/step2_view.js | 6 ++-
10 files changed, 123 insertions(+), 135 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js
index ec6ac8b..d725bde 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/wizard_controller.js
@@ -139,51 +139,6 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
this.set('content.serviceConfigProperties', data);
},
- /**
- * load hosts from server
- */
- loadHosts: function () {
- var dfd;
- var hostsFromDb = this.getDBProperty('hosts');
- if (hostsFromDb) {
- this.set('content.hosts', hostsFromDb);
- dfd = $.Deferred();
- dfd.resolve();
- } else {
- dfd = App.ajax.send({
- name: 'hosts.high_availability.wizard',
- data: {},
- sender: this,
- success: 'loadHostsSuccessCallback',
- error: 'loadHostsErrorCallback'
- });
- }
- return dfd.promise();
- },
-
- /**
- * success callback of <code>loadHosts</code>
- * @param data
- * @param opt
- * @param params
- */
- loadHostsSuccessCallback: function (data, opt, params) {
- var hosts = {};
-
- data.items.forEach(function (item) {
- hosts[item.Hosts.host_name] = {
- name: item.Hosts.host_name,
- cpu: item.Hosts.cpu_count,
- memory: item.Hosts.total_mem,
- disk_info: item.Hosts.disk_info,
- bootStatus: "REGISTERED",
- isInstalled: true
- };
- });
- this.setDBProperty('hosts', hosts);
- this.set('content.hosts', hosts);
- },
-
loadHdfsClientHosts: function(){
var hostNames = App.db.getHighAvailabilityWizardHdfsClientHosts();
if (!(hostNames instanceof Array)) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step2_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step2_controller.js
index 9a13839..6911853 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step2_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step2_controller.js
@@ -18,7 +18,20 @@
var App = require('app');
-App.RAHighAvailabilityWizardStep2Controller = Em.Controller.extend({
- name: "rAHighAvailabilityWizardStep2Controller"
+App.RAHighAvailabilityWizardStep2Controller = Em.Controller.extend(App.BlueprintMixin, App.AssignMasterComponents, {
+ name: "rAHighAvailabilityWizardStep2Controller",
+
+ useServerValidation: false,
+
+ mastersToShow: ['RANGER_ADMIN'],
+
+ mastersToAdd: ['RANGER_ADMIN'],
+
+ showCurrentPrefix: ['RANGER_ADMIN'],
+
+ showAdditionalPrefix: ['RANGER_ADMIN'],
+
+ mastersAddableInHA: ['RANGER_ADMIN']
+
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js
index cd60f22..ebfb2ee 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/wizard_controller.js
@@ -28,7 +28,11 @@ App.RAHighAvailabilityWizardController = App.WizardController.extend({
isFinished: false,
content: Em.Object.create({
- controllerName: 'rAHighAvailabilityWizardController'
+ controllerName: 'rAHighAvailabilityWizardController',
+ cluster: null,
+ hosts: null,
+ services: null,
+ masterComponentHosts: null
}),
init: function () {
@@ -49,15 +53,30 @@ App.RAHighAvailabilityWizardController = App.WizardController.extend({
});
},
- /**
- * Load data for all steps until <code>current step</code>
- */
- loadAllPriorSteps: function () {
- var step = this.get('currentStep');
- switch (step) {
- case '1':
- this.load('cluster');
- }
+ loadMap: {
+ '1': [
+ {
+ type: 'sync',
+ callback: function () {
+ this.load('cluster');
+ }
+ }
+ ],
+ '2': [
+ {
+ type: 'async',
+ callback: function () {
+ var dfd = $.Deferred();
+ var self = this;
+ this.loadHosts().done(function () {
+ self.loadServicesFromServer();
+ self.loadMasterComponentHosts();
+ dfd.resolve();
+ });
+ return dfd.promise();
+ }
+ }
+ ]
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index d3d3a37..b2b9d06 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -155,50 +155,6 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
});
},
- loadHosts: function () {
- var dfd;
- if (this.getDBProperty('hosts')) {
- dfd = $.Deferred();
- dfd.resolve();
- } else {
- dfd = App.ajax.send({
- name: 'hosts.confirmed',
- sender: this,
- data: {},
- success: 'loadHostsSuccessCallback',
- error: 'loadHostsErrorCallback'
- });
- }
- return dfd.promise();
- },
-
- loadHostsSuccessCallback: function (response) {
- var installedHosts = {};
-
- response.items.forEach(function (item, indx) {
- installedHosts[item.Hosts.host_name] = {
- name: item.Hosts.host_name,
- cpu: item.Hosts.cpu_count,
- memory: item.Hosts.total_mem,
- disk_info: item.Hosts.disk_info,
- osType: item.Hosts.os_type,
- osArch: item.Hosts.os_arch,
- ip: item.Hosts.ip,
- bootStatus: "REGISTERED",
- isInstalled: true,
- hostComponents: item.host_components,
- id: indx++
- };
- });
- this.setDBProperty('hosts', installedHosts);
- this.set('content.hosts', installedHosts);
- },
-
- loadHostsErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
- App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
- console.log('Loading hosts failed');
- },
-
/**
* Load services data. Will be used at <code>Select services(step4)</code> step
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index 0c54fa2..d1148a9 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -1139,6 +1139,52 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
}
},
+ loadHosts: function () {
+ var dfd;
+ var hostsInDb = this.getDBProperty('hosts');
+ if (hostsInDb) {
+ this.set('content.hosts', hostsInDb);
+ dfd = $.Deferred();
+ dfd.resolve();
+ } else {
+ dfd = App.ajax.send({
+ name: 'hosts.confirmed',
+ sender: this,
+ data: {},
+ success: 'loadHostsSuccessCallback',
+ error: 'loadHostsErrorCallback'
+ });
+ }
+ return dfd.promise();
+ },
+
+ loadHostsSuccessCallback: function (response) {
+ var installedHosts = {};
+
+ response.items.forEach(function (item, indx) {
+ installedHosts[item.Hosts.host_name] = {
+ name: item.Hosts.host_name,
+ cpu: item.Hosts.cpu_count,
+ memory: item.Hosts.total_mem,
+ disk_info: item.Hosts.disk_info,
+ osType: item.Hosts.os_type,
+ osArch: item.Hosts.os_arch,
+ ip: item.Hosts.ip,
+ bootStatus: "REGISTERED",
+ isInstalled: true,
+ hostComponents: item.host_components,
+ id: indx++
+ };
+ });
+ this.setDBProperty('hosts', installedHosts);
+ this.set('content.hosts', installedHosts);
+ },
+
+ loadHostsErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
+ App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
+ console.log('Loading hosts failed');
+ },
+
/**
* Determine if <code>Assign Slaves and Clients</code> step should be skipped
* @method setSkipSlavesStep
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 2f56637..39117b7 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1217,6 +1217,7 @@ Em.I18n.translations = {
'admin.ra_highAvailability.wizard.header': 'Enable Ranger Admin HA Wizard',
'admin.ra_highAvailability.wizard.step1.header': 'Get Started',
'admin.ra_highAvailability.wizard.step2.header': 'Select Hosts',
+ 'admin.ra_highAvailability.wizard.step2.body': 'Select a host or hosts that will be running the additional Ranger Admin components',
'admin.ra_highAvailability.wizard.step3.header': 'Review',
'admin.ra_highAvailability.wizard.step4.header': 'Install, Start and Test',
'admin.ra_highAvailability.closePopup':'Enable Ranger Admin HA Wizard is in progress. You must allow the wizard to complete for Ambari to be in usable state. ' +
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/mixins/wizard/assign_master_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/assign_master_components.js b/ambari-web/app/mixins/wizard/assign_master_components.js
index 67ed536..796e3b1 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -49,6 +49,13 @@ App.AssignMasterComponents = Em.Mixin.create({
mastersToMove: [],
/**
+ * Array of master component names, that should be addable
+ * Are used in HA wizards to add components, that are not addable for other wizards
+ * @type {Array}
+ */
+ mastersAddableInHA: [],
+
+ /**
* Array of master component names to show 'Current' prefix in label before component name
* Prefix will be shown only for installed instances
* @type {Array}
@@ -121,8 +128,8 @@ App.AssignMasterComponents = Em.Mixin.create({
* @type {string[]}
*/
addableComponents: function () {
- return App.get('components.addableMasterInstallerWizard');
- }.property('App.components.addableMasterInstallerWizard'),
+ return App.get('components.addableMasterInstallerWizard').concat(this.get('mastersAddableInHA')).uniq();
+ }.property('App.components.addableMasterInstallerWizard', 'mastersAddableInHA'),
/**
* Define state for submit button
@@ -501,7 +508,8 @@ App.AssignMasterComponents = Em.Mixin.create({
return;
}
- var showControl = !App.StackServiceComponent.find().findProperty('componentName', componentName).get('stackService').get('isInstalled');
+ var showControl = !App.StackServiceComponent.find().findProperty('componentName', componentName).get('stackService').get('isInstalled')
+ || this.get('mastersAddableInHA').contains(componentName);
if (showControl) {
var mastersLength = this.get("selectedServicesMasters").filterProperty("component_name", componentName).length;
@@ -623,7 +631,6 @@ App.AssignMasterComponents = Em.Mixin.create({
if (self.get('isInstallerWizard')) {
masterComponents = App.StackServiceComponent.find().filterProperty('isShownOnInstallerAssignMasterPage');
} else {
- masterComponents = App.StackServiceComponent.find().filterProperty('isShownOnAddServiceAssignMasterPage');
masterComponents = App.StackServiceComponent.find().filter(function(component){
return component.get('isShownOnAddServiceAssignMasterPage') || self.get('mastersToShow').contains(component.get('componentName'));
});
@@ -739,9 +746,10 @@ App.AssignMasterComponents = Em.Mixin.create({
masterComponents.forEach(function (item) {
var masterComponent = App.StackServiceComponent.find().findProperty('componentName', item.component_name);
var componentObj = Em.Object.create(item);
+ var showRemoveControl;
console.log("TRACE: render master component name is: " + item.component_name);
if (masterComponent.get('isMasterWithMultipleInstances')) {
- var showRemoveControl = installedServices.contains(masterComponent.get('stackService.serviceName')) &&
+ showRemoveControl = installedServices.contains(masterComponent.get('stackService.serviceName')) &&
(masterComponents.filterProperty('component_name', item.component_name).length > 1);
previousComponentName = item.component_name;
componentObj.set('serviceComponentId', result.filterProperty('component_name', item.component_name).length + 1);
@@ -844,9 +852,11 @@ App.AssignMasterComponents = Em.Mixin.create({
*/
assignHostToMaster: function (componentName, selectedHost, serviceComponentId) {
var flag = this.isHostNameValid(componentName, selectedHost);
+ var component;
this.updateIsHostNameValidFlag(componentName, serviceComponentId, flag);
if (serviceComponentId) {
- this.get('selectedServicesMasters').filterProperty('component_name', componentName).findProperty("serviceComponentId", serviceComponentId).set("selectedHost", selectedHost);
+ component = this.get('selectedServicesMasters').filterProperty('component_name', componentName).findProperty("serviceComponentId", serviceComponentId);
+ if (component) component.set("selectedHost", selectedHost);
}
else {
this.get('selectedServicesMasters').findProperty("component_name", componentName).set("selectedHost", selectedHost);
@@ -886,9 +896,11 @@ App.AssignMasterComponents = Em.Mixin.create({
* @method updateIsHostNameValidFlag
*/
updateIsHostNameValidFlag: function (componentName, serviceComponentId, flag) {
+ var component;
if (componentName) {
if (serviceComponentId) {
- this.get('selectedServicesMasters').filterProperty('component_name', componentName).findProperty("serviceComponentId", serviceComponentId).set("isHostNameValid", flag);
+ component = this.get('selectedServicesMasters').filterProperty('component_name', componentName).findProperty("serviceComponentId", serviceComponentId);
+ if (component) component.set("isHostNameValid", flag);
} else {
this.get('selectedServicesMasters').findProperty("component_name", componentName).set("isHostNameValid", flag);
}
@@ -944,6 +956,7 @@ App.AssignMasterComponents = Em.Mixin.create({
newMaster.set("selectedHost", lastMaster.get("selectedHost"));
newMaster.set("serviceId", lastMaster.get("serviceId"));
newMaster.set("isInstalled", false);
+ newMaster.set('showAdditionalPrefix', this.get('showAdditionalPrefix').contains(lastMaster.get("component_name")));
if (currentMasters.get("length") === (maxNumMasters - 1)) {
newMaster.set("showAddControl", false);
@@ -997,7 +1010,7 @@ App.AssignMasterComponents = Em.Mixin.create({
currentMasters.set("lastObject.showAddControl", true);
}
- if (currentMasters.get("length") === 1) {
+ if (currentMasters.filterProperty('isInstalled', false).get("length") === 1) {
currentMasters.set("lastObject.showRemoveControl", false);
}
@@ -1012,7 +1025,7 @@ App.AssignMasterComponents = Em.Mixin.create({
// load recommendations with partial request
self.loadComponentsRecommendationsFromServer(function() {
- // For validation use latest received recommendations because ir contains current master layout and recommended slave/client layout
+ // For validation use latest received recommendations because it contains current master layout and recommended slave/client layout
self.validate(self.get('content.recommendations'), function() {
if (callback) {
callback();
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/routes/ra_high_availability_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/ra_high_availability_routes.js b/ambari-web/app/routes/ra_high_availability_routes.js
index 074436b..3c076fe 100644
--- a/ambari-web/app/routes/ra_high_availability_routes.js
+++ b/ambari-web/app/routes/ra_high_availability_routes.js
@@ -103,7 +103,9 @@ module.exports = App.WizardRoute.extend({
var controller = router.get('rAHighAvailabilityWizardController');
controller.setCurrentStep('1');
controller.dataLoading().done(function () {
- controller.connectOutlet('rAHighAvailabilityWizardStep1', controller.get('content'));
+ controller.loadAllPriorSteps().done(function(){
+ controller.connectOutlet('rAHighAvailabilityWizardStep1', controller.get('content'));
+ });
})
},
next: function (router) {
@@ -117,7 +119,9 @@ module.exports = App.WizardRoute.extend({
var controller = router.get('rAHighAvailabilityWizardController');
controller.setCurrentStep('2');
controller.dataLoading().done(function () {
- controller.connectOutlet('rAHighAvailabilityWizardStep2', controller.get('content'));
+ controller.loadAllPriorSteps().done(function(){
+ controller.connectOutlet('rAHighAvailabilityWizardStep2', controller.get('content'));
+ });
})
},
next: function (router) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/templates/main/admin/highAvailability/rangerAdmin/step2.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/rangerAdmin/step2.hbs b/ambari-web/app/templates/main/admin/highAvailability/rangerAdmin/step2.hbs
deleted file mode 100644
index 1ba7cc5..0000000
--- a/ambari-web/app/templates/main/admin/highAvailability/rangerAdmin/step2.hbs
+++ /dev/null
@@ -1,21 +0,0 @@
-{{!
-* 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.
-}}
-<div class="btn-area">
- <a class="btn" {{action back}}>← {{t common.back}}</a>
- <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} →</a>
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/09579d10/ambari-web/app/views/main/admin/highAvailability/rangerAdmin/step2_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/rangerAdmin/step2_view.js b/ambari-web/app/views/main/admin/highAvailability/rangerAdmin/step2_view.js
index 3202938..b06435b 100644
--- a/ambari-web/app/views/main/admin/highAvailability/rangerAdmin/step2_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/rangerAdmin/step2_view.js
@@ -19,8 +19,10 @@
var App = require('app');
-App.RAHighAvailabilityWizardStep2View = Em.View.extend({
+App.RAHighAvailabilityWizardStep2View = App.AssignMasterComponentsView.extend({
- templateName: require('templates/main/admin/highAvailability/rangerAdmin/step2')
+ title: Em.I18n.t('admin.ra_highAvailability.wizard.step2.header'),
+
+ alertMessage: Em.I18n.t('admin.ra_highAvailability.wizard.step2.body')
});