Merge branch 'master' of ssh://bitbucket.org/yackob03/quay

This commit is contained in:
Jake Moshenko 2014-07-17 15:17:28 -04:00
commit 4726b9d6b2
4 changed files with 53 additions and 55 deletions

View file

@ -138,21 +138,6 @@ class RepositoryList(ApiResource):
return response
def image_view(image):
extended_props = image
if image.storage and image.storage.id:
extended_props = image.storage
command = extended_props.command
return {
'id': image.docker_image_id,
'created': format_date(extended_props.created),
'comment': extended_props.comment,
'command': json.loads(command) if command else None,
'ancestors': image.ancestors,
'dbid': image.id,
'size': extended_props.image_size
}
@resource('/v1/repository/<repopath:repository>')
class Repository(RepositoryParamResource):
@ -181,13 +166,10 @@ class Repository(RepositoryParamResource):
logger.debug('Get repo: %s/%s' % (namespace, repository))
def tag_view(tag):
image = model.get_tag_image(namespace, repository, tag.name)
if not image:
return {}
return {
'name': tag.name,
'image': image_view(image),
'image_id': tag.image.docker_image_id,
'dbid': tag.image.id
}
organization = None

View file

@ -4271,7 +4271,7 @@ quayApp.directive('dockerfileCommand', function () {
},
'': function(pieces) {
var rnamespace = pieces.length == 1 ? '_' : pieces[0];
var rnamespace = pieces.length == 1 ? '_' : 'u/' + pieces[0];
var rname = pieces[pieces.length - 1].split(':')[0];
return 'https://registry.hub.docker.com/' + rnamespace + '/' + rname + '/';
}

View file

@ -466,31 +466,6 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
addedDisplayed - removedDisplayed - changedDisplayed;
};
$scope.setImage = function(imageId, opt_updateURL) {
var image = null;
for (var i = 0; i < $scope.images.length; ++i) {
var currentImage = $scope.images[i];
if (currentImage.id == imageId || currentImage.id.substr(0, 12) == imageId) {
image = currentImage;
break;
}
}
if (!image) { return; }
$scope.currentTag = null;
$scope.currentImage = image;
$scope.loadImageChanges(image);
if ($scope.tree) {
$scope.tree.setImage(image.id);
}
if (opt_updateURL) {
$location.search('tag', null);
$location.search('image', imageId.substr(0, 12));
}
};
$scope.showAddTag = function(image) {
$scope.toTagImage = image;
$('#addTagModal').modal('show');
@ -513,6 +488,10 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
$('#confirmdeleteTagModal').modal('show');
};
$scope.findImageForTag = function(tag) {
return tag && $scope.imageByDBID && $scope.imageByDBID[tag.dbid];
};
$scope.createOrMoveTag = function(image, tagName, opt_invalid) {
if (opt_invalid) { return; }
@ -592,13 +571,38 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
return size;
};
$scope.setImage = function(imageId, opt_updateURL) {
var image = null;
for (var i = 0; i < $scope.images.length; ++i) {
var currentImage = $scope.images[i];
if (currentImage.id == imageId || currentImage.id.substr(0, 12) == imageId) {
image = currentImage;
break;
}
}
if (!image) { return; }
$scope.currentTag = null;
$scope.currentImage = image;
$scope.loadImageChanges(image);
if ($scope.tree) {
$scope.tree.setImage(image.id);
}
if (opt_updateURL) {
$location.search('tag', null);
$location.search('image', imageId.substr(0, 12));
}
};
$scope.setTag = function(tagName, opt_updateURL) {
var repo = $scope.repo;
if (!repo) { return; }
var proposedTag = repo.tags[tagName];
if (!proposedTag) {
// We must find a good default
// We must find a good default.
for (tagName in repo.tags) {
if (!proposedTag || tagName == 'latest') {
proposedTag = repo.tags[tagName];
@ -608,8 +612,8 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
if (proposedTag) {
$scope.currentTag = proposedTag;
$scope.currentImage = proposedTag.image;
$scope.loadImageChanges($scope.currentImage);
$scope.currentImage = null;
if ($scope.tree) {
$scope.tree.setTag(proposedTag.name);
}
@ -686,9 +690,14 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
var forAllTagImages = function(tag, callback) {
if (!tag || !$scope.imageByDBID) { return; }
callback(tag.image);
var tag_image = $scope.imageByDBID[tag.dbid];
if (!tag_image) { return; }
var ancestors = tag.image.ancestors.split('/');
// Callback the tag's image itself.
callback(tag_image);
// Callback any parent images.
var ancestors = tag_image.ancestors.split('/');
for (var i = 0; i < ancestors.length; ++i) {
var image = $scope.imageByDBID[ancestors[i]];
if (image) {

View file

@ -77,7 +77,7 @@
content-changed="updateForDescription" field-title="'repository description'"></div>
<!-- Empty message -->
<div class="repo-content" ng-show="!currentTag.image && !currentImage && !repo.is_building">
<div class="repo-content" ng-show="!currentTag.image_id && !currentImage && !repo.is_building">
<div class="empty-message">
This repository is empty
</div>
@ -100,14 +100,14 @@
</div>
<div class="repo-content" ng-show="!currentTag.image && repo.is_building">
<div class="repo-content" ng-show="!currentTag.image_id && repo.is_building">
<div class="empty-message">
A build is currently processing. If this takes longer than an hour, please <a href="/contact">contact us</a>
</div>
</div>
<!-- Content view -->
<div class="repo-content" ng-show="currentTag.image || currentImage">
<div class="repo-content" ng-show="currentTag.image_id || currentImage">
<!-- Image History -->
<div id="image-history" style="max-height: 10px;">
<div class="row">
@ -163,7 +163,14 @@
<div id="current-tag" ng-show="currentTag">
<dl class="dl-normal">
<dt>Last Modified</dt>
<dd am-time-ago="parseDate(currentTag.image.created)"></dd>
<dd ng-if="!findImageForTag(currentTag, images)">
<span class="quay-spinner"></span>
</dd>
<dd am-time-ago="parseDate(findImageForTag(currentTag, images).created)"
ng-if="findImageForTag(currentTag, images)">
</dd>
<dt>Total Compressed Size</dt>
<dd><span class="context-tooltip"
data-title="The amount of data sent between Docker and Quay.io when pushing/pulling"