Repository: ambari Updated Branches: refs/heads/trunk d40b5214d -> 27854b4b0
AMBARI-4910. Can't restart all on a host. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/27854b4b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/27854b4b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/27854b4b Branch: refs/heads/trunk Commit: 27854b4b0481f7588bc9b974e9c17a0fb42a14dc Parents: d40b521 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Mon Mar 3 13:58:08 2014 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Mon Mar 3 13:58:08 2014 +0200 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host.js | 4 +- ambari-web/app/controllers/main/host/details.js | 11 ++++-- ambari-web/app/controllers/main/service/item.js | 2 +- ambari-web/app/messages.js | 8 ++++ .../app/utils/batch_scheduled_requests.js | 39 ++++++++++---------- 5 files changed, 38 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/27854b4b/ambari-web/app/controllers/main/host.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js index ae23214..20612ad 100644 --- a/ambari-web/app/controllers/main/host.js +++ b/ambari-web/app/controllers/main/host.js @@ -224,14 +224,14 @@ App.MainHostController = Em.ArrayController.extend({ /** * Bulk restart for selected hosts * @param {Object} operationData - data about bulk operation (action, hostComponents etc) - * @param {Array} hosts - list of affected hosts + * @param {Ember.Enumerable} hosts - list of affected hosts */ bulkOperationForHostsRestart: function(operationData, hosts) { var hostComponents = []; hosts.forEach(function(host) { hostComponents.pushObjects(host.get('hostComponents').filterProperty('passiveState','OFF').toArray()); }); - batchUtils.restartHostComponents(hostComponents); + batchUtils.restartHostComponents(hostComponents, Em.I18n.t('rollingrestart.context.allOnSelectedHosts')); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/27854b4b/ambari-web/app/controllers/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index 2504f16..74d4ec9 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -373,9 +373,10 @@ App.MainHostDetailsController = Em.Controller.extend({ }, restartComponent: function(event) { + var self = this; var component = event.context; App.showConfirmationPopup(function(){ - batchUtils.restartHostComponents([component]); + batchUtils.restartHostComponents([component], Em.I18n.t('rollingrestart.context.selectedComponentOnSelectedHost').format(component.get('componentName'), self.get('content.hostName'))); }); }, /** @@ -1031,11 +1032,12 @@ App.MainHostDetailsController = Em.Controller.extend({ }, doRestartAllComponents: function() { + var self = this; var components = this.get('content.hostComponents').filterProperty('passiveState','OFF'); var componentsLength = components == null ? 0 : components.get('length'); if (componentsLength > 0) { App.showConfirmationPopup(function() { - batchUtils.restartHostComponents(components); + batchUtils.restartHostComponents(components, Em.I18n.t('rollingrestart.context.allOnSelectedHost').format(self.get('content.hostName'))); }); } }, @@ -1212,7 +1214,7 @@ App.MainHostDetailsController = Em.Controller.extend({ restartAllStaleConfigComponents: function() { var staleComponents = this.get('content.componentsWithStaleConfigs'); - batchUtils.restartHostComponents(staleComponents); + batchUtils.restartHostComponents(staleComponents, Em.I18n.t('rollingrestart.context.allWithStaleConfigsOnSelectedHost').format(this.get('content.hostName'))); }, /** @@ -1274,12 +1276,13 @@ App.MainHostDetailsController = Em.Controller.extend({ * Restart clients host components to apply config changes */ refreshConfigs: function(event) { + var self = this; var components = event.context.filter(function(component) { return component.get('staleConfigs'); }); if (components.get('length') > 0) { App.showConfirmationPopup(function() { - batchUtils.restartHostComponents(components); + batchUtils.restartHostComponents(components, Em.I18n.t('rollingrestart.context.allClientsOnSelectedHost').format(self.get('content.hostName'))); }); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/27854b4b/ambari-web/app/controllers/main/service/item.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js index ec85194..58372cb 100644 --- a/ambari-web/app/controllers/main/service/item.js +++ b/ambari-web/app/controllers/main/service/item.js @@ -292,7 +292,7 @@ App.MainServiceItemController = Em.Controller.extend({ var self = this; if (this.get('content.isClientsOnly')) { App.showConfirmationPopup(function() { - batchUtils.restartHostComponents(self.get('content.hostComponents')); + batchUtils.restartHostComponents(self.get('content.hostComponents'), Em.I18n.t('rollingrestart.context.allForSelectedService').format(self.get('content.serviceName'))); }); } }, http://git-wip-us.apache.org/repos/asf/ambari/blob/27854b4b/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index babd3d4..6388d27 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1862,6 +1862,14 @@ Em.I18n.translations = { 'rollingrestart.dialog.err.invalid.toleratesize': 'Invalid failure toleration count: {0}', 'rollingrestart.dialog.msg.staleConfigsOnly': 'Only restart {0}s with stale configs', 'rollingrestart.rest.context': 'Rolling Restart of {0}s - batch {1} of {2}', + 'rollingrestart.context.allOnSelectedHosts':'Restart all components on the selected hosts', + 'rollingrestart.context.allForSelectedService':'Restart all components for {0}', + 'rollingrestart.context.allWithStaleConfigsForSelectedService':'Restart all components with Stale Configs for {0}', + 'rollingrestart.context.allClientsOnSelectedHost':'Restart all clients on {0}', + 'rollingrestart.context.allWithStaleConfigsOnSelectedHost':'Restart components with Stale Configs on {0}', + 'rollingrestart.context.allOnSelectedHost':'Restart all components on {0}', + 'rollingrestart.context.selectedComponentOnSelectedHost':'Restart {0} on {1}', + 'rollingrestart.context.default':'Restart components', 'rolling.command.context': 'Rolling set {0} to state "{1}" - batch {2} of {3}', 'rolling.nothingToDo.header': 'Nothing to do', http://git-wip-us.apache.org/repos/asf/ambari/blob/27854b4b/ambari-web/app/utils/batch_scheduled_requests.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/batch_scheduled_requests.js b/ambari-web/app/utils/batch_scheduled_requests.js index c87f4e8..08ec427 100644 --- a/ambari-web/app/utils/batch_scheduled_requests.js +++ b/ambari-web/app/utils/batch_scheduled_requests.js @@ -69,27 +69,29 @@ module.exports = { */ restartAllServiceHostComponents: function(serviceName, staleConfigsOnly) { var service = App.Service.find(serviceName); + var context = staleConfigsOnly ? Em.I18n.t('rollingrestart.context.allWithStaleConfigsForSelectedService').format(serviceName) : Em.I18n.t('rollingrestart.context.allForSelectedService').format(serviceName); if (service) { var hostComponents = service.get('hostComponents'); if (staleConfigsOnly) { hostComponents = hostComponents.filterProperty('staleConfigs', true); } - this.restartHostComponents(hostComponents); + this.restartHostComponents(hostComponents, context); } }, /** * Restart list of host components - * @param {*} hostComponentsList list of host components should be restarted + * @param {Ember.Enumerable} hostComponentsList list of host components should be restarted + * @param {String} context message to show in BG popup */ - restartHostComponents: function(hostComponentsList) { + restartHostComponents: function(hostComponentsList, context) { + context = context || Em.I18n.t('rollingrestart.context.default'); /** * Format: { * 'DATANODE': ['host1', 'host2'], * 'NAMENODE': ['host1', 'host3'] * ... * } - * @type {Object} */ var componentToHostsMap = {}; var componentServiceMap = App.QuickDataMapper.componentServiceMap(); @@ -110,22 +112,21 @@ module.exports = { }); } } - if (!resource_filters.length) { - return; + if (resource_filters.length) { + App.ajax.send({ + name: 'restart.hostComponents', + sender: { + successCallback: defaultSuccessCallback, + errorCallback: defaultErrorCallback + }, + data: { + context: context, + resource_filters: resource_filters + }, + success: 'successCallback', + error: 'errorCallback' + }); } - App.ajax.send({ - name: 'restart.hostComponents', - sender: { - successCallback: defaultSuccessCallback, - errorCallback: defaultErrorCallback - }, - data: { - context: 'RESTART ' + Em.keys(componentToHostsMap).map(function(componentName) {return App.format.components[componentName];}).join(', '), - resource_filters: resource_filters - }, - success: 'successCallback', - error: 'errorCallback' - }); }, /**