Job detail page refactor

Fixed failed filter reset.
This commit is contained in:
Chris Houseknecht
2014-06-20 13:04:12 -04:00
parent e6cf440511
commit b0a03697b6

View File

@@ -1000,19 +1000,21 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
}; };
scope.filterByStatus = function(choice) { scope.filterByStatus = function(choice) {
var key, keys, nxtPlay; var nxtPlay;
if (choice === 'Failed') { if (choice === 'Failed') {
scope.searchAllStatus = 'failed'; scope.searchAllStatus = 'failed';
for(key in scope.plays) { nxtPlay = null;
if (scope.plays[key].status === 'failed') { scope.plays.every(function(play) {
nxtPlay = key; if (play.status === 'failed') {
nxtPlay = play.id;
return false;
} }
} return true;
});
} }
else { else {
scope.searchAllStatus = ''; scope.searchAllStatus = '';
keys = Object.keys(scope.plays); nxtPlay = (scope.plays.length > 0) ? scope.plays[0].id : null;
nxtPlay = (keys.length > 0) ? keys[keys.length - 1] : null;
} }
SelectPlay({ SelectPlay({
scope: scope, scope: scope,