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.
|
* 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 step = parseInt($routeParams.step) || 1;
|
||||||
var number = $routeParams.number;
|
var number = $routeParams.number;
|
||||||
var owner = $routeParams.owner;
|
var owner = $routeParams.owner;
|
||||||
var name = $routeParams.name;
|
var name = $routeParams.name;
|
||||||
var fullName = owner+'/'+name;
|
var fullName = owner+'/'+name;
|
||||||
|
var tail = false;
|
||||||
|
|
||||||
// Initiates streaming a build.
|
// Initiates streaming a build.
|
||||||
var stream = function() {
|
var stream = function() {
|
||||||
|
@ -89,8 +90,13 @@
|
||||||
var term = document.getElementById("term");
|
var term = document.getElementById("term");
|
||||||
term.innerHTML = "";
|
term.innerHTML = "";
|
||||||
|
|
||||||
|
// subscribes to the build otuput.
|
||||||
logs.subscribe(fullName, number, step, function(data){
|
logs.subscribe(fullName, number, step, function(data){
|
||||||
term.innerHTML += convert.toHtml(data)+"\n";
|
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) {
|
feed.subscribe(function(event) {
|
||||||
if (event.repo.full_name !== fullName) {
|
if (event.repo.full_name !== fullName) {
|
||||||
return; // ignore
|
return; // ignore
|
||||||
|
|
|
@ -57,7 +57,8 @@
|
||||||
|
|
||||||
<hr>
|
<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">
|
<table border="1">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
Loading…
Reference in a new issue