Commit ed8fe7ac authored by Kostas Papadimitriou's avatar Kostas Papadimitriou Committed by Christos Stavrakakis
Browse files

ui: Separate image/snapshot menu in vm wizard

Conflicts:

	snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_create_view.js
	snf-cyclades-app/synnefo/ui/templates/partials/create_vm.html
parent 11b46d61
......@@ -68,9 +68,8 @@
type_selections: {'personal':'My images',
'shared': 'Shared with me',
'public': 'Public',
'snapshot': 'Snapshots'},
type_selections_order: ['system', 'personal', 'shared', 'public', 'snapshot'],
'public': 'Public'},
type_selections_order: ['system', 'personal', 'shared', 'public'],
display_metadata: ['size', 'users', 'osfamily', 'status', 'created_at', 'updated_at',
'filename', 'format', 'root_partition'],
meta_labels: {'OS':'OS', 'osfamily':'OS Family', 'GUI':'GUI'},
......@@ -172,8 +171,30 @@
});
},
get_snapshot_images: function() {
return this.active_snapshots()
get_snapshot_system_images: function() {
return _.filter(this.active_snapshots(), function(i) {
return _.include(_.keys(snf.config.system_images_owners),
i.get_owner());
})
},
get_snapshot_personal_images: function() {
return _.filter(this.active_snapshots(), function(i) {
return i.get_owner_uuid() == snf.user.get_username();
});
},
get_snapshot_public_images: function() {
return _.filter(this.active_snapshots(), function(i){ return i.is_public() })
},
get_snapshot_shared_images: function() {
return _.filter(this.active_snapshots(), function(i){
return !_.include(_.keys(snf.config.system_images_owners),
i.get_owner()) &&
i.get_owner_uuid() != snf.user.get_username() &&
!i.is_public();
});
},
})
......
......@@ -1992,10 +1992,11 @@
},
get_images_for_type: function(type) {
if (this['get_{0}_images'.format(type)]) {
return this['get_{0}_images'.format(type)]();
var method = 'get_{0}_images'.format(type.replace("-", "_"));
console.log("filtering using", method);
if (this[method]) {
return this[method]();
}
return this.active();
},
......
......@@ -257,6 +257,7 @@
// handlers initialization
this.create_types_selection_options();
this.create_snapshot_types_selection_options();
this.init_handlers();
this.init_position();
},
......@@ -300,7 +301,7 @@
},
create_types_selection_options: function() {
var list = this.$("ul.type-filter");
var list = this.$(".image-types-cont ul.type-filter");
_.each(this.type_selections_order, _.bind(function(key) {
list.append('<li id="type-select-{0}">{1}</li>'.format(key, this.type_selections[key]));
}, this));
......@@ -378,6 +379,7 @@
select_type: function(type) {
this.selected_type = type;
this.types.removeClass("selected");
var selection = "#type-select-" + this.selected_type;
this.types.filter("#type-select-" + this.selected_type).addClass("selected");
this.images_storage.update_images_for_type(
this.selected_type,
......
......@@ -116,7 +116,13 @@
<div class="images-filter-cont content-cont">
<div class="images-filters">
<div class="image-types-cont">
<h4>Image type</h4>
<h4>Images</h4>
<ul class="type-filter">
</ul>
</div>
<br />
<div class="snapshot-types-cont">
<h4>Snapshots</h4>
<ul class="type-filter">
</ul>
</div>
......
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