Merge master into bitbucket

This commit is contained in:
Joseph Schorr 2015-04-30 15:52:08 -04:00
commit b96e35b28c
44 changed files with 695 additions and 110 deletions

View file

@ -57,14 +57,16 @@ angular.module('quay').directive('repoPanelBuilds', function () {
$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) {
return;
}
// Note: We only refresh if the filter has changed.
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 limit = 10;
@ -104,17 +106,30 @@ angular.module('quay').directive('repoPanelBuilds', function () {
}
// Replace any build records with updated records from the server.
var requireReload = false;
$scope.builds.map(function(build) {
var found = false;
for (var i = 0; i < $scope.allBuilds.length; ++i) {
var current = $scope.allBuilds[i];
if (current.id == build.id && current.phase != build.phase) {
$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() {

View file

@ -96,20 +96,24 @@ angular.module('quay').directive('repoPanelChanges', function () {
'isEnabled': '=isEnabled'
},
controller: function($scope, $element, $timeout, ApiService, UtilService, ImageMetadataService) {
$scope.tagNames = [];
var update = function() {
if (!$scope.repository || !$scope.selectedTags) { return; }
if (!$scope.repository || !$scope.isEnabled) { return; }
$scope.tagNames = Object.keys($scope.repository.tags);
$scope.currentImage = null;
$scope.currentTag = null;
if (!$scope.tracker) {
if ($scope.tracker) {
refreshTree();
} else {
updateImages();
}
};
var updateImages = function() {
if (!$scope.repository || !$scope.images) { return; }
if (!$scope.repository || !$scope.images || !$scope.isEnabled) { return; }
$scope.tracker = new RepositoryImageTracker($scope.repository, $scope.images);
@ -120,16 +124,17 @@ angular.module('quay').directive('repoPanelChanges', function () {
$scope.$watch('selectedTags', update)
$scope.$watch('repository', update);
$scope.$watch('isEnabled', update);
$scope.$watch('images', updateImages);
$scope.$watch('isEnabled', function(isEnabled) {
if (isEnabled) {
refreshTree();
}
});
$scope.updateState = function() {
update();
};
var refreshTree = function() {
if (!$scope.repository || !$scope.images) { return; }
if (!$scope.repository || !$scope.images || !$scope.isEnabled) { return; }
if ($scope.selectedTags.length < 1) { return; }
$('#image-history-container').empty();
@ -149,6 +154,7 @@ angular.module('quay').directive('repoPanelChanges', function () {
// Give enough time for the UI to be drawn before we resize the tree.
$timeout(function() {
$scope.tree.notifyResized();
$scope.setTag($scope.selectedTags[0]);
}, 100);
// Listen for changes to the selected tag and image in the tree.