hide build output when pending
This commit is contained in:
parent
ad80facbbd
commit
77246cc9c9
2 changed files with 13 additions and 2 deletions
|
@ -75,13 +75,14 @@
|
|||
/**
|
||||
* BuildCtrl responsible for rendering a build.
|
||||
*/
|
||||
function BuildCtrl($scope, $routeParams, logs, builds, repos, users, feed) {
|
||||
function BuildCtrl($scope, $routeParams, $window, logs, builds, repos, users, feed) {
|
||||
|
||||
var step = parseInt($routeParams.step) || 1;
|
||||
var number = $routeParams.number;
|
||||
var owner = $routeParams.owner;
|
||||
var name = $routeParams.name;
|
||||
var fullName = owner+'/'+name;
|
||||
var tail = false;
|
||||
|
||||
// Initiates streaming a build.
|
||||
var stream = function() {
|
||||
|
@ -89,8 +90,13 @@
|
|||
var term = document.getElementById("term");
|
||||
term.innerHTML = "";
|
||||
|
||||
// subscribes to the build otuput.
|
||||
logs.subscribe(fullName, number, step, function(data){
|
||||
term.innerHTML += convert.toHtml(data)+"\n";
|
||||
if (tail) {
|
||||
// scrolls to the bottom of the page if enabled
|
||||
$window.scrollTo(0, $window.document.body.scrollHeight);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -149,6 +155,10 @@
|
|||
});
|
||||
};
|
||||
|
||||
$scope.tail = function() {
|
||||
tail = !tail;
|
||||
};
|
||||
|
||||
feed.subscribe(function(event) {
|
||||
if (event.repo.full_name !== fullName) {
|
||||
return; // ignore
|
||||
|
|
|
@ -57,7 +57,8 @@
|
|||
|
||||
<hr>
|
||||
|
||||
<pre id="term">{{ logs }}</pre>
|
||||
<button ng-if="build.state === 'running'" ng-click="tail()">(un)Follow</button>
|
||||
<pre id="term" ng-if="build.state !== 'pending'">{{ logs }}</pre>
|
||||
|
||||
<table border="1">
|
||||
<thead>
|
||||
|
|
Loading…
Reference in a new issue