diff --git a/src/tags/app.tag b/src/tags/app.tag index c825e42..4cd772c 100644 --- a/src/tags/app.tag +++ b/src/tags/app.tag @@ -222,6 +222,17 @@ along with this program. If not, see . oReq.setRequestHeader('Accept', 'application/vnd.docker.distribution.manifest.v2+json'); oReq.send(); }; + + registryUI.bytesToSize = function (bytes) { + var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; + if (bytes == undefined || isNaN(bytes)) { + return '?'; + } else if (bytes == 0) { + return '0 Byte'; + } + var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); + return Math.ceil(bytes / Math.pow(1024, i)) + ' ' + sizes[i]; + }; route.start(true); \ No newline at end of file diff --git a/src/tags/image-size.tag b/src/tags/image-size.tag index bd3443a..0f7d1cd 100644 --- a/src/tags/image-size.tag +++ b/src/tags/image-size.tag @@ -15,19 +15,9 @@ along with this program. If not, see . --> -
{ this.bytesToSize(this.size) }
+
{ registryUI.bytesToSize(this.size) }