Jobs list on Job Templates detail page now closely matches the Jobs tab. Status looks the same, is clickable and offers matching tooltip.

This commit is contained in:
Chris Houseknecht
2013-11-05 22:28:31 +00:00
parent e701857594
commit 1497d128f3
4 changed files with 49 additions and 22 deletions

View File

@@ -292,7 +292,8 @@ JobTemplatesAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$l
function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm,
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList, CredentialList,
ProjectList, LookUpInit, PromptPasswords, GetBasePath, md5Setup, ParseTypeChange)
ProjectList, LookUpInit, PromptPasswords, GetBasePath, md5Setup, ParseTypeChange,
JobStatusToolTip, FormatDate)
{
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
@@ -389,6 +390,25 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
checkSCMStatus();
}
});
// Set the status/badge for each related job
if (scope.removeRelatedJobs) {
scope.removeRelatedJobs();
}
scope.removeRelatedJobs = scope.$on('relatedjobs', function() {
if (scope['jobs'] && scope['jobs'].length) {
var cDate;
for (var i=0; i < scope['jobs'].length; i++) {
// Convert created date to local time zone
cDate = new Date(scope['jobs'][i].created);
scope['jobs'][i].created = FormatDate(cDate);
// Set tooltip and link
scope['jobs'][i].statusBadgeToolTip = JobStatusToolTip(scope['jobs'][i].status) +
" Click to view status details.";
scope['jobs'][i].statusLinkTo = '/#/jobs/' + scope['jobs'][i].id;
}
}
});
// Retrieve each related set and populate the playbook list
if (scope.jobTemplateLoadedRemove) {
@@ -610,5 +630,6 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
JobTemplatesEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'JobTemplateForm',
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList',
'ProjectList', 'LookUpInit', 'PromptPasswords', 'GetBasePath', 'md5Setup', 'ParseTypeChange'
'ProjectList', 'LookUpInit', 'PromptPasswords', 'GetBasePath', 'md5Setup', 'ParseTypeChange',
'JobStatusToolTip', 'FormatDate'
];

View File

@@ -34,23 +34,18 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest,
scope[ngc] = "";
});
if (scope[list.name]) {
// Convert created date to local time zone
if (scope['jobs'] && scope['jobs'].length) {
var cDate;
for (var i=0; i < scope[list.name].length; i++) {
cDate = new Date(scope[list.name][i].created);
scope[list.name][i].created = FormatDate(cDate);
}
}
if (scope.jobs && scope.jobs.length) {
for (var i=0; i < scope.jobs.length; i++) {
for (var i=0; i < scope['jobs'].length; i++) {
// Convert created date to local time zone
cDate = new Date(scope['jobs'][i].created);
scope['jobs'][i].created = FormatDate(cDate);
// Set tooltip and link
scope.jobs[i].statusBadgeToolTip = JobStatusToolTip(scope.jobs[i].status) +
" Click to view status details.";
scope.jobs[i].statusLinkTo = '/#/jobs/' + scope.jobs[i].id;
}
}
});