diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 7901361b64..6eb0c8c866 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -75,17 +75,17 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest, } scope.editJob = function(id, name) { - LoadBreadCrumbs({ path: '/jobs/' + id, title: name }); + LoadBreadCrumbs({ path: '/jobs/' + id, title: id + ' - ' + name }); $location.path($location.path() + '/' + id); } scope.viewEvents = function(id, name) { - LoadBreadCrumbs({ path: '/jobs/' + id, title: name }); + LoadBreadCrumbs({ path: '/jobs/' + id, title: id + ' - ' + name }); $location.path($location.path() + '/' + id + '/job_events'); } scope.viewSummary = function(id, name) { - LoadBreadCrumbs({ path: '/jobs/' + id, title: name }); + LoadBreadCrumbs({ path: '/jobs/' + id, title: id + ' - ' + name }); $location.path($location.path() + '/' + id + '/job_host_summaries'); } @@ -267,7 +267,7 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, Rest.get({ params: {id: id} }) .success( function(data, status, headers, config) { - LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.name }); + LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.id + ' - ' + data.summary_fields.job_template.name }); for (var fld in form.fields) { if (fld != 'variables' && data[fld] !== null && data[fld] !== undefined) { @@ -288,6 +288,10 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, } master[fld] = scope[fld]; } + + scope.id = data.id; + scope.name = data.summary_fields.job_template.name; + if (fld == 'variables') { // Parse extra_vars, converting to YAML. if ($.isEmptyObject(data.extra_vars) || data.extra_vars == "\{\}" || data.extra_vars == "null") { diff --git a/awx/ui/static/js/forms/Jobs.js b/awx/ui/static/js/forms/Jobs.js index b0bf8bec23..3ac4469bb0 100644 --- a/awx/ui/static/js/forms/Jobs.js +++ b/awx/ui/static/js/forms/Jobs.js @@ -11,7 +11,7 @@ angular.module('JobFormDefinition', []) 'JobForm', { addTitle: 'Create Job', //Legend in add mode - editTitle: '{{ name }}', //Legend in edit mode + editTitle: '{{ id }} - {{ name }}', //Legend in edit mode name: 'jobs', well: true, twoColumns: true, @@ -33,10 +33,11 @@ angular.module('JobFormDefinition', []) fields: { name: { - label: 'Name', + label: 'Job Template', type: 'text', - addRequired: true, - editRequired: true, + addRequired: false, + editRequired: false, + readonly: true, column: 1 }, description: { diff --git a/awx/ui/static/js/lists/Jobs.js b/awx/ui/static/js/lists/Jobs.js index 06073f70f9..8b6e913a49 100644 --- a/awx/ui/static/js/lists/Jobs.js +++ b/awx/ui/static/js/lists/Jobs.js @@ -29,15 +29,18 @@ angular.module('JobsListDefinition', []) searchType: 'int', searchOnly: true }, - name: { - label: 'Name', - link: true - }, created: { label: 'Date', link: true, searchable: false }, + job_template: { + label: 'Job Template', + ngBind: 'job.summary_fields.job_template.name', + link: true, + sourceModel: 'job_template', + sourceField: 'name' + }, status: { label: 'Status', icon: 'icon-circle', @@ -66,10 +69,10 @@ angular.module('JobsListDefinition', []) }, fieldActions: { - summary: { + /*summary: { label: 'Hosts', icon: 'icon-laptop', - ngClick: "viewSummary(\{{ job.id \}\}, '\{\{ job.name \}\}')", + ngClick: "viewSummary(\{{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", "class": 'btn btn-default btn-xs', awToolTip: 'View host summary', ngDisabled: "job.status == 'new'" @@ -78,7 +81,7 @@ angular.module('JobsListDefinition', []) label: 'Events', icon: 'icon-list-ul', mode: 'all', - ngClick: "viewEvents(\{{ job.id \}\}, '\{\{ job.name \}\}')", + ngClick: "viewEvents(\{{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", "class": 'btn btn-default btn-xs', awToolTip: 'View events', ngDisabled: "job.status == 'new'" @@ -86,31 +89,48 @@ angular.module('JobsListDefinition', []) edit: { label: 'Details', icon: 'icon-zoom-in', - ngClick: "editJob(\{\{ job.id \}\}, '\{\{ job.name \}\}')", + ngClick: "editJob(\{\{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", "class": 'btn btn-default btn-xs', awToolTip: 'View job details' + },*/ + + dropdown: { + type: 'DropDown', + label: 'View', + 'class': 'btn-xs', + options: [ + { ngClick: "viewSummary(\{{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", label: 'Host Summary', + ngHide: "job.status == 'new'" }, + { ngClick: "viewEvents(\{{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", label: 'Job Events', + ngHide: "job.status == 'new'" }, + { ngClick: "editJob(\{\{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')", label: 'Job Details' } + ] }, + rerun: { - icon: 'icon-retweet', + label: 'Launch', + icon: 'icon-rocket', mode: 'all', ngClick: "submitJob(\{\{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}' )", "class": 'btn-success btn-xs', - awToolTip: 'Re-run this job' + awToolTip: 'Relaunch the job template, running it again from scratch' }, cancel: { + label: 'Cancel', icon: 'icon-minus-sign', mode: 'all', ngClick: 'deleteJob(\{\{ job.id \}\})', "class": 'btn-danger btn-xs', - awToolTip: 'Cancel job', + awToolTip: 'Cancel a running or pending job', ngShow: "job.status == 'pending' || job.status == 'running'" }, "delete": { + label: 'Delete', icon: 'icon-trash', mode: 'all', ngClick: 'deleteJob(\{\{ job.id \}\})', "class": 'btn-danger btn-xs', - awToolTip: 'Delete this job', + awToolTip: 'Remove the selected job from the database', ngShow: "job.status != 'pending' && job.status != 'running'" } } diff --git a/awx/ui/static/lib/ansible/Utilities.js b/awx/ui/static/lib/ansible/Utilities.js index 28887d6a0a..b5e7b6a4d1 100644 --- a/awx/ui/static/lib/ansible/Utilities.js +++ b/awx/ui/static/lib/ansible/Utilities.js @@ -151,8 +151,10 @@ angular.module('Utilities',[]) .factory('LoadBreadCrumbs', ['$rootScope', '$routeParams', '$location', function($rootScope, $routeParams, $location, Rest) { return function(crumb) { + //Keep a list of path/title mappings. When we see /organizations/XX in the path, for example, //we'll know the actual organization name it maps to. + console.log($rootScope.crumbCache); if (crumb !== null && crumb !== undefined) { var found = false; for (var i=0; i < $rootScope.crumbCache.length; i++) {