diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 56914cfdb8..7e211ca337 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -77,6 +77,10 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res scope.viewJobs = function(id) { $location.url('/jobs/?inventory__int=' + id + '&order_by=status'); } + + scope.viewFailedJobs = function(id) { + $location.url('/jobs/?inventory__int=' + id + '&status=failed&order_by=status'); + } } InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList', @@ -482,11 +486,10 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP HostsDelete({ scope: scope, "inventory_id": id, group_id: scope.group_id, host_id: host_id, host_name: host_name, request: 'delete' }); } - - /* scope.removeHost = function(host_id, host_name) { - HostsDelete({ scope: scope, "inventory_id": id, group_id: scope.group_id, host_id: host_id, host_name: host_name, - request: 'remove' }); - } */ + + scope.viewJobs = function(last_job) { + $location.url('/jobs/?id__int=' + last_job ); + } scope.viewLastEvents = function(host_id, last_job, host_name, last_job_name) { // Choose View-> Latest job events diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 566dc1ba83..69a7535d34 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -50,6 +50,11 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest, scope[list.iterator + 'SearchValue'] = $routeParams['inventory__int']; scope[list.iterator + 'SearchFieldLabel'] = 'Inventory ID'; } + if ($routeParams['id__int']) { + scope[list.iterator + 'SearchField'] = 'id'; + scope[list.iterator + 'SearchValue'] = $routeParams['id__int']; + scope[list.iterator + 'SearchFieldLabel'] = 'Job ID'; + } scope.search(list.iterator); // Called from Inventories page, failed jobs link. Now sort by status so faild jobs appear at top of list diff --git a/awx/ui/static/js/forms/Inventories.js b/awx/ui/static/js/forms/Inventories.js index b7632bc8a1..1ac5acbd59 100644 --- a/awx/ui/static/js/forms/Inventories.js +++ b/awx/ui/static/js/forms/Inventories.js @@ -122,9 +122,10 @@ angular.module('InventoryFormDefinition', []) dropdown: { type: 'DropDown', label: 'View', + "class": "btn-sm", ngDisabled: 'host.last_job == null', options: [ - { ngClick: 'viewJobs(\{\{ host.id \}\})', label: 'Jobs' }, + { ngClick: 'viewJobs(\{\{ host.last_job \}\})', label: 'Latest job' }, { ngClick: "viewLastEvents(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " + "'\{\{ host.summary_fields.last_job.name \}\}')", label: 'Latest job events' }, { ngClick: "viewLastSummary(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " + diff --git a/awx/ui/static/js/lists/Inventories.js b/awx/ui/static/js/lists/Inventories.js index 66f754b734..c61f7e8ce0 100644 --- a/awx/ui/static/js/lists/Inventories.js +++ b/awx/ui/static/js/lists/Inventories.js @@ -37,20 +37,6 @@ angular.module('InventoriesListDefinition', []) sourceField: 'name', excludeModal: true } - /*, - has_active_failures: { - label: 'Failed Jobs?', - showValue: false, - text: 'View failures', - ngShow: "\{\{ inventory.has_active_failures \}\}", - icon: 'icon-exclamation-sign', - "class": 'active-failures-\{\{ inventory.has_active_failures \}\}', - ngClick: 'viewJobs(\{\{ inventory.id \}\})', - searchField: 'has_active_failures', - searchType: 'boolean', - searchOptions: [{ name: "No", value: 0 }, { name: "Yes", value: 1 }], - excludeModal: true - }*/ }, actions: { @@ -65,6 +51,17 @@ angular.module('InventoriesListDefinition', []) }, fieldActions: { + + dropdown: { + type: 'DropDown', + label: 'View', + 'class': 'btn-xs', + options: [ + { ngClick: 'viewJobs(\{\{ inventory.id \}\})', label: 'Jobs' }, + { ngClick: "viewFailedJobs(\{\{ inventory.id \}\})", label: 'Failed jobs' } + ] + }, + edit: { label: 'Edit', ngClick: "editInventory(\{\{ inventory.id \}\})", diff --git a/awx/ui/static/lib/ansible/generator-helpers.js b/awx/ui/static/lib/ansible/generator-helpers.js index 4a080f15f8..e8b6536af2 100644 --- a/awx/ui/static/lib/ansible/generator-helpers.js +++ b/awx/ui/static/lib/ansible/generator-helpers.js @@ -98,14 +98,22 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers']) var list = params['list']; var fld = params['fld']; var options = params['options']; - var base = params['base']; - var field = list['fields'][fld]; + var field; - html = "