Repository: ambari Updated Branches: refs/heads/trunk d27801701 -> 0a5c3ff27
AMBARI-4882 Bulk Ops: decommissioning a slave component on multiple hosts silently fails on UI if at least one is stopped. (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0a5c3ff2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0a5c3ff2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0a5c3ff2 Branch: refs/heads/trunk Commit: 0a5c3ff27ee5b3c5cefe5cb11b703d91cc16507e Parents: d278017 Author: aBabiichuk <[email protected]> Authored: Fri Feb 28 16:11:17 2014 +0200 Committer: aBabiichuk <[email protected]> Committed: Fri Feb 28 16:11:17 2014 +0200 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host.js | 1 + ambari-web/app/messages.js | 1 + .../main/host/bulk_operation_confirm_popup.hbs | 8 +++++++- ambari-web/app/views/main/host.js | 17 +++++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0a5c3ff2/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 8f8aa80..ae23214 100644 --- a/ambari-web/app/controllers/main/host.js +++ b/ambari-web/app/controllers/main/host.js @@ -342,6 +342,7 @@ App.MainHostController = Em.ArrayController.extend({ App.router.get('mainHostDetailsController').doRecommissionAndRestart(hostNames, svcName, masterName, slaveName); } } else { + hostsWithComponentInProperState = components.filterProperty('workStatus','STARTED').mapProperty('host.hostName'); //For decommession if (svcName == "HBASE") { // HBASE service, decommission RegionServer in batch requests http://git-wip-us.apache.org/repos/asf/ambari/blob/0a5c3ff2/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index d1b0872..babd3d4 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1392,6 +1392,7 @@ Em.I18n.translations = { 'hosts.bulkOperation.confirmation.hosts':'Are you sure you want to <strong>{0}</strong> on the following {1} hosts?', 'hosts.bulkOperation.confirmation.hostComponents':'Are you sure you want to <strong>{0} {1}</strong> on the following {2} hosts?', 'hosts.bulkOperation.passiveState.nothingToDo.body':'All hosts that you selected are already in Maintenance Mode.', + 'hosts.bulkOperation.warningInfo.body':'Components on these hosts are stopped so decommission will be skipped.', 'hosts.bulkOperation.host_components.passiveState.nothingToDo.body':'All host components that you selected are already in Maintenance Mode', 'hosts.selectHostsDialog.title': 'Select Configuration Group Hosts', http://git-wip-us.apache.org/repos/asf/ambari/blob/0a5c3ff2/ambari-web/app/templates/main/host/bulk_operation_confirm_popup.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/host/bulk_operation_confirm_popup.hbs b/ambari-web/app/templates/main/host/bulk_operation_confirm_popup.hbs index e3676f4..6b8cc55 100644 --- a/ambari-web/app/templates/main/host/bulk_operation_confirm_popup.hbs +++ b/ambari-web/app/templates/main/host/bulk_operation_confirm_popup.hbs @@ -32,4 +32,10 @@ <pre>{{hostNames}}</pre> </div> </div> -</div> \ No newline at end of file +</div> +{{#if hostNamesSkipped}} + <div class="alert alert-warning"> + {{view.warningInfo}}<br /> + <strong>{{hostNamesSkipped}}</strong> + </div> +{{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/0a5c3ff2/ambari-web/app/views/main/host.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js index 40d49fe..d1bc1e8 100644 --- a/ambari-web/app/views/main/host.js +++ b/ambari-web/app/views/main/host.js @@ -131,6 +131,16 @@ App.MainHostView = App.TableView.extend({ return; } var hostNames = hosts.mapProperty('hostName'); + var hostsToSkip = []; + if (operationData.action == "DECOMMISSION") { + hostsToSkip = hosts.filter(function(host) { + var invalidStateComponents = host.get('hostComponents').filter(function(component) { + return component.get('componentName') == operationData.realComponentName && component.get('workStatus') == 'INSTALLED'; + }); + return invalidStateComponents.length > 0; + }); + } + var hostNamesSkipped = hostsToSkip.mapProperty('hostName'); var message; if (operationData.componentNameFormatted) { message = Em.I18n.t('hosts.bulkOperation.confirmation.hostComponents').format(operationData.message, operationData.componentNameFormatted, hostNames.length); @@ -141,6 +151,12 @@ App.MainHostView = App.TableView.extend({ App.ModalPopup.show({ header: Em.I18n.t('hosts.bulkOperation.confirmation.header'), hostNames: hostNames.join("\n"), + hostNamesSkipped: function() { + if (hostNamesSkipped.length) { + return hostNamesSkipped.join("<br/>"); + } + return false; + }.property(), onPrimary: function() { self.get('controller').bulkOperation(operationData, hosts); this._super(); @@ -148,6 +164,7 @@ App.MainHostView = App.TableView.extend({ bodyClass: Em.View.extend({ templateName: require('templates/main/host/bulk_operation_confirm_popup'), message: message, + warningInfo: Em.I18n.t('hosts.bulkOperation.warningInfo.body'), textareaVisible: false, textTrigger: function() { this.set('textareaVisible', !this.get('textareaVisible'));
