From 7f5c5396a37656ea42d7864f8a22ac82e8a338d5 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Tue, 14 Apr 2015 16:46:24 -0400 Subject: [PATCH] got add hosts button to work at root level of inventory --- awx/ui/static/js/helpers/Hosts.js | 8 +++++++- awx/ui/static/js/lists/InventoryHosts.js | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) 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: {