Commit 44daa7c7 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Consistent image size display in UI, Refs #1487

parent 4696df73
......@@ -150,6 +150,10 @@
return parseInt(this.get('metadata') ? this.get('metadata').values.size : -1)
},
get_readable_size: function() {
return this.get_size() > 0 ? util.readablizeBytes(this.get_size() * 1024 * 1024) : "unknown";
},
get_os: function() {
return this.get("OS");
},
......
......@@ -217,7 +217,8 @@
this.image_details_os.text(_(image.get("OS")).capitalize());
this.image_details_kernel.text(image.get("kernel"));
var size = util.readablizeBytes(parseInt(image.get("size")) * 1024 * 1024);
var size = image.get_readable_size();
this.image_details_size.text(size);
this.image_details_gui.text(image.get("GUI"));
......@@ -258,7 +259,7 @@
'</span></li>').format(img.get("name"),
img.id,
snf.ui.helpers.os_icon_tag(img.get("OS")),
util.readablizeBytes(parseInt(img.get("size"))* 1024 * 1024),
img.get_readable_size(),
util.truncate(img.get("description"),35)));
image.data("image", img);
image.data("image_id", img.id);
......@@ -630,7 +631,7 @@
set_detail("name");
set_detail("os", _(image.get("OS")).capitalize());
set_detail("gui", image.get("GUI"));
set_detail("size", util.readablizeBytes(image.get_size() * 1024 * 1024));
set_detail("size", image.get_readable_size());
set_detail("kernel");
},
......
......@@ -554,7 +554,7 @@
}
this.sel('image_name').text(util.truncate(image.get('name'), 13)).attr("title", image.get('name'));
this.sel('image_size').text(image.get('metadata').values.size).attr('title', image.get('metadata').values.size);
this.sel('image_size').text(image.get_readable_size()).attr('title', image.get_readable_size());
this.sel('cpu').text(flavor.get('cpu'));
this.sel('ram').text(flavor.get('ram'));
......
......@@ -56,7 +56,7 @@
</div>
<div class="image-details">
<span class="vm-detail"><span class="key">{% trans "Image" %}:</span> <span class="value"><span class="image-data">Debian</span></span></span>
<span class="vm-detail"><span class="key">{% trans "Image Size" %}:</span> <span class="value"><span class="image-size-data">2.3</span>MB</span></span>
<span class="vm-detail"><span class="key">{% trans "Image Size" %}:</span> <span class="value"><span class="image-size-data">2.3</span></span></span>
</div>
</div>
<div class="vm-stats metadata-column">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment