Commit 58b9cb37 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Proper display of vms associated with deleted images

parent ee23002a
......@@ -9,6 +9,8 @@ div.list table thead tr th {
}
span.vm-detail { font-size: 0.9em !important }
/*vm views fixes*/
div.vm-details {
width: 135px;
......
......@@ -22,7 +22,9 @@
},
get_readable_size: function() {
return this.get('size') > 0 ? util.readablizeBytes(this.get('size')) : "unknown";
var unknown_title = snf.config.image_deleted_size_title || "(none)";
if (this.is_deleted()) { return unknown_title }
return this.get('size') > 0 ? util.readablizeBytes(this.get('size')) : unknown_title;
},
display_size: function() {
......
......@@ -240,9 +240,12 @@
return owner;
}
},
get_readable_size: function() {
return this.get_size() > 0 ? util.readablizeBytes(this.get_size() * 1024 * 1024) : "unknown";
if (this.is_deleted()) {
return synnefo.config.image_deleted_size_title || '(none)';
}
return this.get_size() > 0 ? util.readablizeBytes(this.get_size() * 1024 * 1024) : '(none)';
},
get_os: function() {
......@@ -267,6 +270,10 @@
is_public: function() {
return this.get('is_public') || true;
},
is_deleted: function() {
return this.get('status') == "DELETED"
},
ssh_keys_path: function() {
prepend = '';
......@@ -1584,8 +1591,9 @@
callback(this.get(id));
}, this));
} else {
var title = synnefo.config.image_deleted_title || 'Deleted';
// else add a dummy DELETED state image entry
this.add({id:id, name:"Unknown image", size:-1,
this.add({id:id, name:title, size:-1,
progress:100, status:"DELETED"});
callback(this.get(id));
}
......@@ -1594,7 +1602,8 @@
}
}, this), _.bind(function(image, msg, xhr) {
if (!image) {
this.add({id:id, name:"Unknown image", size:-1,
var title = synnefo.config.image_deleted_title || 'Deleted';
this.add({id:id, name:title, size:-1,
progress:100, status:"DELETED"});
callback(this.get(id));
return;
......
......@@ -583,7 +583,7 @@
if (!this.visible() && this.parent.details_hidden) { return };
var image = this.vm.get_image(_.bind(function(image){
this.sel('image_name').text(util.truncate(image.escape('name'), 13)).attr("title", image.escape('name'));
this.sel('image_name').text(util.truncate(image.escape('name'), 17)).attr("title", image.escape('name'));
this.sel('image_size').text(image.get_readable_size()).attr('title', image.get_readable_size());
}, this));
......
......@@ -579,6 +579,8 @@ We welcome any suggestions, questions and bug reports you may have.{% endblocktr
synnefo.config.media_url = '{{ UI_MEDIA_URL }}';
synnefo.config.js_url = '{{ SYNNEFO_JS_URL }}';
synnefo.config.images_url = '{{ SYNNEFO_IMAGES_URL }}';
synnefo.config.image_deleted_title = {{ image_deleted_title|safe }};
synnefo.config.image_deleted_size_title = {{ image_deleted_size_title|safe }};
synnefo.config.use_glance = {{ use_glance }};
synnefo.config.indicators_icons_url = '{{ SYNNEFO_IMAGES_URL }}icons/indicators/';
synnefo.config.machines_icons_url = '{{ SYNNEFO_IMAGES_URL }}icons/machines/';
......
......@@ -74,6 +74,10 @@ SUGGESTED_ROLES_DEFAULT = ["Database server", "File server", "Mail server",
SUGGESTED_ROLES = getattr(settings, "VM_CREATE_SUGGESTED_ROLES",
SUGGESTED_ROLES_DEFAULT)
IMAGE_ICONS = settings.IMAGE_ICONS
IMAGE_DELETED_TITLE = getattr(settings, 'UI_IMAGE_DELETED_TITLE',
'(deleted image)')
IMAGE_DELETED_SIZE_TITLE = getattr(settings, 'UI_IMAGE_DELETED_SIZE_TITLE',
'(none)')
SUPPORT_SSH_OS_LIST = getattr(settings, "UI_SUPPORT_SSH_OS_LIST",)
OS_CREATED_USERS = getattr(settings, "UI_OS_DEFAULT_USER_MAP")
......@@ -163,7 +167,9 @@ def home(request):
'userdata_keys_limit': json.dumps(MAX_SSH_KEYS_PER_USER),
'use_glance': json.dumps(ENABLE_GLANCE),
'glance_api_url': json.dumps(GLANCE_API_URL),
'system_images_owners': json.dumps(SYSTEM_IMAGES_OWNERS)
'system_images_owners': json.dumps(SYSTEM_IMAGES_OWNERS),
'image_deleted_title': json.dumps(IMAGE_DELETED_TITLE),
'image_deleted_size_title': json.dumps(IMAGE_DELETED_SIZE_TITLE),
}
return template('home', request, context)
......
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