Add code for saving and displaying the size of images

This commit is contained in:
Joseph Schorr 2014-01-03 16:32:00 -05:00
parent 8e4bbdf1dd
commit 0a63690e25
7 changed files with 42 additions and 0 deletions

View file

@ -1025,6 +1025,17 @@ quayApp.directive('dockerAuthDialog', function () {
});
quayApp.filter('bytes', function() {
return function(bytes, precision) {
if (!bytes || isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});
quayApp.filter('visibleLogFilter', function () {
return function (logs, allowed) {
if (!allowed) {

View file

@ -124,6 +124,11 @@ sudo docker push quay.io/{{repo.namespace}}/{{repo.name}}</pre>
<dd am-time-ago="parseDate(currentImage.created)"></dd>
<dt>Image ID</dt>
<dd><a href="{{'/repository/' + repo.namespace + '/' + repo.name + '/image/' + currentImage.id}}">{{ currentImage.id }}</a></dd>
<dt>Compressed Image Size</dt>
<dd><span class="context-tooltip"
title="The amount of data sent between Docker and Quay.io when pushing/pulling"
bs-tooltip="tooltip.title" data-container="body">{{ currentImage.size | bytes }}</span>
</dd>
</dl>
<!-- Image changes loading -->