This is an automated email from the ASF dual-hosted git repository.

asnaik pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 076279c  AMBARI-25209 : Bulk Operation Refresh Configs for selected 
hosts (#2891)
076279c is described below

commit 076279cc91d7b2851c67ac6b8979e4eda4e28fc4
Author: Viraj Jasani <34790606+virajjas...@users.noreply.github.com>
AuthorDate: Wed Jun 19 13:11:58 2019 +0530

    AMBARI-25209 : Bulk Operation Refresh Configs for selected hosts (#2891)
---
 .../main/host/bulk_operations_controller.js        | 38 ++++++++++++++++++++++
 ambari-web/app/messages.js                         |  2 ++
 .../app/views/main/host/hosts_table_menu_view.js   |  7 ++++
 3 files changed, 47 insertions(+)

diff --git a/ambari-web/app/controllers/main/host/bulk_operations_controller.js 
b/ambari-web/app/controllers/main/host/bulk_operations_controller.js
index 219f594..1f5d02e 100644
--- a/ambari-web/app/controllers/main/host/bulk_operations_controller.js
+++ b/ambari-web/app/controllers/main/host/bulk_operations_controller.js
@@ -67,6 +67,9 @@ App.BulkOperationsController = Em.Controller.extend({
         else if (operationData.action === 'DELETE'){
           this._bulkOperationForHostsDelete(hosts);
         }
+        else if (operationData.action === 'CONFIGURE') {
+            this.bulkOperationForHostsRefreshConfig(operationData, hosts);
+        }
         else {
           if (operationData.action === 'PASSIVE_STATE') {
             this.bulkOperationForHostsPassiveState(operationData, hosts);
@@ -318,6 +321,41 @@ App.BulkOperationsController = Em.Controller.extend({
   },
 
   /**
+   * Bulk refresh configs for selected hosts
+   * @param {Object} operationData - data about bulk operation (action, 
hostComponents etc)
+   * @param {Ember.Enumerable} hosts - list of affected/selected hosts
+   */
+  bulkOperationForHostsRefreshConfig: function (operationData, hosts) {
+    return batchUtils.getComponentsFromServer({
+      passiveState: 'OFF',
+      hosts: hosts.mapProperty('hostName'),
+      displayParams: ['host_components/HostRoles/component_name']
+    }, this._getComponentsFromServerForRefreshConfigsCallback);
+  },
+
+  /**
+   *
+   * @param {object} data
+   * @private
+   * @method _getComponentsFromServerForRefreshConfigsCallback
+   */
+  _getComponentsFromServerForRefreshConfigsCallback: function (data) {
+    var hostComponents = [];
+    var clients = App.components.get('clients');
+    data.items.forEach(function (host) {
+      host.host_components.forEach(function (hostComponent) {
+        if (clients.contains((hostComponent.HostRoles.component_name))) {
+          hostComponents.push(O.create({
+            componentName: hostComponent.HostRoles.component_name,
+            hostName: host.Hosts.host_name
+          }));
+        }
+      })
+    });
+    batchUtils.restartHostComponents(hostComponents, 
Em.I18n.t('rollingrestart.context.configs.allOnSelectedHosts'), "HOST");
+  },
+
+  /**
    * Bulk delete selected hosts
    * @param {String} hosts - list of affected host names
    */
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 813dbad..cc8e159 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2715,6 +2715,7 @@ Em.I18n.translations = {
   'hosts.table.menu.l2.allComponents':'All Components',
   'hosts.table.menu.l2.restartAllComponents':'Restart All Components',
   'hosts.table.menu.l2.reinstallFailedComponents':'Reinstall Failed 
Components',
+  'hosts.table.menu.l2.refreshConfigsClientComponents':'Refresh All Configs',
 
   'hosts.bulkOperation.confirmation.header':'Confirm Bulk Operation',
   'hosts.bulkOperation.confirmation.hosts':'Are you sure you want to 
<strong>{0}</strong> on the following {1} hosts?',
@@ -3283,6 +3284,7 @@ Em.I18n.translations = {
   'rollingrestart.dialog.msg.staleConfigsOnly': 'Only restart {0} 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.configs.allOnSelectedHosts':'Refresh all configs 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}',
diff --git a/ambari-web/app/views/main/host/hosts_table_menu_view.js 
b/ambari-web/app/views/main/host/hosts_table_menu_view.js
index 08fd0d4..93724d9 100644
--- a/ambari-web/app/views/main/host/hosts_table_menu_view.js
+++ b/ambari-web/app/views/main/host/hosts_table_menu_view.js
@@ -288,6 +288,13 @@ App.HostTableMenuView = Em.View.extend({
               action: 'REINSTALL',
               message: 
Em.I18n.t('hosts.table.menu.l2.reinstallFailedComponents')
             })
+          }),
+          O.create({
+            label: 
Em.I18n.t('hosts.table.menu.l2.refreshConfigsClientComponents'),
+            operationData: O.create({
+                action: 'CONFIGURE',
+                message: 
Em.I18n.t('hosts.table.menu.l2.refreshConfigsClientComponents')
+            })
           })
         ]);
       }

Reply via email to