Bläddra i källkod

AMBARI-7369. Clients in INIT or INSTALL FAILED state should have an menu action for installation (Denys Buzhor via alexantonenko)

Alex Antonenko 10 år sedan
förälder
incheckning
1f4d315ce2

+ 8 - 1
ambari-web/app/controllers/main/host/details.js

@@ -1592,6 +1592,13 @@ App.MainHostDetailsController = Em.Controller.extend({
       componentName: event.context.get('componentName'),
       displayName: event.context.get('displayName')
     });
-  }
+  },
 
+  reinstallClients: function(event) {
+    var clientsToInstall = event.context.filter(function(component) {
+      return ['INIT', 'INSTALL_FAILED'].contains(component.get('workStatus'));
+    });
+    if (!clientsToInstall.length) return;
+    this.sendComponentCommand(clientsToInstall, Em.I18n.t('host.host.details.installClients'), 'INSTALLED');
+  }
 });

+ 1 - 0
ambari-web/app/messages.js

@@ -1695,6 +1695,7 @@ Em.I18n.translations = {
   'hosts.host.details.restartAllComponents':'Restart All Components',
   'hosts.host.details.refreshConfigs':'Refresh configs',
   'hosts.host.details.for.postfix':'{0} for host',
+  'host.host.details.installClients': 'Install clients',
 
   'host.host.componentFilter.master':'Master Components',
   'host.host.componentFilter.slave':'Slave Components',

+ 8 - 0
ambari-web/app/templates/main/host/summary.hbs

@@ -72,6 +72,9 @@
                   <div class="span7">
                     {{#each component in view.clients}}
                       {{component.displayName}}
+                      {{#if component.isInstallFailed}}
+                        <span class="health-status-installed icon-warning-sign"></span>
+                      {{/if}}
                       {{#if component.staleConfigs}}
                         <span class="text-warning icon-refresh"></span>
                       {{/if}}
@@ -97,6 +100,11 @@
                           {{t hosts.host.details.refreshConfigs}}
                         </a>
                       </li>
+                      <li>
+                        <a href="javscript:void(null)" {{bindAttr class="view.areClientsInstallFailed::disabled" }} data-toggle="modal" {{action reinstallClients view.clients target="controller"}}>
+                          {{t host.host.details.installClients}}
+                        </a>
+                      </li>
                     </ul>
                   </div>
                 {{/if}}

+ 11 - 0
ambari-web/app/views/main/host/summary.js

@@ -182,11 +182,22 @@ App.MainHostSummaryView = Em.View.extend({
           clients[clients.length - 1].set('isLast', false);
         }
         component.set('isLast', true);
+        if (['INSTALL_FAILED', 'INIT'].contains(component.get('workStatus'))) {
+          component.set('isInstallFailed', true);
+        }
         clients.push(component);
       }
     }, this);
     return clients;
   }.property('content.hostComponents.length'),
+  /**
+   * Check if some clients not installed or started
+   *
+   * @type {bool}
+   **/
+  areClientsInstallFailed: function() {
+    return this.get('clients').someProperty('isInstallFailed', true);
+  }.property('clients.@each.workStatus'),
 
   /**
    * Check if some clients have stale configs