From a518a7ed3ebffa7d8e626ff1886bb0e4bc0fc035 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 15 Apr 2014 13:56:31 -0400 Subject: [PATCH] Have the last log entries open in the Dockerfile build view when an error occurred --- static/js/controllers.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/static/js/controllers.js b/static/js/controllers.js index 012e83506..517273ddd 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -1094,6 +1094,7 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope // 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.builds[$scope.currentBuildIndex], resp); + var currentBuild = $scope.builds[$scope.currentBuildIndex]; checkPollTimer(); // Load the updated logs for the build. @@ -1110,6 +1111,18 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope processLogs(resp['logs'], resp['start']); $scope.logStartIndex = resp['total']; $scope.polling = false; + + // If the build status is an error, open the last two log entries. + if (currentBuild['phase'] == 'error' && $scope.logEntries.length > 1) { + var openLogEntries = function(entry) { + if (entry.logs) { + entry.logs.setVisible(true); + } + }; + + openLogEntries($scope.logEntries[$scope.logEntries.length - 2]); + openLogEntries($scope.logEntries[$scope.logEntries.length - 1]); + } }, function() { $scope.polling = false; });