diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 858deebfdf..857c31dcf5 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -238,7 +238,9 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP }); scope.filterInventory = function() { - HostsReload({ scope: scope, inventory_id: scope['inventory_id'], group_id: scope['group_id'] }); + $rootScope.hostFailureFilter = scope.hostFailureFilter; + LoadSearchTree({ scope: scope, inventory_id: scope['inventory_id'] }); + //HostsReload({ scope: scope, inventory_id: scope['inventory_id'], group_id: scope['group_id'] }); } scope.filterHosts = function() { @@ -383,10 +385,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP scope['selectedNode'] = node; scope['selectedNodeName'] = node.attr('name'); - scope['selectedNodeName'] += (node.attr('data-failures') == 'true') ? - ' ' + - '' : ''; - + $('#tree-view').jstree('open_node',node); if (type == 'group') { diff --git a/awx/ui/static/js/helpers/Hosts.js b/awx/ui/static/js/helpers/Hosts.js index 0c50d3d9b8..857a7e6668 100644 --- a/awx/ui/static/js/helpers/Hosts.js +++ b/awx/ui/static/js/helpers/Hosts.js @@ -477,7 +477,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H RelatedSearchInit({ scope: params.scope, form: InventoryForm, relatedSets: relatedSets }); RelatedPaginateInit({ scope: params.scope, relatedSets: relatedSets, pageSize: 40 }); - if (scope['hostFailureFilter']) { + /*if (scope['hostFailureFilter']) { // If the user checked 'show only hosts with failures', filter for hosts with failed jobs scope['hostSearchFieldLabel'] = 'Failed jobs?'; scope['hostSearchField'] = 'has_active_failures'; @@ -488,7 +488,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H scope['hostSearchSelectValue'] = scope['hostSearchSelectOpts'][i]; } } - } + } */ scope.search('host'); diff --git a/awx/ui/static/js/helpers/inventory.js b/awx/ui/static/js/helpers/inventory.js index 29ca4fafef..1520356bad 100644 --- a/awx/ui/static/js/helpers/inventory.js +++ b/awx/ui/static/js/helpers/inventory.js @@ -35,17 +35,14 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi scope.inventoryLoadedRemove(); } scope.inventoryLoadedRemove = scope.$on('inventoryLoaded', function() { - var filter = (scope.inventoryFailureFilter) ? "has_active_failures=true&" : ""; - var url = groups + '?' + filter + 'order_by=name'; - var title; + var url = groups + '?order_by=name'; Rest.setUrl(url); Rest.get() .success( function(data, status, headers, config) { for (var i=0; i < data.results.length; i++) { - title = data.results[i].name; treeData[0].children.push({ data: { - title: title + title: data.results[i].name }, attr: { id: idx, @@ -55,7 +52,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi description: data.results[i].description, inventory: data.results[i].inventory, all: data.results[i].related.all_hosts, - children: data.results[i].related.children + '?' + filter + 'order_by=name', + children: data.results[i].related.children + '?order_by=name', hosts: data.results[i].related.hosts, variable: data.results[i].related.variable_data, "data-failures": data.results[i].has_active_failures @@ -71,13 +68,10 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi }); }); - var title = inventory_name; - title += (has_active_failures) ? ' ' + - '' : ''; treeData = [{ data: { - title: title + title: inventory_name }, attr: { type: 'inventory', @@ -142,13 +136,10 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi headers: { 'Authorization': 'Token ' + Authorization.getToken() }, success: function(data) { var response = []; - var title; - var filter = (scope.inventoryFailureFilter) ? "has_active_failures=true&" : ""; for (var i=0; i < data.results.length; i++) { - title = data.results[i].name; response.push({ data: { - title: title + title: data.results[i].name }, attr: { id: idx, @@ -158,7 +149,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi description: data.results[i].description, inventory: data.results[i].inventory, all: data.results[i].related.all_hosts, - children: data.results[i].related.children + '?' + filter + 'order_by=name', + children: data.results[i].related.children + '?order_by=name', hosts: data.results[i].related.hosts, variable: data.results[i].related.variable_data, "data-failures": data.results[i].has_active_failures @@ -385,8 +376,6 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi node.attr('description', description); scope = angular.element(getElementById('htmlTemplate')).scope(); scope['selectedNodeName'] = name; - scope['selectedNodeName'] += (node.attr('data-failures') == 'true') ? - ' ' : ''; } }]) diff --git a/awx/ui/static/js/helpers/related-search.js b/awx/ui/static/js/helpers/related-search.js index 8f9fcd85d1..b0e75f98cf 100644 --- a/awx/ui/static/js/helpers/related-search.js +++ b/awx/ui/static/js/helpers/related-search.js @@ -83,15 +83,6 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat scope[iterator + 'HideSearchType'] = true; } - if (iterator == 'host') { - if (fld == 'has_active_failures') { - scope['hostFailureFilter'] = true; - } - else { - scope['hostFailureFilter'] = false; - } - } - scope.search(iterator); } @@ -143,13 +134,13 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat (scope[iterator + 'SelectShow'] && scope[iterator + 'SearchSelectValue']) || (f.searchType && f.searchType == 'gtzero') ) { if (f.sourceModel) { // handle fields whose source is a related model e.g. inventories.organization - scope[iterator + 'SearchParams'] = '?' + f.sourceModel + '__' + f.sourceField + '__'; + scope[iterator + 'SearchParams'] = f.sourceModel + '__' + f.sourceField + '__'; } else if (f.searchField) { - scope[iterator + 'SearchParams'] = '?' + f.searchField + '__'; + scope[iterator + 'SearchParams'] = f.searchField + '__'; } else { - scope[iterator + 'SearchParams'] = '?' + scope[iterator + 'SearchField'] + '__'; + scope[iterator + 'SearchParams'] = scope[iterator + 'SearchField'] + '__'; } if ( f.searchType && (f.searchType == 'int' || f.searchType == 'boolean' ) ) { @@ -171,11 +162,10 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat scope[iterator + 'SearchParams'] += (sort_order) ? '&order_by=' + escape(sort_order) : ''; } else { - scope[iterator + 'SearchParams'] = ''; - scope[iterator + 'SearchParams'] += (sort_order) ? '?order_by=' + escape(sort_order) : ''; + scope[iterator + 'SearchParams'] = (sort_order) ? 'order_by=' + escape(sort_order) : ''; } - scope[iterator + 'Page'] = 0; + url += (url.match(/\/$/)) ? '?' : '&'; url += scope[iterator + 'SearchParams']; url += (scope[iterator + 'PageSize']) ? '&page_size=' + scope[iterator + 'PageSize'] : ""; RefreshRelated({ scope: scope, set: set, iterator: iterator, url: url }); diff --git a/awx/ui/static/lib/ansible/directives.js b/awx/ui/static/lib/ansible/directives.js index 4b62fd4d28..eada55faf5 100644 --- a/awx/ui/static/lib/ansible/directives.js +++ b/awx/ui/static/lib/ansible/directives.js @@ -474,10 +474,13 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Hos var url = parent.attr('data-groups'); var html = ''; var token = Authorization.getToken(); + + url += ($rootScope.hostFailureFilter) ? '?has_active_failures=true&order_by=name' : '?order_by=name'; + /* For reasons unknown calling Rest fails. It just dies with no errors or any info */ $.ajax({ - url: url + '?order_by=name', + url: url, headers: { 'Authorization': 'Token ' + token }, dataType: 'json', success: function(data) {