Commit 1069d8d0 by Kálmán Viktor

dashboard: fix vm create network list if there is only 1 network

parent 9fa233a4
...@@ -143,7 +143,6 @@ function vmCustomizeLoaded() { ...@@ -143,7 +143,6 @@ function vmCustomizeLoaded() {
} }
var html = '<option data-managed="' + (managed ? 1 : 0) + '" value="' + pk + '">' + text + '</option>'; var html = '<option data-managed="' + (managed ? 1 : 0) + '" value="' + pk + '">' + text + '</option>';
if($('#vm-create-network-list span').length < 1) { if($('#vm-create-network-list span').length < 1) {
$("#vm-create-network-list").html(""); $("#vm-create-network-list").html("");
} }
...@@ -152,8 +151,14 @@ function vmCustomizeLoaded() { ...@@ -152,8 +151,14 @@ function vmCustomizeLoaded() {
} else { } else {
$('#vm-create-network-add-select').append(html); $('#vm-create-network-add-select').append(html);
} }
}); });
// if all networks are added add a dummy and disable the add button
if($("#vm-create-network-add-select option").length < 1) {
$("#vm-create-network-add-select").html('<option value="-1">No more networks!</option>');
$('#vm-create-network-add-button').attr('disabled', true);
}
/* build up network list */ /* build up network list */
$('#vm-create-network-add-vlan option').each(function() { $('#vm-create-network-add-vlan option').each(function() {
......
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 sign in to comment