mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-29 20:00:30 +00:00
Make live updates to the commits without needing to reload
This commit is contained in:
parent
aed6f17db6
commit
217cf0bc23
1 changed files with 12 additions and 0 deletions
|
@ -14,6 +14,18 @@ angular.module('app').controller("RepoController", function($scope, $http, $rout
|
|||
// 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 new commit if the SHA couldn't be found but the new build status is 'Started'
|
||||
if ( ! sha_updated && item.commit.status == 'Started')
|
||||
$scope.commits.unshift(item.commit);
|
||||
|
||||
$scope.$apply();
|
||||
} else {
|
||||
// we trigger a toast (or html5) notification so the
|
||||
|
|
Loading…
Reference in a new issue