Revision 426e1fb9 snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_create_view.js
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_create_view.js | ||
---|---|---|
678 | 678 |
image_excluded = storage.flavors.unavailable_values_for_image(this.current_image); |
679 | 679 |
} |
680 | 680 |
|
681 |
if (snf.user.quota) { |
|
682 |
quotas = this.get_vm_params_quotas(); |
|
683 |
user_excluded = storage.flavors.unavailable_values_for_quotas(quotas); |
|
684 |
} |
|
681 |
quotas = this.get_vm_params_quotas(); |
|
682 |
user_excluded = storage.flavors.unavailable_values_for_quotas(quotas); |
|
685 | 683 |
|
686 | 684 |
unavailable.disk = user_excluded.disk.concat(image_excluded.disk); |
687 | 685 |
unavailable.ram = user_excluded.ram.concat(image_excluded.ram); |
... | ... | |
691 | 689 |
}, |
692 | 690 |
|
693 | 691 |
get_vm_params_quotas: function() { |
692 |
var quotas = synnefo.storage.quotas; |
|
694 | 693 |
var quota = { |
695 |
'ram': snf.user.quota.get_available('cyclades.ram'),
|
|
696 |
'cpu': snf.user.quota.get_available('cyclades.cpu'),
|
|
697 |
'disk': snf.user.quota.get_available('cyclades.disk')
|
|
694 |
'ram': quotas.get('cyclades.ram').get('available'),
|
|
695 |
'cpu': quotas.get('cyclades.cpu').get('available'),
|
|
696 |
'disk': quotas.get('cyclades.disk').get('available')
|
|
698 | 697 |
} |
699 | 698 |
return quota; |
700 | 699 |
}, |
... | ... | |
769 | 768 |
}; |
770 | 769 |
}, this)); |
771 | 770 |
|
772 |
this.$("#create-vm-flavor-options .flavor-options.ram li").each(_.bind(function(i, el){
|
|
771 |
this.$("#create-vm-flavor-options .flavor-options.mem li").each(_.bind(function(i, el){
|
|
773 | 772 |
var el_value = $(el).data("value"); |
774 | 773 |
if (this.unavailable_values.ram.indexOf(el_value) > -1) { |
775 | 774 |
$(el).addClass("disabled"); |
... | ... | |
941 | 940 |
}, |
942 | 941 |
|
943 | 942 |
update_quota_display: function() { |
944 |
if (!snf.user.quota || !snf.user.quota.data) { return }; |
|
945 | 943 |
|
944 |
var quotas = synnefo.storage.quotas; |
|
946 | 945 |
_.each(["disk", "ram", "cpu"], function(type) { |
947 |
var available_dsp = snf.user.quota.get_available_readable(type);
|
|
948 |
var available = snf.user.quota.get_available(type);
|
|
946 |
var available_dsp = quotas.get('cyclades.'+type).get_readable('available');
|
|
947 |
var available = quotas.get('cyclades.'+type).get('available');
|
|
949 | 948 |
var content = "({0} left)".format(available_dsp); |
950 | 949 |
if (available <= 0) { content = "(None left)" } |
951 | 950 |
|
Also available in: Unified diff