Bug 1182068 - Load log content in Logviewer by default

This commit is contained in:
Jonathan French 2015-07-29 14:39:08 -04:00
Родитель 1c00ccfcc7
Коммит 7fed6e575e
4 изменённых файлов: 24 добавлений и 16 удалений

Просмотреть файл

@ -177,14 +177,6 @@ body {
font-size: 11px;
}
.lv-log-msg-step {
padding: 2px 5px;
background: #fff;
border-style: solid;
border-width: 4px 2px 2px;
border-radius: 2px;
}
.lv-log-overlay {
padding: 6px;
border: 2px solid #4cae4c;

Просмотреть файл

@ -212,11 +212,30 @@ logViewerApp.controller('LogviewerCtrl', [
});
});
// Make the log and job artifacts available
ThJobArtifactModel.get_list({job_id: $scope.job_id, name__in: 'text_log_summary,Job Info'})
.then(function(artifactList) {
artifactList.forEach(function(artifact) {
if (artifact.name === 'text_log_summary') {
$scope.artifact = artifact.blob;
$scope.step_data = artifact.blob.step_data;
// If the log contains no errors load the head otherwise
// load the first failure step line in the artifact. We
// also need to test for the 0th element for outlier jobs.
if ($scope.step_data.steps[0]) {
if ($scope.step_data.all_errors.length == 0) {
angular.element(document).ready(function () {
$scope.displayLog($scope.step_data.steps[0], 'initialLoad');
});
} else {
$timeout(function() {
angular.element('.lv-error-line').first().trigger('click');
}, 100);
}
}
} else if (artifact.name === 'Job Info') {
$scope.job_details = artifact.blob.job_details;
}

Просмотреть файл

@ -59,7 +59,7 @@ treeherder.directive('lvLogSteps', ['$timeout', '$q', function ($timeout, $q) {
});
};
scope.displayLog = function(step) {
scope.displayLog = function(step, state) {
scope.displayedStep = step;
scope.currentLineNumber = step.started_linenumber;
@ -67,8 +67,10 @@ treeherder.directive('lvLogSteps', ['$timeout', '$q', function ($timeout, $q) {
$timeout(function () {
var raw = $('.lv-log-container')[0];
var line = $('.lv-log-line[line="' + step.started_linenumber + '"]');
raw.scrollTop += line.offset().top - $('.run-data').outerHeight() -
$('.navbar').outerHeight() - 9;
if (state !== 'initialLoad') {
raw.scrollTop += line.offset().top - $('.run-data').outerHeight() -
$('.navbar').outerHeight() - 9;
}
});
});
};

Просмотреть файл

@ -1,8 +1,3 @@
<div class="lv-log-msg"
ng-if="!loading && !logError && displayedLogLines.length == 0">
Click a <span class="{{::resultStatusShading}} lv-log-msg-step">log step</span> above to view
</div>
<div class="lv-log-msg lv-log-overlay"
ng-if="loading"> Loading... </div>