Revision 198b546d snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_main_view.js
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_main_view.js | ||
---|---|---|
776 | 776 |
'networks': storage.networks, |
777 | 777 |
'vms': storage.vms, |
778 | 778 |
'quotas': storage.quotas, |
779 |
'projects': storage.projects, |
|
779 | 780 |
'ips': storage.floating_ips, |
780 | 781 |
'subnets': storage.subnets, |
781 | 782 |
'ports': storage.ports, |
... | ... | |
825 | 826 |
this.loaded = true; |
826 | 827 |
|
827 | 828 |
// application start point |
828 |
|
|
829 | 829 |
this.check_empty(); |
830 | 830 |
this.show_initial_view(); |
831 | 831 |
}, |
... | ... | |
836 | 836 |
} |
837 | 837 |
this.error_view = new views.ErrorView(); |
838 | 838 |
this.vm_resize_view = new views.VmResizeView(); |
839 |
this.vm_reassign_view = new views.VmReassignView(); |
|
840 |
this.ip_reassign_view = new views.IPReassignView(); |
|
841 |
this.network_reassign_view = new views.NetworkReassignView(); |
|
839 | 842 |
|
840 | 843 |
// api request error handling |
841 | 844 |
synnefo.api.bind("error", _.bind(this.handle_api_error, this)); |
... | ... | |
873 | 876 |
self.check_status(); |
874 | 877 |
storage.quotas.fetch({refresh:true, update:true, success: function() { |
875 | 878 |
self.update_status("quotas", 1); |
876 |
self.update_status("layout", 1); |
|
877 |
self.check_status() |
|
879 |
self.update_status("projects", 0); |
|
880 |
self.check_status(); |
|
881 |
storage.projects.fetch({refresh:true, update:true, success: function() { |
|
882 |
self.update_status("projects", 1); |
|
883 |
self.update_status("layout", 0); |
|
884 |
self.check_status(); |
|
885 |
}}); |
|
878 | 886 |
}}) |
879 | 887 |
}}) |
880 | 888 |
}, |
... | ... | |
927 | 935 |
}, |
928 | 936 |
|
929 | 937 |
update_create_buttons_status: function() { |
930 |
var nets = storage.quotas.get('cyclades.network.private'); |
|
931 |
var vms = storage.quotas.get('cyclades.vm'); |
|
938 |
var nets = storage.quotas.can_create('network'); |
|
939 |
var vms = storage.quotas.can_create('vm'); |
|
940 |
var ips = storage.quotas.can_create('ip'); |
|
932 | 941 |
|
933 |
if (!nets || !vms) { return } |
|
934 |
|
|
935 |
if (!nets.can_consume()) { |
|
936 |
$("#networks-pane a.createbutton").addClass("disabled"); |
|
942 |
if (!nets) { |
|
943 |
$("#networks-pane .create-button a").addClass("disabled"); |
|
937 | 944 |
} else { |
938 |
$("#networks-pane a.createbutton").removeClass("disabled");
|
|
945 |
$("#networks-pane .create-button a").removeClass("disabled");
|
|
939 | 946 |
} |
940 | 947 |
|
941 |
if (!vms.can_consume()) {
|
|
948 |
if (!vms) { |
|
942 | 949 |
$("#createcontainer #create").addClass("disabled"); |
943 | 950 |
} else { |
944 | 951 |
$("#createcontainer #create").removeClass("disabled"); |
945 | 952 |
} |
953 |
|
|
954 |
if (!ips) { |
|
955 |
$("#ips-pane #create-ip a").addClass("disabled"); |
|
956 |
} else { |
|
957 |
$("#ips-pane #create-ip a").removeClass("disabled"); |
|
958 |
} |
|
946 | 959 |
}, |
947 | 960 |
|
948 | 961 |
set_vm_view_handlers: function() { |
Also available in: Unified diff