Fix builds tab to reload if a new build comes in
This commit is contained in:
parent
c059856597
commit
6673d90818
1 changed files with 19 additions and 4 deletions
|
@ -58,14 +58,16 @@ angular.module('quay').directive('repoPanelBuilds', function () {
|
||||||
$scope.fullBuilds = orderBy(unordered, $scope.options.predicate, $scope.options.reverse);
|
$scope.fullBuilds = orderBy(unordered, $scope.options.predicate, $scope.options.reverse);
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadBuilds = function() {
|
var loadBuilds = function(opt_forcerefresh) {
|
||||||
if (!$scope.builds || !$scope.repository || !$scope.options.filter) {
|
if (!$scope.builds || !$scope.repository || !$scope.options.filter) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: We only refresh if the filter has changed.
|
// Note: We only refresh if the filter has changed.
|
||||||
var filter = $scope.options.filter;
|
var filter = $scope.options.filter;
|
||||||
if ($scope.buildsResource && filter == $scope.currentFilter) { return; }
|
if ($scope.buildsResource && filter == $scope.currentFilter && !opt_forcerefresh) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var since = null;
|
var since = null;
|
||||||
var limit = 10;
|
var limit = 10;
|
||||||
|
@ -105,17 +107,30 @@ angular.module('quay').directive('repoPanelBuilds', function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace any build records with updated records from the server.
|
// Replace any build records with updated records from the server.
|
||||||
|
var requireReload = false;
|
||||||
$scope.builds.map(function(build) {
|
$scope.builds.map(function(build) {
|
||||||
|
var found = false;
|
||||||
for (var i = 0; i < $scope.allBuilds.length; ++i) {
|
for (var i = 0; i < $scope.allBuilds.length; ++i) {
|
||||||
var current = $scope.allBuilds[i];
|
var current = $scope.allBuilds[i];
|
||||||
if (current.id == build.id && current.phase != build.phase) {
|
if (current.id == build.id && current.phase != build.phase) {
|
||||||
$scope.allBuilds[i] = build;
|
$scope.allBuilds[i] = build;
|
||||||
break
|
found = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the build was not found, then a new build has started. Reload
|
||||||
|
// the builds list.
|
||||||
|
if (!found) {
|
||||||
|
requireReload = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
updateBuilds();
|
if (requireReload) {
|
||||||
|
loadBuilds(/* force refresh */true);
|
||||||
|
} else {
|
||||||
|
updateBuilds();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadBuildTriggers = function() {
|
var loadBuildTriggers = function() {
|
||||||
|
|
Reference in a new issue