mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-05 10:20:36 +02:00
Make live updates to the commits without needing to reload
This commit is contained in:
parent
aed6f17db6
commit
217cf0bc23
@ -14,6 +14,18 @@ angular.module('app').controller("RepoController", function($scope, $http, $rout
|
|||||||
// commit details, allowing the user to
|
// commit details, allowing the user to
|
||||||
// reload the page.
|
// reload the page.
|
||||||
$scope.msg = item;
|
$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();
|
$scope.$apply();
|
||||||
} else {
|
} else {
|
||||||
// we trigger a toast (or html5) notification so the
|
// we trigger a toast (or html5) notification so the
|
||||||
|
Loading…
Reference in New Issue
Block a user