AMBARI-21388. Can't delete hosts components via bulk-menu (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7029e7fa Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7029e7fa Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7029e7fa Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 7029e7fa0c3e2ebd8e6eea7eef1f965234018586 Parents: ac5eaae Author: Alex Antonenko <hiv...@gmail.com> Authored: Mon Jul 3 15:35:28 2017 +0300 Committer: Alex Antonenko <hiv...@gmail.com> Committed: Fri Jul 7 10:38:45 2017 +0300 ---------------------------------------------------------------------- .../main/host/bulk_operations_controller.js | 15 +++++++-------- ambari-web/app/messages.js | 4 ++-- .../main/host/delete_hosts_result_popup.hbs | 8 ++++++-- 3 files changed, 15 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7029e7fa/ambari-web/app/controllers/main/host/bulk_operations_controller.js ---------------------------------------------------------------------- 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 b921cd5..34d61d8 100644 --- a/ambari-web/app/controllers/main/host/bulk_operations_controller.js +++ b/ambari-web/app/controllers/main/host/bulk_operations_controller.js @@ -717,6 +717,7 @@ App.BulkOperationsController = Em.Controller.extend({ didInsertElement: function() { this.set('expanded', hostsToDelete.length <= minShown); + this._super(); }, onPrimary: function() { @@ -763,6 +764,8 @@ App.BulkOperationsController = Em.Controller.extend({ name: 'host.host_component.delete_components', sender: self, data: { + hostNames, + componentName: operationData.componentName, data: JSON.stringify({ RequestInfo: { query: 'HostRoles/host_name.in(' + hostNames.join(',') + ')&HostRoles/component_name.in(' + operationData.componentName + ')' @@ -783,7 +786,7 @@ App.BulkOperationsController = Em.Controller.extend({ var undeletableHosts = []; if (arg1 == "error") { var request = arg0; - var params = arg4; + let params = arg4; var response = JSON.parse(request.responseText); var host = Ember.Object.create({ error: { @@ -797,7 +800,7 @@ App.BulkOperationsController = Em.Controller.extend({ undeletableHosts.push(host); } else { var data = arg0; - var params = arg2; + let params = arg2; if (data) { data.deleteResult.forEach(function (host) { if (host.deleted) { @@ -812,12 +815,7 @@ App.BulkOperationsController = Em.Controller.extend({ } }); } else { - var host = { - deleted: { - key: params.hosts[0] - } - }; - deletedHosts.push(host); + deletedHosts.pushObjects(params.hostNames.map(hostName => ({deleted: {key: `${hostName}/${params.componentName}`}}))); } } @@ -831,6 +829,7 @@ App.BulkOperationsController = Em.Controller.extend({ message: Em.I18n.t('hosts.bulkOperation.delete.component.dryRun.message').format(undeletableHosts.length), undeletableHosts: undeletableHosts, deletedHosts: deletedHosts.sortProperty('deleted.key'), + deleteComponents: true, onToggleHost: function (host) { host.contexts[0].toggleProperty('isCollapsed'); } http://git-wip-us.apache.org/repos/asf/ambari/blob/7029e7fa/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 5e1d08f..f75d801 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -2597,8 +2597,8 @@ Em.I18n.translations = { 'hosts.bulkOperation.confirmation.delete.component.minimum.body': 'At least {0} {1} should be installed in the cluster.', 'hosts.bulkOperation.confirmation.delete.component.nothingToDo.body': '{0} are neither installed on selected hosts nor in the states that can be deleted.', 'hosts.bulkOperation.confirmation.delete.component.skip':'The following hosts are skipped as {0} on them are not in the states that can be deleted.', - 'hosts.bulkOperation.delete.component.result.header':'Delete Hosts', - 'hosts.bulkOperation.delete.component.result.body': 'The following hosts were deleted successfully:', + 'hosts.bulkOperation.delete.component.result.header':'Delete Components', + 'hosts.bulkOperation.delete.component.result.body': 'The following components were deleted successfully:', 'hosts.bulkOperation.delete.component.dryRun.message':'There are <strong>{0} host(s)</strong> that cannot be deleted (expand for reason):', 'hosts.selectHostsDialog.title': 'Select Configuration Group Hosts', http://git-wip-us.apache.org/repos/asf/ambari/blob/7029e7fa/ambari-web/app/templates/main/host/delete_hosts_result_popup.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/host/delete_hosts_result_popup.hbs b/ambari-web/app/templates/main/host/delete_hosts_result_popup.hbs index eb6f89c..2e074bc 100644 --- a/ambari-web/app/templates/main/host/delete_hosts_result_popup.hbs +++ b/ambari-web/app/templates/main/host/delete_hosts_result_popup.hbs @@ -16,7 +16,11 @@ * limitations under the License. }} {{#if view.deletedHosts}} - <p>{{t hosts.bulkOperation.deleteHosts.result.body}}</p> + {{#if view.deleteComponents}} + <p>{{t hosts.bulkOperation.delete.component.result.body}}</p> + {{else}} + <p>{{t hosts.bulkOperation.deleteHosts.result.body}}</p> + {{/if}} {{/if}} {{#each deletedHost in view.deletedHosts}} @@ -39,4 +43,4 @@ </div> </div> {{/each}} -{{/if}} \ No newline at end of file +{{/if}}