diff --git a/awx/ui/static/js/controllers/JobHosts.js b/awx/ui/static/js/controllers/JobHosts.js index 6001d9ef47..5c94a29274 100644 --- a/awx/ui/static/js/controllers/JobHosts.js +++ b/awx/ui/static/js/controllers/JobHosts.js @@ -48,7 +48,7 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, } scope.RemoveSetHostLink = scope.$on('setHostLink', function(e, inventory_id) { for (var i=0; i < scope.jobhosts.length; i++) { - scope.jobhosts[i].hostLinkTo = '/#/inventories/' + inventory_id + '/hosts/?name=' + + scope.jobhosts[i].hostLinkTo = '/#/inventories/' + inventory_id + '/?host_name=' + escape(scope.jobhosts[i].summary_fields.host.name); } }); @@ -91,9 +91,10 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, } else { // Make the host name appear in breadcrumbs - LoadBreadCrumbs({ path: '/hosts/' + scope['host_id'], title: $routeParams['host_name'] }); + LoadBreadCrumbs({ path: '/hosts/' + scope['host_id'], + title: ( (scope.jobhosts.length > 0) ? scope.jobhosts[0].summary_fields.host.name : 'Host' ) }); if ($routeParams['inventory']) { - scope.$emit('setHostLink', $routeParams['inventory']); + scope.$emit('setHostLink', $routeParams['inventory']); } } }); diff --git a/awx/ui/static/js/helpers/Hosts.js b/awx/ui/static/js/helpers/Hosts.js index 7420127e1d..22aa6ef4d7 100644 --- a/awx/ui/static/js/helpers/Hosts.js +++ b/awx/ui/static/js/helpers/Hosts.js @@ -52,8 +52,8 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H } }]) - .factory('HostsReload', [ 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait', 'SetHostStatus', - function(Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus) { + .factory('HostsReload', [ '$routeParams', 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait', 'SetHostStatus', + function($routeParams, Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus) { return function(params) { var scope = params.scope; @@ -61,6 +61,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H var tree_id = params.tree_id var inventory_id = params.inventory_id; + var list = InventoryHosts; var url = ( !Empty(group_id) ) ? GetBasePath('groups') + group_id + '/all_hosts/' : GetBasePath('inventory') + inventory_id + '/hosts/'; @@ -80,9 +81,27 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H scope.$emit('HostReloadComplete'); }); - SearchInit({ scope: scope, set: 'hosts', list: InventoryHosts, url: url }); - PaginateInit({ scope: scope, list: InventoryHosts, url: url }); - scope.search(InventoryHosts.iterator); + SearchInit({ scope: scope, set: 'hosts', list: list, url: url }); + PaginateInit({ scope: scope, list: list, url: url }); + + if ($routeParams['host_name']) { + scope[list.iterator + 'InputDisable'] = false; + scope[list.iterator + 'SearchValue'] = $routeParams['host_name']; + scope[list.iterator + 'SearchField'] = 'name'; + scope[list.iterator + 'SearchFieldLabel'] = list.fields['name'].label; + scope[list.iterator + 'SearchSelectValue'] = null; + } + + if (scope.show_failures) { + scope[list.iterator + 'InputDisable'] = true; + scope[list.iterator + 'SearchValue'] = 'true'; + scope[list.iterator + 'SearchField'] = 'has_active_failures'; + scope[list.iterator + 'SearchFieldLabel'] = list.fields['has_active_failures'].label; + scope[list.iterator + 'SearchSelectValue'] = { value: 1 }; + } + + scope.search(list.iterator); + } }]) diff --git a/awx/ui/static/js/lists/InventoryHosts.js b/awx/ui/static/js/lists/InventoryHosts.js index e582348f08..dc48c886bc 100644 --- a/awx/ui/static/js/lists/InventoryHosts.js +++ b/awx/ui/static/js/lists/InventoryHosts.js @@ -74,6 +74,7 @@ angular.module('InventoryHostsDefinition', []) }, active_failures: { //label: 'Job Status', + ngHref: "\{\{'/#/hosts/' + host.id + '/job_host_summaries/?inventory=' + inventory_id \}\}", awToolTip: "\{\{ host.badgeToolTip \}\}", dataPlacement: 'top', iconClass: "\{\{ 'fa icon-failures-' + host.has_active_failures \}\}" diff --git a/awx/ui/static/lib/ansible/list-generator.js b/awx/ui/static/lib/ansible/list-generator.js index 1a374f2dfd..9a160d1b6d 100644 --- a/awx/ui/static/lib/ansible/list-generator.js +++ b/awx/ui/static/lib/ansible/list-generator.js @@ -326,7 +326,7 @@ angular.module('ListGenerator', ['GeneratorHelpers']) list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }}, true)\" ng-true-value=\"1\" " + "ng-false-value=\"0\" id=\"check_{{" + list.iterator + ".id}}\" />"; } - else if (options.mode == 'edit' || options.mode == 'summary') { + else if ((options.mode == 'edit' || options.mode == 'summary') && list.fieldActions) { // Row level actions @@ -349,7 +349,7 @@ angular.module('ListGenerator', ['GeneratorHelpers']) html += (fAction.ngHref) ? "ng-href=\"" + fAction.ngHref + "\" " : ""; html += (action == 'cancel') ? " class=\"cancel red-txt\" " : ""; for (itm in fAction) { - if (itm != 'href' && itm != 'label' && itm != 'icon' && itm != 'class' && itm != 'iconClass') { + if (itm != 'ngHref' && itm != 'href' && itm != 'label' && itm != 'icon' && itm != 'class' && itm != 'iconClass') { html += Attr(fAction, itm); } }