diff --git a/static/js/controllers.js b/static/js/controllers.js index 654490026..66229fa79 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -729,7 +729,7 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope $scope.commands = null; $scope.commandMap = {}; $scope.logs = null; - $scope.logStartIndex = 0; + $scope.logStartIndex = null; $scope.currentBuild = build; if (opt_updateURL) { @@ -746,6 +746,9 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope $scope.adjustLogHeight(); }, 1); + // Load the first set of logs. + getBuildStatusAndLogs(); + // If the build is currently processing, start the build timer. checkPollTimer(); }; @@ -789,7 +792,8 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope for (var i = 0; i < logs.length; ++i) { var entry = logs[i]; if (entry['is_command']) { - var existing = $scope.commandMap[entry['message']]; + var index = startIndex + i; + var existing = $scope.commandMap[index]; if (existing) { currentCommand = existing; continue; @@ -797,12 +801,13 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope currentCommand = { 'message': entry['message'], - 'index': startIndex + i + 'index': index }; $scope.commands.push(currentCommand); - $scope.commandMap[entry['message']] = currentCommand; + $scope.commandMap[index] = currentCommand; continue; } + if (!currentCommand.logs) { currentCommand.logs = []; }