Просмотр исходного кода

AMBARI-4882 Bulk Ops: decommissioning a slave component on multiple hosts silently fails on UI if at least one is stopped. (ababiichuk)

aBabiichuk 11 лет назад
Родитель
Сommit
0a5c3ff27e

+ 1 - 0
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

+ 1 - 0
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',

+ 7 - 1
ambari-web/app/templates/main/host/bulk_operation_confirm_popup.hbs

@@ -32,4 +32,10 @@
       <pre>{{hostNames}}</pre>
     </div>
   </div>
-</div>
+</div>
+{{#if hostNamesSkipped}}
+  <div class="alert alert-warning">
+    {{view.warningInfo}}<br />
+      <strong>{{hostNamesSkipped}}</strong>
+  </div>
+{{/if}}

+ 17 - 0
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'));