diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 1e1bed981d..39b8a0fe68 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -112,18 +112,13 @@ angular.module('ansible', [ templateUrl: urlPrefix + 'partials/jobs.html', controller: 'JobsListController' }). - - /* when('/jobs/:id', { - templateUrl: urlPrefix + 'partials/jobs.html', - controller: 'JobsEdit' - }). */ - - when('/jobs/:id/job_events', { + + when('/job_events/:id', { templateUrl: urlPrefix + 'partials/job_events.html', controller: 'JobEventsList' }). - when('/jobs/:id/job_host_summaries', { + when('/job_host_summaries/:id', { templateUrl: urlPrefix + 'partials/job_host_summaries.html', controller: 'JobHostSummaryList' }). @@ -445,6 +440,7 @@ angular.module('ansible', [ base = 'home'; } else { base.replace(/\_/g, ' '); + base = (base === 'job_events' || base === 'job_host_summaries') ? 'jobs' : base; } $('.nav-tabs a[href="#' + base + '"]').tab('show'); }); @@ -466,6 +462,9 @@ angular.module('ansible', [ $location.path('/home'); } else { base.replace(/\_/g, ' '); + if (base === 'jobevents' || base === 'jobhostsummaries') { + base = 'jobs'; + } } $('.nav-tabs a[href="#' + base + '"]').tab('show'); diff --git a/awx/ui/static/js/controllers/Home.js b/awx/ui/static/js/controllers/Home.js index 150c25141f..87ec893b1b 100644 --- a/awx/ui/static/js/controllers/Home.js +++ b/awx/ui/static/js/controllers/Home.js @@ -373,8 +373,8 @@ function HomeGroups($scope, $filter, $compile, $location, $routeParams, LogViewe ". Click for details\" aw-tip-placement=\"top\">\n"; //html += "" + ($filter('date')(row.finished,'MM/dd HH:mm:ss')).replace(/ /,'
') + ""; - html += "Events
" + - "Hosts"; + html += "Events
" + + "Hosts"; html += "" + ellipsis(row.name) + ""; html += "\n"; }); diff --git a/awx/ui/static/js/controllers/JobEvents.js b/awx/ui/static/js/controllers/JobEvents.js index 5b856aef9d..668be47066 100644 --- a/awx/ui/static/js/controllers/JobEvents.js +++ b/awx/ui/static/js/controllers/JobEvents.js @@ -20,9 +20,7 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam defaultUrl = GetBasePath('jobs') + $routeParams.id + '/job_events/', //?parent__isnull=1'; generator = GenerateList, page; - - generator.inject(list, { mode: 'edit', scope: $scope }); - + list.base = $location.path(); $scope.job_id = $routeParams.id; $rootScope.flashMessage = null; @@ -125,6 +123,7 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam } $scope.removePostRefresh = $scope.$on('PostRefresh', function () { // Initialize the parent levels + generator.inject(list, { mode: 'edit', scope: $scope }); var set = $scope[list.name], i; for (i = 0; i < set.length; i++) { set[i].event_display = set[i].event_display.replace(/^\u00a0*/g, ''); @@ -179,9 +178,14 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam $scope.job_status = data.status; $scope.job_name = data.summary_fields.job_template.name; LoadBreadCrumbs({ - path: '/jobs/' + $scope.job_id, - title: $scope.job_id + ' - ' + data.summary_fields.job_template.name + path: '/job_events/' + $scope.job_id, + title: $scope.job_id + ' - ' + data.summary_fields.job_template.name, + altPath: '/jobs' }); + $rootScope.breadcrumbs = [{ + path: '/jobs', + title: $scope.job_id + ' - ' + data.summary_fields.job_template.name, + }]; $scope.$emit('SetHostLinks', data.inventory); }) .error(function (data, status) { @@ -199,6 +203,7 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam }); page = ($routeParams.page) ? parseInt($routeParams.page,10) - 1 : null; + PaginateInit({ scope: $scope, list: list, diff --git a/awx/ui/static/js/controllers/JobHosts.js b/awx/ui/static/js/controllers/JobHosts.js index ef595cbef4..f53590733c 100644 --- a/awx/ui/static/js/controllers/JobHosts.js +++ b/awx/ui/static/js/controllers/JobHosts.js @@ -17,28 +17,27 @@ function JobHostSummaryList($scope, $rootScope, $location, $log, $routeParams, R ClearScope(); var list = JobHostList, - base = $location.path().replace(/^\//, '').split('/')[0], - defaultUrl = GetBasePath(base) + $routeParams.id + '/job_host_summaries/', - view = GenerateList, - scope = view.inject(list, { mode: 'edit' }); - + defaultUrl = GetBasePath('jobs') + $routeParams.id + '/job_host_summaries/', + view = GenerateList; + // When viewing all summaries for a particular host, show job ID, otherwise row ID. - if (base === 'hosts') { - list.index = false; - } else { - list.index = true; - } + //if (base === 'hosts') { + // list.index = false; + //} else { + // list.index = true; + //} $scope.selected = []; // control enable/disable/show of job specific view elements - if (base === 'hosts') { - $scope.job_id = null; - $scope.host_id = $routeParams.id; - } else { - $scope.job_id = $routeParams.id; - $scope.host_id = null; - } + //if (base === 'hosts') { + //$scope.job_id = null; + //$scope.host_id = $routeParams.id; + //} else { + //} + + $scope.job_id = $routeParams.id; + $scope.host_id = null; if ($scope.RemoveSetHostLink) { $scope.RemoveSetHostLink(); @@ -56,6 +55,8 @@ function JobHostSummaryList($scope, $rootScope, $location, $log, $routeParams, R } $scope.removePostRefresh = $scope.$on('PostRefresh', function () { + view.inject(list, { mode: 'edit', scope: $scope }); + // Set status, tooltips, badges icons, etc. $scope.jobhosts.forEach(function(element, i) { $scope.jobhosts[i].host_name = ($scope.jobhosts[i].summary_fields.host) ? $scope.jobhosts[i].summary_fields.host.name : ''; @@ -63,67 +64,71 @@ function JobHostSummaryList($scope, $rootScope, $location, $log, $routeParams, R $scope.jobhosts[i].statusBadgeToolTip = JobStatusToolTip($scope.jobhosts[i].status) + " Click to view details."; if ($scope.jobhosts[i].summary_fields.host) { - $scope.jobhosts[i].statusLinkTo = '/#/jobs/' + $scope.jobhosts[i].job + '/job_events/?host=' + + $scope.jobhosts[i].statusLinkTo = '/#/job_events/' + $scope.jobhosts[i].job + '/?host=' + encodeURI($scope.jobhosts[i].summary_fields.host.name); } else { - $scope.jobhosts[i].statusLinkTo = '/#/jobs/' + $scope.jobhosts[i].job + '/job_events'; + $scope.jobhosts[i].statusLinkTo = '/#/job_events/' + $scope.jobhosts[i].job; } }); - if ($scope.job_id !== null && $scope.job_id !== undefined && $scope.job_id !== '') { + //if ($scope.job_id !== null && $scope.job_id !== undefined && $scope.job_id !== '') { // need job_status so we can show/hide refresh button - Rest.setUrl(GetBasePath('jobs') + $scope.job_id); - Rest.get() - .success(function (data) { - LoadBreadCrumbs({ - path: '/jobs/' + data.id, - title: data.id + ' - ' + - data.summary_fields.job_template.name - }); - $scope.job_status = data.status; - if (!(data.status === 'pending' || data.status === 'waiting' || data.status === 'running')) { - if ($rootScope.timer) { - clearInterval($rootScope.timer); - } - } - $scope.$emit('setHostLink', data.inventory); - }) - .error(function (data, status) { - ProcessErrors(scope, data, status, null, { - hdr: 'Error!', - msg: 'Failed to get job status for job: ' + $scope.job_id + '. GET status: ' + status - }); + Rest.setUrl(GetBasePath('jobs') + $scope.job_id + '/'); + Rest.get() + .success(function (data) { + LoadBreadCrumbs({ + path: '/job_host_summaries/' + $scope.job_id, + title: $scope.job_id + ' - ' + data.summary_fields.job_template.name, + altPath: '/jobs' + }); + $rootScope.breadcrumbs = [{ + path: '/jobs', + title: $scope.job_id + ' - ' + data.summary_fields.job_template.name, + }]; + $scope.job_status = data.status; + if (!(data.status === 'pending' || data.status === 'waiting' || data.status === 'running')) { + if ($rootScope.timer) { + clearInterval($rootScope.timer); + } + } + $scope.$emit('setHostLink', data.inventory); + }) + .error(function (data, status) { + ProcessErrors($scope, data, status, null, { hdr: 'Error!', + msg: 'Failed to get job status for job: ' + $scope.job_id + '. GET status: ' + status }); - } else { - // Make the host name appear in breadcrumbs - 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); - } - } + //} else { + // Make the host name appear in breadcrumbs + // 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); + // } + //} }); SearchInit({ - scope: scope, + scope: $scope, set: 'jobhosts', list: list, url: defaultUrl }); + PaginateInit({ - scope: scope, + scope: $scope, list: list, url: defaultUrl }); // Called from Inventories tab, host failed events link: if ($routeParams.host_name) { - scope[list.iterator + 'SearchField'] = 'host'; - scope[list.iterator + 'SearchValue'] = $routeParams.host_name; - scope[list.iterator + 'SearchFieldLabel'] = list.fields.host.label; + $scope[list.iterator + 'SearchField'] = 'host'; + $scope[list.iterator + 'SearchValue'] = $routeParams.host_name; + $scope[list.iterator + 'SearchFieldLabel'] = list.fields.host.label; } $scope.search(list.iterator); @@ -141,7 +146,7 @@ function JobHostSummaryList($scope, $rootScope, $location, $log, $routeParams, R $location.url('/jobs/' + data.id + '/job_events/?host=' + encodeURI(host_name)); }) .error(function (data, status) { - ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Failed to lookup last job: ' + last_job + + ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to lookup last job: ' + last_job + '. GET status: ' + status }); }); }; @@ -156,7 +161,7 @@ function JobHostSummaryList($scope, $rootScope, $location, $log, $routeParams, R $scope.jobLoading = true; Wait('start'); Refresh({ - scope: scope, + scope: $scope, set: 'jobhosts', iterator: 'jobhost', url: $scope.current_url diff --git a/awx/ui/static/js/helpers/Hosts.js b/awx/ui/static/js/helpers/Hosts.js index 539b535204..7fdb7127f6 100644 --- a/awx/ui/static/js/helpers/Hosts.js +++ b/awx/ui/static/js/helpers/Hosts.js @@ -111,8 +111,8 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H "aw-tool-tip=\"" + job.status.charAt(0).toUpperCase() + job.status.slice(1) + ". Click for details\" data-placement=\"top\">\n"; - html += "Events
" + - "Hosts\n"; + html += "Events
" + + "Hosts\n"; html += "" + ellipsis(job.name) + "\n"; html += "\n"; } diff --git a/awx/ui/static/js/lists/CompletedJobs.js b/awx/ui/static/js/lists/CompletedJobs.js index c4689e7645..38e6f77a75 100644 --- a/awx/ui/static/js/lists/CompletedJobs.js +++ b/awx/ui/static/js/lists/CompletedJobs.js @@ -108,8 +108,8 @@ angular.module('CompletedJobsDefinition', []) 'class': 'btn-default btn-xs', options: [ //{ ngHref: '/#/jobs/{{ completed_job.id }}', label: 'Status' }, - { ngHref: '/#/jobs/{{ completed_job.id }}/job_events', label: 'Events', ngHide: "completed_job.status == 'new'" }, - { ngHref: '/#/jobs/{{ completed_job.id }}/job_host_summaries', label: 'Host Summary' } + { ngHref: '/#/job_events/{{ completed_job.id }}', label: 'Events', ngHide: "completed_job.status == 'new'" }, + { ngHref: '/#/job_host_summaries/{{ completed_job.id }}', label: 'Host Summary' } ] } } diff --git a/awx/ui/static/js/lists/JobEvents.js b/awx/ui/static/js/lists/JobEvents.js index 8050e50d4c..ed4b6c10fe 100644 --- a/awx/ui/static/js/lists/JobEvents.js +++ b/awx/ui/static/js/lists/JobEvents.js @@ -28,13 +28,13 @@ angular.module('JobEventsListDefinition', []) // ngShow: 'job_id !== null' //}, events: { - href: '/#/jobs/{{ job_id }}/job_events', + href: '/#/job_events/{{ job_id }}', label: 'Events', active: true, icon: 'icon-list-ul' }, hosts: { - href: '/#/jobs/{{ job_id }}/job_host_summaries', + href: '/#/job_host_summaries/{{ job_id }}', label: 'Host Summary', icon: 'icon-laptop' } @@ -47,7 +47,7 @@ angular.module('JobEventsListDefinition', []) key: true, nosort: true, searchable: false, - link: false + noLink: true }, status: { label: 'Status', diff --git a/awx/ui/static/js/lists/JobHosts.js b/awx/ui/static/js/lists/JobHosts.js index a78cbf0383..2a6c1abee9 100644 --- a/awx/ui/static/js/lists/JobHosts.js +++ b/awx/ui/static/js/lists/JobHosts.js @@ -27,12 +27,12 @@ angular.module('JobHostDefinition', []) // ngShow: "job_id !== null" //}, events: { - href: "/#/jobs/{{ job_id }}/job_events", + href: "/#/job_events/{{ job_id }}", label: 'Events', icon: 'icon-list-ul' }, hosts: { - href: "/#/jobs/{{ job_id }}/job_host_summaries", + href: "/#/job_host_summariess/{{ job_id }}", label: 'Host Summary', active: true, icon: 'icon-laptop' @@ -67,6 +67,7 @@ angular.module('JobHostDefinition', []) dataPlacement: 'top', searchField: 'failed', searchType: 'boolean', + showValue: false, searchOptions: [{ name: "success", value: 0 @@ -132,8 +133,8 @@ angular.module('JobHostDefinition', []) ngClick: "refresh()", ngShow: "host_id == null" //don't show when viewing from inventory->hosts } - }, + } - fieldActions: {} + //fieldActions: {} }); \ No newline at end of file diff --git a/awx/ui/static/js/lists/RunningJobs.js b/awx/ui/static/js/lists/RunningJobs.js index fd80aa9701..6b0424b0fb 100644 --- a/awx/ui/static/js/lists/RunningJobs.js +++ b/awx/ui/static/js/lists/RunningJobs.js @@ -91,8 +91,8 @@ angular.module('RunningJobsDefinition', []) 'class': 'btn-default btn-xs', options: [ //{ ngHref: '/#/jobs/{{ running_job.id }}', label: 'Status' }, - { ngHref: '/#/jobs/{{ running_job.id }}/job_events', label: 'Events' }, - { ngHref: '/#/jobs/{{ running_job.id }}/job_host_summaries', label: 'Host Summary' } + { ngHref: '/#/job_events/{{ running_job.id }}', label: 'Events' }, + { ngHref: '/#/job_host_summaries/{{ running_job.id }}', label: 'Host Summary' } ] } } diff --git a/awx/ui/static/lib/ansible/Utilities.js b/awx/ui/static/lib/ansible/Utilities.js index e412e49777..5dc5fee4ca 100644 --- a/awx/ui/static/lib/ansible/Utilities.js +++ b/awx/ui/static/lib/ansible/Utilities.js @@ -246,7 +246,6 @@ angular.module('Utilities', ['RestServices', 'Utilities']) $rootScope.crumbCache.push(crumb); } } - paths = $location.path().replace(/^\//, '').split('/'); ppath = ''; $rootScope.breadcrumbs = []; diff --git a/awx/ui/static/lib/ansible/generator-helpers.js b/awx/ui/static/lib/ansible/generator-helpers.js index bec62420f2..792908706d 100644 --- a/awx/ui/static/lib/ansible/generator-helpers.js +++ b/awx/ui/static/lib/ansible/generator-helpers.js @@ -372,8 +372,8 @@ angular.module('GeneratorHelpers', []) } ]) -.factory('Breadcrumbs', ['Attr', - function (Attr) { +.factory('Breadcrumbs', ['$rootScope', 'Attr', + function ($rootScope, Attr) { return function (params) { // Generate breadcrumbs using the list-generator.js method. diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 0a89de1f68..883b4d2abf 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -409,9 +409,10 @@