mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Merge pull request #539 from mjschultz/add-follow
Add follow button to stdout
This commit is contained in:
commit
3d839498a1
5 changed files with 37 additions and 7 deletions
|
@ -273,15 +273,27 @@ app.controller("CommitController", function($scope, $http, $routeParams, stdout,
|
|||
var el = document.querySelector('#output');
|
||||
stdout.subscribe(data.id, function(out){
|
||||
angular.element(el).append(lineFormatter.format(out));
|
||||
if ($scope.following) {
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
}
|
||||
});
|
||||
}).
|
||||
error(function(data, status, headers, config) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
$scope.following = false;
|
||||
$scope.follow = function() {
|
||||
$scope.following = true;
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
}
|
||||
$scope.unfollow = function() {
|
||||
$scope.following = false;
|
||||
}
|
||||
|
||||
$scope.rebuildCommit = function() {
|
||||
$http({method: 'POST', url: '/api/repos/'+remote+'/'+owner+'/'+name+'/'+'branches/'+branch+'/'+'commits/'+commit+'/?action=rebuild' })
|
||||
$http({method: 'POST', url: '/api/repos/'+remote+'/'+owner+'/'+name+'/'+'branches/'+branch+'/'+'commits/'+commit+'?action=rebuild' })
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ angular.module('app').service('stdout', ['$window', function($window) {
|
|||
callback = _callback;
|
||||
|
||||
var proto = ($window.location.protocol == 'https:' ? 'wss' : 'ws');
|
||||
var route = [proto, "://", $window.location.host, '/api/feed/stdout/', path].join('');
|
||||
var route = [proto, "://", $window.location.host, '/api/stream/stdout/', path].join('');
|
||||
|
||||
websocket = new WebSocket(route);
|
||||
websocket.onmessage = function(event) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1315,6 +1315,21 @@ nav {
|
|||
line-height:18px;
|
||||
}
|
||||
|
||||
#follow button {
|
||||
position: fixed;
|
||||
right: 280px;
|
||||
bottom: 21px;
|
||||
z-index: 100;
|
||||
padding: 0 1em;
|
||||
border-radius: 7px;
|
||||
background-color: rgba(238, 238, 238, 0.2);
|
||||
padding: 0 1em;
|
||||
cursor: pointer;
|
||||
font-family: @sans;
|
||||
border: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&[data-result="Pending"]:after,
|
||||
&[data-result="Started"]:after {
|
||||
position: absolute;
|
||||
|
@ -1540,4 +1555,4 @@ nav {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,10 @@
|
|||
<span>/</span>
|
||||
<a href="#">{{ commit.sha | shortHash}}</a>
|
||||
</nav>
|
||||
|
||||
<div id="follow">
|
||||
<button ng-click="follow()" ng-if="following == false">follow</button>
|
||||
<button ng-click="unfollow()" ng-if="following == true">unfollow</button>
|
||||
</div>
|
||||
<pre id="output"></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue