diff --git a/static/js/app.js b/static/js/app.js index 3a3b8ca5b..93d05658d 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1143,6 +1143,13 @@ quayApp.directive('dockerAuthDialog', function () { }); +quayApp.filter('reverse', function() { + return function(items) { + return items.slice().reverse(); + }; +}); + + quayApp.filter('bytes', function() { return function(bytes, precision) { if (!bytes || isNaN(parseFloat(bytes)) || !isFinite(bytes)) return 'Unknown'; diff --git a/static/js/controllers.js b/static/js/controllers.js index b9bd66bfc..2b9cf5aed 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -827,7 +827,7 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope // Find the build. for (var i = 0; i < $scope.builds.length; ++i) { if ($scope.builds[i].id == buildId) { - $scope.setCurrentBuildInternal($scope.builds[i], opt_updateURL); + $scope.setCurrentBuildInternal(i, $scope.builds[i], opt_updateURL); return; } } @@ -843,7 +843,7 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope return setup + stream + teardown; }; - $scope.setCurrentBuildInternal = function(build, opt_updateURL) { + $scope.setCurrentBuildInternal = function(index, build, opt_updateURL) { if (build == $scope.currentBuild) { return; } stopPollTimer(); @@ -853,6 +853,7 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope $scope.currentParentEntry = null; $scope.currentBuild = build; + $scope.currentBuildIndex = index; if (opt_updateURL) { if (build) { @@ -934,7 +935,7 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope ApiService.getRepoBuildStatus(null, params, true).then(function(resp) { // Note: We use extend here rather than replacing as Angular is depending on the // root build object to remain the same object. - $.extend(true, $scope.currentBuild, resp); + $.extend(true, $scope.builds[$scope.currentBuildIndex], resp); checkPollTimer(); // Load the updated logs for the build. @@ -985,7 +986,7 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope if ($location.search().current) { $scope.setCurrentBuild($location.search().current, false); } else if ($scope.builds.length > 0) { - $scope.setCurrentBuild($scope.builds[0].id, true); + $scope.setCurrentBuild($scope.builds[$scope.builds.length - 1].id, true); } }); }; diff --git a/static/partials/repo-build.html b/static/partials/repo-build.html index 8f04b8619..c660189a3 100644 --- a/static/partials/repo-build.html +++ b/static/partials/repo-build.html @@ -19,7 +19,7 @@