Get the tabs working and the UI for the image history. Note that the model changes for the image history are WRONG and need to be fixed

This commit is contained in:
Joseph Schorr 2013-09-27 17:01:45 -04:00
parent 94cba8a0bc
commit bf926aceee
5 changed files with 89 additions and 16 deletions

View file

@ -79,18 +79,20 @@ def update_repo_api(namespace, repository):
abort(404)
def image_view(image):
return {
'id': image.image_id,
'created': image.created,
'comment': image.comment,
}
@app.route('/api/repository/<path:repository>', methods=['GET'])
@login_required
@parse_repository_name
def get_repo_api(namespace, repository):
logger.debug('Get repo: %s/%s' % (namespace, repository))
def image_view(image):
return {
'id': image.image_id,
'created': image.created,
'comment': image.comment,
}
def tag_view(tag):
image = model.get_tag_image(namespace, repository, tag.name)
if not image:
@ -128,6 +130,21 @@ def role_view(repo_perm_obj):
}
@app.route('/api/repository/<path:repository>/tag/<tag>/images', methods=['GET'])
@login_required
@parse_repository_name
def list_tag_images(namespace, repository, tag):
permission = ReadRepositoryPermission(namespace, repository)
if permission.can():
images = model.get_tag_images(namespace, repository, tag)
return jsonify({
'images': [image_view(image) for image in images]
})
abort(403) # Permission denied
@app.route('/api/repository/<path:repository>/permissions/', methods=['GET'])
@login_required
@parse_repository_name