Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Brad Rydzewski 2014-10-26 10:17:28 -07:00
commit 9dfc3ca558
4 changed files with 30 additions and 12 deletions

View file

@ -226,7 +226,7 @@ app.controller("AccountReposController", function($scope, $http, user) {
}); });
app.controller("CommitController", function($scope, $http, $routeParams, stdout, feed) { app.controller("CommitController", function($scope, $http, $route, $routeParams, stdout, feed) {
var remote = $routeParams.remote; var remote = $routeParams.remote;
var owner = $routeParams.owner; var owner = $routeParams.owner;
@ -235,11 +235,29 @@ app.controller("CommitController", function($scope, $http, $routeParams, stdout,
var commit = $routeParams.commit; var commit = $routeParams.commit;
$scope.console=''; $scope.console='';
var handleOutput = function(id, clearConsole) {
var lineFormatter = new Drone.LineFormatter();
var el = document.querySelector('#output');
if(clearConsole === true) {
el.innerHTML = '';
}
stdout.subscribe(id, function(out){
angular.element(el).append(lineFormatter.format(out));
if ($scope.following) {
window.scrollTo(0, document.body.scrollHeight);
}
});
}
feed.subscribe(function(item) { feed.subscribe(function(item) {
if (item.commit.sha == commit && if (item.commit.sha == commit &&
item.commit.branch == branch) { item.commit.branch == branch) {
if(item.commit.status == "Started") {
handleOutput(item.commit.id, true);
}
$scope.commit = item.commit; $scope.commit = item.commit;
$scope.$apply(); $scope.$apply();
} else { } else {
// we trigger an toast notification so the // we trigger an toast notification so the
// user is aware another build started // user is aware another build started
@ -274,14 +292,8 @@ app.controller("CommitController", function($scope, $http, $routeParams, stdout,
return; return;
} }
var lineFormatter = new Drone.LineFormatter(); handleOutput(data.id, false);
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) { error(function(data, status, headers, config) {
console.log(data); console.log(data);
@ -297,7 +309,7 @@ app.controller("CommitController", function($scope, $http, $routeParams, stdout,
} }
$scope.rebuildCommit = function() { $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' });
} }

View file

@ -37,7 +37,7 @@
<div id="main" class="output"> <div id="main" class="output">
<div id="main" class="output" data-result="{{ commit.status }}"> <div id="main" class="output" data-result="{{ commit.status }}">
<nav> <nav>
<div class="options ng-scope" ng-if="repo.role.admin || repo.role.write"> <div class="options ng-scope" ng-if="(repo.role.admin || repo.role.write) && (commit.status != 'Started' && commit.status != 'Pending')">
<a class="pure-button pure-button-primary" ng-click="rebuildCommit()" href="#"> <a class="pure-button pure-button-primary" ng-click="rebuildCommit()" href="#">
<i class="fa fa-refresh"></i> <i class="fa fa-refresh"></i>
<span>Rebuild</span> <span>Rebuild</span>

View file

@ -68,7 +68,7 @@ func (d *Docker) Do(c context.Context, r *worker.Work) {
commitc := pubsub.Register(c, "_global") commitc := pubsub.Register(c, "_global")
commitc.Publish(r) commitc.Publish(r)
stdoutc := pubsub.RegisterOpts(c, r.Commit.ID, pubsub.ConsoleOpts) stdoutc := pubsub.RegisterOpts(c, r.Commit.ID, pubsub.ConsoleOpts)
defer stdoutc.Close() defer pubsub.Unregister(c, r.Commit.ID)
// create a special buffer that will also // create a special buffer that will also
// write to a websocket channel // write to a websocket channel

View file

@ -50,6 +50,8 @@ func (r *Repo) IsRemote() bool {
return true return true
case strings.HasPrefix(r.Path, "git@"): case strings.HasPrefix(r.Path, "git@"):
return true return true
case strings.HasPrefix(r.Path, "gitlab@"):
return true
case strings.HasPrefix(r.Path, "http://"): case strings.HasPrefix(r.Path, "http://"):
return true return true
case strings.HasPrefix(r.Path, "https://"): case strings.HasPrefix(r.Path, "https://"):
@ -77,6 +79,10 @@ func (r *Repo) IsGit() bool {
return true return true
case strings.HasPrefix(r.Path, "ssh://git@"): case strings.HasPrefix(r.Path, "ssh://git@"):
return true return true
case strings.HasPrefix(r.Path, "gitlab@"):
return true
case strings.HasPrefix(r.Path, "ssh://gitlab@"):
return true
case strings.HasPrefix(r.Path, "https://github"): case strings.HasPrefix(r.Path, "https://github"):
return true return true
case strings.HasPrefix(r.Path, "http://github"): case strings.HasPrefix(r.Path, "http://github"):