1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-04 12:51:18 +03:00

AC-455 Replaced job.name with job.template. Re-configured line item actions so that buttons now have labels, making the page consistent with the rest of the applicaiton.

This commit is contained in:
chouseknecht 2013-09-16 10:13:11 -04:00
parent 4b5620806c
commit 2e805f75a1
4 changed files with 47 additions and 20 deletions

View File

@ -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") {

View File

@ -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: {

View File

@ -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'"
}
}

View File

@ -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++) {