Commit 87954ee6 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

ui: Conditionally disable suggested flavors in create wizard

based on user quota limits
parent 39249a2b
...@@ -609,8 +609,13 @@ ...@@ -609,8 +609,13 @@
update_valid_predefined: function() { update_valid_predefined: function() {
this.update_unavailable_values(); this.update_unavailable_values();
var self = this; var self = this;
this.valid_predefined = _.select(_.map(this.predefined_flavors, function(flv, key){ this.valid_predefined = _.select(
var existing = storage.flavors.get_flavor(flv.cpu, flv.ram, flv.disk, flv.disk_template, self.flavors); _.map(this.predefined_flavors, function(flv, key){
var existing = storage.flavors.get_flavor(flv.cpu,
flv.ram,
flv.disk,
flv.disk_template,
self.flavors);
// non existing // non existing
if (!existing) { if (!existing) {
return false; return false;
...@@ -621,7 +626,18 @@ ...@@ -621,7 +626,18 @@
existing.get("disk")) > -1) { existing.get("disk")) > -1) {
return false return false
} }
// quota check
var quotas = synnefo.storage.quotas.get_available_for_vm();
var unavailable_check =
synnefo.storage.flavors.unavailable_values_for_quotas;
var unavailable = unavailable_check(quotas, [existing]);
if ((_.filter(unavailable, function(values, flvkey) {
return values.length > 0
})).length > 0) {
return false;
}
return key; return key;
}), function(ret) { return ret }); }), function(ret) { return ret });
......
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