Merge pull request #482 from coreos-inc/builderrview

Fix auto-open of build error command
This commit is contained in:
josephschorr 2015-09-14 16:18:10 -04:00
commit dac5d54a5e

View file

@ -72,17 +72,16 @@ angular.module('quay').directive('buildLogsView', function () {
// Process the logs we've received.
$scope.logStartIndex = processLogs(logsData['logs'], logsData['start'], logsData['total']);
// If the build status is an error, open the last two log entries.
// If the build status is an error, automatically open the last command run.
var currentBuild = $scope.currentBuild;
if (currentBuild['phase'] == 'error' && $scope.logEntries.length > 1) {
var openLogEntries = function(entry) {
if (entry.logs) {
entry.logs.setVisible(true);
if (currentBuild['phase'] == 'error') {
for (var i = $scope.logEntries.length - 1; i >= 0; i--) {
var currentEntry = $scope.logEntries[i];
if (currentEntry['type'] == 'command') {
currentEntry['logs'].setVisible(true);
break;
}
};
openLogEntries($scope.logEntries[$scope.logEntries.length - 2]);
openLogEntries($scope.logEntries[$scope.logEntries.length - 1]);
}
}
// If the build phase is an error or a complete, then we mark the channel