Revision 213a8396
b/snf-cyclades-app/synnefo/ui/static/snf/css/main.css | ||
---|---|---|
6707 | 6707 |
.collection span.no-available { |
6708 | 6708 |
} |
6709 | 6709 |
|
6710 |
.collection span.no-available { |
|
6711 |
float: right; |
|
6712 |
} |
|
6713 |
|
|
6710 | 6714 |
.collection .no-available { |
6711 | 6715 |
font-size: 0.8em; |
6712 | 6716 |
color: #f00; |
b/snf-cyclades-app/synnefo/ui/static/snf/js/models.js | ||
---|---|---|
359 | 359 |
if (!model) return false; |
360 | 360 |
var success = options.success; |
361 | 361 |
options.success = function(nextModel, resp, xhr) { |
362 |
if (coll.add_on_create) { |
|
363 |
coll.add(nextModel, options); |
|
364 |
} |
|
362 | 365 |
if (success) success(nextModel, resp, xhr); |
363 | 366 |
}; |
364 | 367 |
model.save(null, options); |
b/snf-cyclades-app/synnefo/ui/static/snf/js/neutron.js | ||
---|---|---|
29 | 29 |
api_type: 'network', |
30 | 30 |
details: true, |
31 | 31 |
noUpdate: true, |
32 |
updateEntries: true |
|
32 |
updateEntries: true, |
|
33 |
add_on_create: true |
|
33 | 34 |
}); |
34 | 35 |
|
35 | 36 |
// Subnet model |
... | ... | |
49 | 50 |
models.Network = models.NetworkModel.extend({ |
50 | 51 |
path: 'networks', |
51 | 52 |
|
53 |
parse: function(obj) { |
|
54 |
return obj.network; |
|
55 |
}, |
|
56 |
|
|
52 | 57 |
// Available network actions. |
53 | 58 |
// connect: |
54 | 59 |
model_actions: { |
... | ... | |
224 | 229 |
defaults: { |
225 | 230 |
'admin_state_up': true, |
226 | 231 |
'id': 'snf-combined-public-network', |
227 |
'name': 'Public',
|
|
232 |
'name': 'Internet',
|
|
228 | 233 |
'status': 'ACTIVE', |
229 | 234 |
'router:external': true, |
230 | 235 |
'shared': false, |
... | ... | |
311 | 316 |
|
312 | 317 |
models.Port = models.NetworkModel.extend({ |
313 | 318 |
path: 'ports', |
319 |
parse: function(obj) { |
|
320 |
return obj.port; |
|
321 |
}, |
|
314 | 322 |
initialize: function() { |
315 | 323 |
models.Port.__super__.initialize.apply(this, arguments); |
316 | 324 |
var ips = new models.FixedIPs(); |
... | ... | |
439 | 447 |
|
440 | 448 |
models.FloatingIP = models.NetworkModel.extend({ |
441 | 449 |
path: 'floatingips', |
450 |
|
|
451 |
parse: function(obj) { |
|
452 |
return obj.floatingip; |
|
453 |
}, |
|
454 |
|
|
442 | 455 |
storage_attrs: { |
443 | 456 |
'port_id': ['ports', 'port'], |
444 | 457 |
'floating_network_id': ['networks', 'network'], |
... | ... | |
494 | 507 |
} |
495 | 508 |
] |
496 | 509 |
}, |
497 |
|
|
510 |
|
|
498 | 511 |
disconnect: function(cb) { |
499 | 512 |
this.get('port').disconnect(cb); |
500 | 513 |
} |
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_ips_view.js | ||
---|---|---|
47 | 47 |
|
48 | 48 |
vm_style: function() { |
49 | 49 |
var style = "background-image: url('{0}')"; |
50 |
if (!this.model.get('vm')) { return } |
|
50 | 51 |
return style.format(this.get_vm_icon_path(this.model.get('vm'), |
51 | 52 |
'medium')); |
52 | 53 |
}, |
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_networks_view.js | ||
---|---|---|
455 | 455 |
} |
456 | 456 |
if (this.model.id == "snf-combined-public-network" && !_.contains( |
457 | 457 |
["CONNECTING", "DISCONNECTING"], status)) { |
458 |
return "Internet"
|
|
458 |
return "Public connectivity"
|
|
459 | 459 |
} |
460 | 460 |
|
461 | 461 |
return this.status_map[status]; |
... | ... | |
574 | 574 |
get_vm_icon: function() { |
575 | 575 |
return $(snf.ui.helpers.vm_icon_tag(this.model, "small")).attr("src") |
576 | 576 |
}, |
577 |
|
|
578 | 577 |
status_cls: function() { |
579 | 578 |
return (views.IconView.STATE_CLASSES[this.model.get("state")] || []).join(" ") + " status clearfix" |
580 | 579 |
}, |
... | ... | |
753 | 752 |
classes: 'public-network', |
754 | 753 |
post_init_element: function() { |
755 | 754 |
views.NetworkSelectPublicNetwork.__super__.post_init_element.apply(this); |
756 |
//$(this.el).attr('title', 'Public network tooltip'); |
|
757 |
//$(this.el).tooltip({ |
|
758 |
//'tipClass': 'tooltip', |
|
759 |
//'position': 'top center', |
|
760 |
//'offset': [-5, 0] |
|
761 |
//}); |
|
762 |
|
|
763 | 755 |
} |
764 | 756 |
}); |
765 | 757 |
|
... | ... | |
836 | 828 |
e.preventDefault(); |
837 | 829 |
self.create_ip(); |
838 | 830 |
}); |
839 |
this.update_available();
|
|
831 |
this.reset_creating();
|
|
840 | 832 |
}, |
841 | 833 |
|
842 | 834 |
hide_parent: function() { |
... | ... | |
877 | 869 |
no_available_el.show(); |
878 | 870 |
} else { |
879 | 871 |
// available floating ip |
880 |
var available_text = "{0} IP's available.".format(
|
|
872 |
var available_text = "".format( |
|
881 | 873 |
this.collection.length + this.quota.get_available()); |
882 | 874 |
available_el.removeClass("hidden").text(available_text).show(); |
883 | 875 |
available_el.show(); |
... | ... | |
893 | 885 |
} else { |
894 | 886 |
// no available quota |
895 | 887 |
create.addClass("no-available"); |
896 |
create.show();
|
|
888 |
create.hide();
|
|
897 | 889 |
create_link.hide(); |
898 |
create_no_available.show(); |
|
890 |
//create_no_available.show();
|
|
899 | 891 |
} |
900 |
// |
|
901 | 892 |
this.update_selected(); |
902 | 893 |
}, |
903 | 894 |
|
904 | 895 |
update_selected: function() { |
896 |
_.each(this.selected_ips.length, function(ip) { |
|
897 |
if (!this.collection.get(ip.id)) { |
|
898 |
this.selected_ips = _.without(this.selected_ips, ip); |
|
899 |
} |
|
900 |
}, this); |
|
901 |
|
|
905 | 902 |
if (this.selected_ips.length) { |
906 | 903 |
this.parent_view.input.attr("checked", true); |
907 | 904 |
this.parent_view.item.addClass("selected"); |
... | ... | |
919 | 916 |
}, |
920 | 917 |
|
921 | 918 |
handle_create_error: function() {}, |
919 |
|
|
920 |
set_creating: function() { |
|
921 |
var create_link = this.$(".create a"); |
|
922 |
var create_no_available = this.$(".create .no-available"); |
|
923 |
var loading = this.$(".create .loading"); |
|
924 |
create_link.hide(); |
|
925 |
loading.show(); |
|
926 |
}, |
|
927 |
|
|
928 |
reset_creating: function() { |
|
929 |
var loading = this.$(".create .loading"); |
|
930 |
loading.hide(); |
|
931 |
this.update_available(); |
|
932 |
}, |
|
922 | 933 |
|
923 | 934 |
create_ip: function() { |
924 | 935 |
if (!this.quota.get_available()) { return } |
936 |
var self = this; |
|
937 |
this.set_creating(); |
|
925 | 938 |
synnefo.storage.floating_ips.create({floatingip:{}}, { |
926 | 939 |
error: _.bind(this.handle_create_error, this), |
940 |
complete: function() { |
|
941 |
synnefo.storage.quotas.fetch(); |
|
942 |
self.reset_creating(); |
|
943 |
}, |
|
927 | 944 |
skip_api_error: true |
928 | 945 |
}); |
929 | 946 |
}, |
... | ... | |
975 | 992 |
select_public: true, |
976 | 993 |
|
977 | 994 |
forced_values_title_map: { |
978 |
"SNF:ANY_PUBLIC_IPV6": "Public IPv6 Network",
|
|
979 |
"SNF:ANY_PUBLIC_IPV4": "Public IPv4 Network"
|
|
995 |
"SNF:ANY_PUBLIC_IPV6": "Internet (public IPv6)",
|
|
996 |
"SNF:ANY_PUBLIC_IPV4": "Internet (public IPv4)"
|
|
980 | 997 |
}, |
981 | 998 |
|
982 | 999 |
initialize: function(options) { |
... | ... | |
1019 | 1036 |
|
1020 | 1037 |
// combined public |
1021 | 1038 |
this.combined_public = new models.networks.CombinedPublicNetwork(); |
1022 |
this.combined_public.set({noselect: true, name: 'Internet', forced: false}); |
|
1039 |
this.combined_public.set({noselect: true, |
|
1040 |
name: 'Internet (public IPv4)', |
|
1041 |
forced: false}); |
|
1023 | 1042 |
this.public_networks.add(this.combined_public); |
1024 | 1043 |
|
1025 | 1044 |
model_attrs = { |
b/snf-cyclades-app/synnefo/ui/templates/home.html | ||
---|---|---|
702 | 702 |
synnefo.config.system_images_owners = {{ system_images_owners|safe }}; |
703 | 703 |
synnefo.ui.init(); |
704 | 704 |
synnefo.ui.main.bind("ready", function(){ |
705 |
$("#machines-pane-top #create").click(); |
|
706 |
window.setTimeout(function() { |
|
707 |
$("#type-select-public").click(); |
|
708 |
$("#untrusted-image-confirm").click(); |
|
709 |
$(".form-action.next").click(); |
|
710 |
$(".form-action.next").click(); |
|
711 |
}, 400); |
|
705 | 712 |
}); |
706 | 713 |
}); |
707 | 714 |
</script> |
b/snf-cyclades-app/synnefo/ui/templates/partials/networks.html | ||
---|---|---|
257 | 257 |
<div class="collection"> |
258 | 258 |
<div class="items-list floating-ips clearfix"> |
259 | 259 |
</div> |
260 |
<div class="create model-item select-item floating-ip"> |
|
260 |
<div class="create model-item select-item floating-ip clearfix">
|
|
261 | 261 |
<span class="empty-list hidden" style="padding-left:0;"> |
262 | 262 |
{% trans "No ip addresses available" %} |
263 | 263 |
</span> |
264 | 264 |
<a href="#">create new...</a> |
265 |
<span class="loading">creating...</span> |
|
265 | 266 |
<span class="no-available hidden">{% trans "IP's limit reached." %}</span> |
266 | 267 |
</div> |
267 | 268 |
</div> |
Also available in: Unified diff