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) {