This is an automated email from the ASF dual-hosted git repository. asnaik pushed a commit to branch branch-2.7 in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push: new 6885de4 AMBARI-25209 : Bulk Operation Refresh Configs for selected hosts (#2901) 6885de4 is described below commit 6885de49d69ba1cb6e9f85b5c75019db645d8d9c Author: Viraj Jasani <virajjasani...@gmail.com> AuthorDate: Tue Sep 24 11:44:01 2019 +0530 AMBARI-25209 : Bulk Operation Refresh Configs for selected hosts (#2901) --- .../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..34be3fc 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 8bc0888..9b8ab6e 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -2701,6 +2701,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?', @@ -3267,6 +3268,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.ClientOnSelectedHost':'Restart {0} on {1}', 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..8beeaa3 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') + }) }) ]); }