Updated Branches: refs/heads/trunk 8f2b1fe4c -> 8d534ee11
AMBARI-3532: Reassign Master: Manual command does not display customized hdfs user name. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/8d534ee1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/8d534ee1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/8d534ee1 Branch: refs/heads/trunk Commit: 8d534ee1161a20936d5fd4d0fef045323035f1b2 Parents: 8f2b1fe Author: Jaimin Jetly <[email protected]> Authored: Wed Oct 16 18:12:21 2013 -0700 Committer: Jaimin Jetly <[email protected]> Committed: Wed Oct 16 18:12:21 2013 -0700 ---------------------------------------------------------------------- .../main/service/reassign_controller.js | 2 + ambari-web/app/controllers/wizard.js | 76 ++++++++++------ ambari-web/app/messages.js | 2 +- .../app/routes/high_availability_routes.js | 1 - ambari-web/app/routes/reassign_master_routes.js | 92 +++++++++++--------- .../views/main/service/reassign/step5_view.js | 8 +- 6 files changed, 105 insertions(+), 76 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8d534ee1/ambari-web/app/controllers/main/service/reassign_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign_controller.js b/ambari-web/app/controllers/main/service/reassign_controller.js index 803c6f4..736e3b9 100644 --- a/ambari-web/app/controllers/main/service/reassign_controller.js +++ b/ambari-web/app/controllers/main/service/reassign_controller.js @@ -51,6 +51,8 @@ App.ReassignMasterController = App.WizardController.extend({ serviceConfigProperties: null, advancedServiceConfig: null, controllerName: 'reassignMasterController', + serviceName: 'MISC', + hdfsUser:"hdfs", reassign: null, hasManualSteps: false }), http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8d534ee1/ambari-web/app/controllers/wizard.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js index 72041b2..45ec81f 100644 --- a/ambari-web/app/controllers/wizard.js +++ b/ambari-web/app/controllers/wizard.js @@ -226,10 +226,10 @@ App.WizardController = Em.Controller.extend({ this.save('hosts'); }, - toObject: function(object){ + toObject: function (object) { var result = {}; - for(var i in object){ - if(object.hasOwnProperty(i)){ + for (var i in object) { + if (object.hasOwnProperty(i)) { result[i] = object[i]; } } @@ -244,7 +244,7 @@ App.WizardController = Em.Controller.extend({ var oldStatus = this.toObject(this.get('content.cluster')); clusterStatus = jQuery.extend(oldStatus, clusterStatus); if (clusterStatus.requestId && - clusterStatus.oldRequestsId.indexOf(clusterStatus.requestId) === -1){ + clusterStatus.oldRequestsId.indexOf(clusterStatus.requestId) === -1) { clusterStatus.oldRequestsId.push(clusterStatus.requestId); } this.set('content.cluster', clusterStatus); @@ -293,11 +293,11 @@ App.WizardController = Em.Controller.extend({ default: if (isRetry) { name = 'wizard.install_services.installer_controller.is_retry'; - data = '{"RequestInfo": {"context" :"'+ Em.I18n.t('requestInfo.installComponents') +'"}, "Body": {"HostRoles": {"state": "INSTALLED"}}}'; + data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installComponents') + '"}, "Body": {"HostRoles": {"state": "INSTALLED"}}}'; } else { name = 'wizard.install_services.installer_controller.not_is_retry'; - data = '{"RequestInfo": {"context" :"'+ Em.I18n.t('requestInfo.installServices') +'"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}'; + data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}'; } break; } @@ -388,7 +388,7 @@ App.WizardController = Em.Controller.extend({ return false; } var result = App.db['get' + name.capitalize()](); - if (!result){ + if (!result) { result = this['get' + name.capitalize()](); App.db['set' + name.capitalize()](result); console.log(this.get('name') + ": created " + name, result); @@ -397,7 +397,7 @@ App.WizardController = Em.Controller.extend({ console.log(this.get('name') + ": loaded " + name, result); }, - save: function(name){ + save: function (name) { var value = this.toObject(this.get('content.' + name)); App.db['set' + name.capitalize()](value); console.log(this.get('name') + ": saved " + name, value); @@ -411,7 +411,7 @@ App.WizardController = Em.Controller.extend({ this.clearStorageData(); }, - clusterStatusTemplate : { + clusterStatusTemplate: { name: "", status: "PENDING", isCompleted: false, @@ -423,7 +423,7 @@ App.WizardController = Em.Controller.extend({ oldRequestsId: [] }, - clearStorageData: function(){ + clearStorageData: function () { App.db.setService(undefined); //not to use this data at AddService page App.db.setHosts(undefined); App.db.setMasterComponentHosts(undefined); @@ -517,7 +517,7 @@ App.WizardController = Em.Controller.extend({ console.log('Step8: Error message is: ' + request.responseText); }, - loadServicesFromServer: function() { + loadServicesFromServer: function () { var services = App.db.getService(); if (services) { return; @@ -595,14 +595,14 @@ App.WizardController = Em.Controller.extend({ var headers = stepController.get('headers'); var formattedHosts = Ember.Object.create(); - headers.forEach(function(header) { + headers.forEach(function (header) { formattedHosts.set(header.get('name'), []); }); hosts.forEach(function (host) { var checkboxes = host.get('checkboxes'); - headers.forEach(function(header) { + headers.forEach(function (header) { var cb = checkboxes.findProperty('title', header.get('label')); if (cb.get('checked')) { formattedHosts.get(header.get('name')).push({ @@ -616,7 +616,7 @@ App.WizardController = Em.Controller.extend({ var slaveComponentHosts = []; - headers.forEach(function(header) { + headers.forEach(function (header) { slaveComponentHosts.push({ componentName: header.get('name'), displayName: header.get('label').replace(/\s/g, ''), @@ -633,27 +633,49 @@ App.WizardController = Em.Controller.extend({ * Return true if cluster data is loaded and false otherwise. * This is used for all wizard controllers except for installer wizard. */ - dataLoading: function(){ + dataLoading: function () { var dfd = $.Deferred(); this.connectOutlet('loading'); - if (App.router.get('clusterController.isLoaded')){ + if (App.router.get('clusterController.isLoaded')) { dfd.resolve(); - } else{ - var interval = setInterval(function(){ - if (App.router.get('clusterController.isLoaded')){ + } else { + var interval = setInterval(function () { + if (App.router.get('clusterController.isLoaded')) { dfd.resolve(); clearInterval(interval); } - },50); + }, 50); } return dfd.promise(); }, /** + * Return true if user data is loaded via App.MainServiceInfoConfigsController + * This function is used in reassign master wizard right now. + */ + + usersLoading: function () { + var self = this; + var dfd = $.Deferred(); + var miscController = App.MainAdminMiscController.create({content: self.get('content')}); + miscController.loadUsers(); + var interval = setInterval(function () { + if (miscController.get('dataIsLoaded')) { + if (self.get("content.hdfsUser")) { + self.set('content.hdfsUser', miscController.get('content.hdfsUser')); + } + dfd.resolve(); + clearInterval(interval); + } + }, 10); + return dfd.promise(); + }, + + /** * Save cluster status before going to deploy step * @param name cluster state. Unique for every wizard */ - saveClusterState: function(name){ + saveClusterState: function (name) { App.clusterStatus.setClusterStatus({ clusterName: this.get('content.cluster.name'), clusterState: name, @@ -669,7 +691,7 @@ App.WizardController = Em.Controller.extend({ var configs = (App.db.getAdvancedServiceConfig()) ? App.db.getAdvancedServiceConfig() : []; this.get('content.services').filterProperty('isSelected', true).mapProperty('serviceName').forEach(function (_serviceName) { var serviceComponents = App.config.loadAdvancedConfig(_serviceName); - if(serviceComponents){ + if (serviceComponents) { configs = configs.concat(serviceComponents); } }, this); @@ -692,20 +714,20 @@ App.WizardController = Em.Controller.extend({ var serviceConfigProperties = []; stepController.get('stepConfigs').forEach(function (_content) { - if(_content.serviceName === 'YARN' && !App.supports.capacitySchedulerUi){ + if (_content.serviceName === 'YARN' && !App.supports.capacitySchedulerUi) { _content.set('configs', App.config.textareaIntoFileConfigs(_content.get('configs'), 'capacity-scheduler.xml')); } _content.get('configs').forEach(function (_configProperties) { var overrides = _configProperties.get('overrides'); var overridesArray = []; - if(overrides!=null){ - overrides.forEach(function(override){ + if (overrides != null) { + overrides.forEach(function (override) { var overrideEntry = { value: override.get('value'), hosts: [] }; - override.get('selectedHostOptions').forEach(function(host){ + override.get('selectedHostOptions').forEach(function (host) { overrideEntry.hosts.push(host); }); overridesArray.push(overrideEntry); @@ -719,7 +741,7 @@ App.WizardController = Em.Controller.extend({ defaultValue: _configProperties.get('defaultValue'), description: _configProperties.get('description'), serviceName: _configProperties.get('serviceName'), - domain: _configProperties.get('domain'), + domain: _configProperties.get('domain'), filename: _configProperties.get('filename'), displayType: _configProperties.get('displayType'), overrides: overridesArray http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8d534ee1/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 04a4148..9a84ac0 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1109,7 +1109,7 @@ Em.I18n.translations = { 'services.reassign.step5.body.namenode_ha': '<ol>' + '<li>Login to the newly installed NameNode host <b>{2}</b></li>' + '<li>Initialize the metadata by running:' + - "<div class='code-snippet'>sudo su -l hdfs -c 'hdfs namenode -bootstrapStandby'</div></li>" + + "<div class='code-snippet'>sudo su -l {3} -c 'hdfs namenode -bootstrapStandby'</div></li>" + '<li>Proceed next' + '</ol>', 'services.reassign.step5.body.secondary_namenode': '<ol>' + http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8d534ee1/ambari-web/app/routes/high_availability_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/high_availability_routes.js b/ambari-web/app/routes/high_availability_routes.js index 4876275..42eaad0 100644 --- a/ambari-web/app/routes/high_availability_routes.js +++ b/ambari-web/app/routes/high_availability_routes.js @@ -138,7 +138,6 @@ module.exports = Em.Route.extend({ var highAvailabilityWizardStep2Controller = router.get('highAvailabilityWizardStep2Controller'); var addNN = highAvailabilityWizardStep2Controller.get('selectedServicesMasters').findProperty('isAddNameNode', true).get('selectedHost'); var sNN = highAvailabilityWizardStep2Controller.get('selectedServicesMasters').findProperty('component_name','SECONDARY_NAMENODE').get('selectedHost') - debugger; if(addNN){ App.db.setRollBackHighAvailabilityWizardAddNNHost(addNN); } http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8d534ee1/ambari-web/app/routes/reassign_master_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/reassign_master_routes.js b/ambari-web/app/routes/reassign_master_routes.js index 40659e4..9bb96ba 100644 --- a/ambari-web/app/routes/reassign_master_routes.js +++ b/ambari-web/app/routes/reassign_master_routes.js @@ -21,50 +21,50 @@ module.exports = Em.Route.extend({ enter: function (router) { console.log('in /service/reassign:enter'); - Em.run.next(function () { - var reassignMasterController = router.get('reassignMasterController'); - App.router.get('updateController').set('isWorking', false); - var hostsUrl = '/hosts?fields=Hosts/host_name,Hosts/disk_info,host_components'; - router.get('clusterController').requestHosts(hostsUrl, function () { - console.log('Request for hosts, with disk_info parameter'); - }); - var popup = App.ModalPopup.show({ - classNames: ['full-width-modal'], - header:Em.I18n.t('services.reassign.header'), - bodyClass: App.ReassignMasterView.extend({ - controller: reassignMasterController - }), - primary:Em.I18n.t('form.cancel'), - showFooter: false, - secondary: null, + Em.run.next(function () { + var reassignMasterController = router.get('reassignMasterController'); + App.router.get('updateController').set('isWorking', false); + var hostsUrl = '/hosts?fields=Hosts/host_name,Hosts/disk_info,host_components'; + router.get('clusterController').requestHosts(hostsUrl, function () { + console.log('Request for hosts, with disk_info parameter'); + }); + var popup = App.ModalPopup.show({ + classNames: ['full-width-modal'], + header: Em.I18n.t('services.reassign.header'), + bodyClass: App.ReassignMasterView.extend({ + controller: reassignMasterController + }), + primary: Em.I18n.t('form.cancel'), + showFooter: false, + secondary: null, - onPrimary:function () { - this.hide(); - App.router.get('updateController').set('isWorking', true); - App.router.transitionTo('main.services.index'); - }, - onClose: function() { - this.hide(); - App.router.get('updateController').set('isWorking', true); - App.router.transitionTo('main.services.index') - }, - didInsertElement: function(){ - this.fitHeight(); - } - }); - reassignMasterController.set('popup', popup); - App.clusterStatus.updateFromServer(); - var currentClusterStatus = App.clusterStatus.get('value'); - if (currentClusterStatus) { - switch (currentClusterStatus.clusterState) { - case 'REASSIGN_MASTER_INSTALLING' : - App.db.data = currentClusterStatus.localdb; - reassignMasterController.setCurrentStep(currentClusterStatus.localdb.ReassignMaster.currentStep); - break; - } + onPrimary: function () { + this.hide(); + App.router.get('updateController').set('isWorking', true); + App.router.transitionTo('main.services.index'); + }, + onClose: function () { + this.hide(); + App.router.get('updateController').set('isWorking', true); + App.router.transitionTo('main.services.index') + }, + didInsertElement: function () { + this.fitHeight(); } - router.transitionTo('step' + reassignMasterController.get('currentStep')); }); + reassignMasterController.set('popup', popup); + App.clusterStatus.updateFromServer(); + var currentClusterStatus = App.clusterStatus.get('value'); + if (currentClusterStatus) { + switch (currentClusterStatus.clusterState) { + case 'REASSIGN_MASTER_INSTALLING' : + App.db.data = currentClusterStatus.localdb; + reassignMasterController.setCurrentStep(currentClusterStatus.localdb.ReassignMaster.currentStep); + break; + } + } + router.transitionTo('step' + reassignMasterController.get('currentStep')); + }); }, step1: Em.Route.extend({ @@ -107,7 +107,7 @@ module.exports = Em.Route.extend({ var currentMasterHosts = App.HostComponent.find().filterProperty('componentName', componentName).mapProperty('host.hostName'); masterAssignmentsHosts.forEach(function (host) { if (!currentMasterHosts.contains(host)) { - reassignHosts.target = host; + reassignHosts.target = host; } }, this); currentMasterHosts.forEach(function (host) { @@ -199,7 +199,13 @@ module.exports = Em.Route.extend({ controller.dataLoading().done(function () { controller.loadAllPriorSteps(); controller.setLowerStepsDisable(5); - controller.connectOutlet('reassignMasterWizardStep5', controller.get('content')); + if ((controller.get('content.reassign.component_name') === 'NAMENODE') && (!App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE'))) { + controller.usersLoading().done(function () { + controller.connectOutlet('reassignMasterWizardStep5', controller.get('content')); + }) + } else { + controller.connectOutlet('reassignMasterWizardStep5', controller.get('content')); + } }) }, next: Em.Router.transitionTo('step6'), http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/8d534ee1/ambari-web/app/views/main/service/reassign/step5_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/service/reassign/step5_view.js b/ambari-web/app/views/main/service/reassign/step5_view.js index 8b0d0fe..71bcc81 100644 --- a/ambari-web/app/views/main/service/reassign/step5_view.js +++ b/ambari-web/app/views/main/service/reassign/step5_view.js @@ -21,13 +21,13 @@ var App = require('app'); App.ReassignMasterWizardStep5View = Em.View.extend({ + templateName: require('templates/main/service/reassign/step5'), + bodyText: function () { var componentDir = this.get('controller.content.componentDir'); var sourceHost = this.get('controller.content.reassignHosts.source'); var targetHost = this.get('controller.content.reassignHosts.target'); var ha = this.get('controller.content.reassign.component_name') === 'NAMENODE' && !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE') ? '_ha' : ''; - return Em.I18n.t('services.reassign.step5.body.' + this.get('controller.content.reassign.component_name').toLowerCase() + ha).format(componentDir, sourceHost, targetHost); - }.property('controller.content.reassign.component_name', 'controller.content.componentDir', 'controller.content.masterComponentHosts', 'controller.content.reassign.host_id'), - - templateName: require('templates/main/service/reassign/step5') + return Em.I18n.t('services.reassign.step5.body.' + this.get('controller.content.reassign.component_name').toLowerCase() + ha).format(componentDir, sourceHost, targetHost, this.get('controller.content.hdfsUser')); + }.property('controller.content.reassign.component_name', 'controller.content.componentDir', 'controller.content.masterComponentHosts', 'controller.content.reassign.host_id', 'controller.content.hdfsUser') });
