diff --git a/awx/ui/static/js/helpers/Hosts.js b/awx/ui/static/js/helpers/Hosts.js index e05a542d83..19e32cdcba 100644 --- a/awx/ui/static/js/helpers/Hosts.js +++ b/awx/ui/static/js/helpers/Hosts.js @@ -607,8 +607,14 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name, }); } else { + if (selected_group_id) { + // adding hosts to a group + url = GetBasePath('groups') + selected_group_id + '/'; + } else { + // adding hosts to the top-level (inventory) + url = GetBasePath('inventory') + inventory_id + '/'; + } // Add mode - url = GetBasePath('groups') + selected_group_id + '/'; Rest.setUrl(url); Rest.get() .success( function(data) { diff --git a/awx/ui/static/js/lists/InventoryHosts.js b/awx/ui/static/js/lists/InventoryHosts.js index 256dbc68be..6bd7d69b09 100644 --- a/awx/ui/static/js/lists/InventoryHosts.js +++ b/awx/ui/static/js/lists/InventoryHosts.js @@ -90,7 +90,6 @@ export default create: { mode: 'all', ngClick: "createHost()", - ngHide: '!selected_group_id', //disable when 'All Hosts' selected awToolTip: "Create a new host" }, refresh: {