mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 10:21:00 +00:00
Merge pull request #832 from andy-g/live_commit_update
Make live updates to the commits (repo controller) without needing to reload
This commit is contained in:
commit
350d056d34
1 changed files with 14 additions and 1 deletions
|
@ -13,7 +13,20 @@ angular.module('app').controller("RepoController", function($scope, $http, $rout
|
|||
// display a toast message with the
|
||||
// commit details, allowing the user to
|
||||
// reload the page.
|
||||
$scope.msg = item;
|
||||
|
||||
// Try find an existing commit for this SHA. If found, replace it
|
||||
var sha_updated = $scope.commits.some(function(element, index) {
|
||||
if (element.sha == item.commit.sha)
|
||||
$scope.commits[index] = item.commit;
|
||||
return element.sha == item.commit.sha;
|
||||
});
|
||||
|
||||
// Add a build message if the SHA couldn't be found and the new build status is 'Started'
|
||||
if ( ! sha_updated && item.commit.status == 'Started') {
|
||||
// $scope.commits.unshift(item.commit);
|
||||
$scope.msg = item;
|
||||
}
|
||||
|
||||
$scope.$apply();
|
||||
} else {
|
||||
// we trigger a toast (or html5) notification so the
|
||||
|
|
Loading…
Reference in a new issue