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) { scope.editJob = function(id, name) {
LoadBreadCrumbs({ path: '/jobs/' + id, title: name }); LoadBreadCrumbs({ path: '/jobs/' + id, title: id + ' - ' + name });
$location.path($location.path() + '/' + id); $location.path($location.path() + '/' + id);
} }
scope.viewEvents = function(id, name) { 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'); $location.path($location.path() + '/' + id + '/job_events');
} }
scope.viewSummary = function(id, name) { 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'); $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} }) Rest.get({ params: {id: id} })
.success( function(data, status, headers, config) { .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) { for (var fld in form.fields) {
if (fld != 'variables' && data[fld] !== null && data[fld] !== undefined) { 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]; master[fld] = scope[fld];
} }
scope.id = data.id;
scope.name = data.summary_fields.job_template.name;
if (fld == 'variables') { if (fld == 'variables') {
// Parse extra_vars, converting to YAML. // Parse extra_vars, converting to YAML.
if ($.isEmptyObject(data.extra_vars) || data.extra_vars == "\{\}" || data.extra_vars == "null") { if ($.isEmptyObject(data.extra_vars) || data.extra_vars == "\{\}" || data.extra_vars == "null") {

View File

@@ -11,7 +11,7 @@ angular.module('JobFormDefinition', [])
'JobForm', { 'JobForm', {
addTitle: 'Create Job', //Legend in add mode addTitle: 'Create Job', //Legend in add mode
editTitle: '{{ name }}', //Legend in edit mode editTitle: '{{ id }} - {{ name }}', //Legend in edit mode
name: 'jobs', name: 'jobs',
well: true, well: true,
twoColumns: true, twoColumns: true,
@@ -33,10 +33,11 @@ angular.module('JobFormDefinition', [])
fields: { fields: {
name: { name: {
label: 'Name', label: 'Job Template',
type: 'text', type: 'text',
addRequired: true, addRequired: false,
editRequired: true, editRequired: false,
readonly: true,
column: 1 column: 1
}, },
description: { description: {

View File

@@ -29,15 +29,18 @@ angular.module('JobsListDefinition', [])
searchType: 'int', searchType: 'int',
searchOnly: true searchOnly: true
}, },
name: {
label: 'Name',
link: true
},
created: { created: {
label: 'Date', label: 'Date',
link: true, link: true,
searchable: false searchable: false
}, },
job_template: {
label: 'Job Template',
ngBind: 'job.summary_fields.job_template.name',
link: true,
sourceModel: 'job_template',
sourceField: 'name'
},
status: { status: {
label: 'Status', label: 'Status',
icon: 'icon-circle', icon: 'icon-circle',
@@ -66,10 +69,10 @@ angular.module('JobsListDefinition', [])
}, },
fieldActions: { fieldActions: {
summary: { /*summary: {
label: 'Hosts', label: 'Hosts',
icon: 'icon-laptop', 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', "class": 'btn btn-default btn-xs',
awToolTip: 'View host summary', awToolTip: 'View host summary',
ngDisabled: "job.status == 'new'" ngDisabled: "job.status == 'new'"
@@ -78,7 +81,7 @@ angular.module('JobsListDefinition', [])
label: 'Events', label: 'Events',
icon: 'icon-list-ul', icon: 'icon-list-ul',
mode: 'all', mode: 'all',
ngClick: "viewEvents(\{{ job.id \}\}, '\{\{ job.name \}\}')", ngClick: "viewEvents(\{{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}')",
"class": 'btn btn-default btn-xs', "class": 'btn btn-default btn-xs',
awToolTip: 'View events', awToolTip: 'View events',
ngDisabled: "job.status == 'new'" ngDisabled: "job.status == 'new'"
@@ -86,31 +89,48 @@ angular.module('JobsListDefinition', [])
edit: { edit: {
label: 'Details', label: 'Details',
icon: 'icon-zoom-in', 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', "class": 'btn btn-default btn-xs',
awToolTip: 'View job details' 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: { rerun: {
icon: 'icon-retweet', label: 'Launch',
icon: 'icon-rocket',
mode: 'all', mode: 'all',
ngClick: "submitJob(\{\{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}' )", ngClick: "submitJob(\{\{ job.id \}\}, '\{\{ job.summary_fields.job_template.name \}\}' )",
"class": 'btn-success btn-xs', "class": 'btn-success btn-xs',
awToolTip: 'Re-run this job' awToolTip: 'Relaunch the job template, running it again from scratch'
}, },
cancel: { cancel: {
label: 'Cancel',
icon: 'icon-minus-sign', icon: 'icon-minus-sign',
mode: 'all', mode: 'all',
ngClick: 'deleteJob(\{\{ job.id \}\})', ngClick: 'deleteJob(\{\{ job.id \}\})',
"class": 'btn-danger btn-xs', "class": 'btn-danger btn-xs',
awToolTip: 'Cancel job', awToolTip: 'Cancel a running or pending job',
ngShow: "job.status == 'pending' || job.status == 'running'" ngShow: "job.status == 'pending' || job.status == 'running'"
}, },
"delete": { "delete": {
label: 'Delete',
icon: 'icon-trash', icon: 'icon-trash',
mode: 'all', mode: 'all',
ngClick: 'deleteJob(\{\{ job.id \}\})', ngClick: 'deleteJob(\{\{ job.id \}\})',
"class": 'btn-danger btn-xs', "class": 'btn-danger btn-xs',
awToolTip: 'Delete this job', awToolTip: 'Remove the selected job from the database',
ngShow: "job.status != 'pending' && job.status != 'running'" 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) { .factory('LoadBreadCrumbs', ['$rootScope', '$routeParams', '$location', function($rootScope, $routeParams, $location, Rest) {
return function(crumb) { return function(crumb) {
//Keep a list of path/title mappings. When we see /organizations/XX in the path, for example, //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. //we'll know the actual organization name it maps to.
console.log($rootScope.crumbCache);
if (crumb !== null && crumb !== undefined) { if (crumb !== null && crumb !== undefined) {
var found = false; var found = false;
for (var i=0; i < $rootScope.crumbCache.length; i++) { for (var i=0; i < $rootScope.crumbCache.length; i++) {