Failed jobs link on Inventories tab list now works. Clicking takes user to Jobs tab, filters jobs by Inventory ID and sorts by Status (so that failed jobs appear first in list).

This commit is contained in:
chouseknecht 2013-06-24 13:11:34 -04:00
parent cbc9f18366
commit 13b8b68449
7 changed files with 48 additions and 20 deletions

View File

@ -520,6 +520,6 @@
text-rendering: optimizeLegibility;
}
.modal-body {
#form-modal-body, #password-body {
padding-top: 30px;
}

View File

@ -150,6 +150,11 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
}
}
}
// Failed jobs link. Go to the jobs tabs, find all jobs for the inventory and sort by status
scope.viewJobs = function(id) {
$location.url('/jobs/?inventory__int=' + id + '&order_by=status');
}
}
InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList',

View File

@ -36,8 +36,20 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest,
SearchInit({ scope: scope, set: 'jobs', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl });
// Called from Inventories page, failed jobs link. Find jobs for selected inventory.
if ($routeParams['inventory__int']) {
scope[list.iterator + 'SearchField'] = 'inventory';
scope[list.iterator + 'SearchValue'] = $routeParams['inventory__int'];
scope[list.iterator + 'SearchFieldLabel'] = 'Inventory';
}
scope.search(list.iterator);
// Called from Inventories page, failed jobs link. Now sort by status so faild jobs appear at top of list
if ($routeParams.order_by) {
scope.sort($routeParams.order_by);
}
LoadBreadCrumbs();
scope.refreshJob = function() {

View File

@ -145,8 +145,9 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|| list.fields[scope[iterator + 'SearchField']].searchType == 'select') ) {
scope[iterator + 'SearchParams'] += scope[iterator + 'SearchSelectValue'].value;
}
else if ( list.fields[scope[iterator + 'SearchField']].searchType == undefined ||
list.fields[scope[iterator + 'SearchField']].searchType == 'gtzero' ) {
else {
//if ( list.fields[scope[iterator + 'SearchField']].searchType == undefined ||
// list.fields[scope[iterator + 'SearchField']].searchType == 'gtzero' ) {
scope[iterator + 'SearchParams'] += escape(scope[iterator + 'SearchValue']);
}
scope[iterator + 'SearchParams'] += (sort_order) ? '&order_by=' + escape(sort_order) : '';

View File

@ -39,6 +39,7 @@ angular.module('InventoriesListDefinition', [])
ngShow: "\{\{ inventory.has_active_failures \}\}",
icon: 'icon-exclamation-sign',
"class": 'active-failures-\{\{ inventory.has_active_failures \}\}',
ngClick: 'viewJobs(\{\{ inventory.id \}\})',
searchField: 'has_active_failures',
searchType: 'boolean',
searchOptions: [{ name: "No", value: 0 }, { name: "Yes", value: 1 }]

View File

@ -23,6 +23,11 @@ angular.module('JobsListDefinition', [])
key: true,
desc: true,
searchType: 'int'
},
inventory: {
label: 'Inventory ID',
searchType: 'int',
searchOnly: true
},
name: {
label: 'Name',

View File

@ -153,27 +153,29 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
html += "<th>#</th>\n";
}
for (var fld in list.fields) {
html += "<th class=\"list-header\" id=\"";
html += (list.fields[fld].id) ? list.fields[fld].id : fld + "-header";
html += "\"";
html += (list.fields[fld].nosort === undefined || list.fields[fld].nosort !== true) ? "ng-click=\"sort('" + fld + "')\"" : "";
html += ">" + list.fields[fld].label;
if (list.fields[fld].nosort === undefined || list.fields[fld].nosort !== true) {
html += " <i class=\"";
if (list.fields[fld].key) {
if (list.fields[fld].desc) {
html += "icon-sort-down";
if (list.fields[fld].searchOnly == undefined || list.fields[fld].searchOnly == false) {
html += "<th class=\"list-header\" id=\"";
html += (list.fields[fld].id) ? list.fields[fld].id : fld + "-header";
html += "\"";
html += (list.fields[fld].nosort === undefined || list.fields[fld].nosort !== true) ? "ng-click=\"sort('" + fld + "')\"" : "";
html += ">" + list.fields[fld].label;
if (list.fields[fld].nosort === undefined || list.fields[fld].nosort !== true) {
html += " <i class=\"";
if (list.fields[fld].key) {
if (list.fields[fld].desc) {
html += "icon-sort-down";
}
else {
html += "icon-sort-up";
}
}
else {
html += "icon-sort-up";
html += "icon-sort";
}
html += "\"></i></a>";
}
else {
html += "icon-sort";
}
html += "\"></i></a>";
html += "</th>\n";
}
html += "</th>\n";
}
if (options.mode == 'select') {
html += "<th>Select</th>";
@ -199,7 +201,9 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
base = base.replace(/^\//,'');
for (fld in list.fields) {
cnt++;
html += Column({ list: list, fld: fld, options: options, base: base });
if (list.fields[fld].searchOnly == undefined || list.fields[fld].searchOnly == false) {
html += Column({ list: list, fld: fld, options: options, base: base });
}
}
if (options.mode == 'select' ) {