diff --git a/awx/ui/static/js/controllers/Hosts.js b/awx/ui/static/js/controllers/Hosts.js index 86735dcf98..e25282cfc2 100644 --- a/awx/ui/static/js/controllers/Hosts.js +++ b/awx/ui/static/js/controllers/Hosts.js @@ -33,10 +33,11 @@ function InventoryHosts ($scope, $rootScope, $compile, $location, $log, $routePa if (scope.loadBreadCrumbsRemove) { scope.loadBreadCrumbsRemove(); } - scope.loadBreadCrumbsRemove = scope.$on('hostTabInit', function(e, inventory_name) { + scope.loadBreadCrumbsRemove = scope.$on('buildAllGroups', function(e, inventory_name) { LoadBreadCrumbs({ path: '/inventories/' + id, title: inventory_name }); }); + // Sets up the search tree and loads All Hosts for the inventory LoadSearchTree({ scope: scope, inventory_id: scope['inventory_id'] }); // Add the selected flag to the hosts set. diff --git a/awx/ui/static/js/helpers/Hosts.js b/awx/ui/static/js/helpers/Hosts.js index 770eff73d7..f858f8553a 100644 --- a/awx/ui/static/js/helpers/Hosts.js +++ b/awx/ui/static/js/helpers/Hosts.js @@ -6,7 +6,7 @@ * Routines that handle host add/edit/delete on the Inventory detail page. * */ - + angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'HostListDefinition', 'SearchHelper', 'PaginateHelper', 'ListGenerator', 'AuthService', 'HostsHelper', 'InventoryHelper', 'RelatedSearchHelper','RelatedPaginateHelper', @@ -460,49 +460,194 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H }]) - .factory('LoadSearchTree', ['Rest', 'GetBasePath', 'ProcessErrors', '$compile', - function(Rest, GetBasePath, ProcessErrors, $compile) { + .factory('LoadSearchTree', ['Rest', 'GetBasePath', 'ProcessErrors', '$compile', '$rootScope', 'Wait', + function(Rest, GetBasePath, ProcessErrors, $compile, $rootScope, Wait) { return function(params) { var scope = params.scope; var inventory_id = params.inventory_id; - var newTree = []; - scope.searchTree = []; + var html = ''; + + function buildHTML(tree_data) { + html += (tree_data.length > 0) ? "
' + parent.attr('data-description') + '
' : ''; + } + else { + group = null; + title = 'All Hosts' + } + // The following will trigger the host list to load. See Inventory.js controller. + scope.$emit('refreshHost', group, title); + } + + function activate(e) { + /* Set the clicked node as active */ + var elm = angular.element(e.target); // + var parent = angular.element(e.target.parentNode); //' + parent.attr('data-description') + '
' : ''; - } - else { - group = null; - title = 'All Hosts' - } - // The following will trigger the host list to load. See Inventory.js controller. - scope.$emit('refreshHost', group, title); - } + // function refresh(parent) { + // var group, title; + // if (parent.attr('data-group-id')) { + // group = parent.attr('data-group-id'); + // title = parent.attr('data-name'); + // //title += (parent.attr('data-description') !== "") ? '' + parent.attr('data-description') + '
' : ''; + // } + // else { + // group = null; + // title = 'All Hosts' + // } + // // The following will trigger the host list to load. See Inventory.js controller. + // scope.$emit('refreshHost', group, title); + // } - function activate(e) { - /* Set the clicked node as active */ - var elm = angular.element(e.target); // - var parent = angular.element(e.target.parentNode); //