mirror of https://github.com/apache/cloudstack.git
bug 7471: UI will make use of the new network offering "availability" parameter to choose how to display the Virtual Networking model in the VM wizard.
This commit is contained in:
parent
b83c5bcaae
commit
c5b33a69c2
|
|
@ -739,9 +739,19 @@
|
|||
<div class="vmpopup_contentpanel">
|
||||
<h3>
|
||||
</h3>
|
||||
<div class="revwiz_message_container" style="display: none;" id="wiz_message">
|
||||
<div class="revwiz_message_top">
|
||||
<p id="wiz_message_text">
|
||||
Please select at least one network to continue</p>
|
||||
</div>
|
||||
<div class="revwiz_message_bottom">
|
||||
<div class="revwizcontinue_button" id="wiz_message_continue">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vmpopup_offeringpanel" style="position:relative;">
|
||||
<div class="vmpopup_offeringbox" id="network_virtual_container">
|
||||
<input type="radio" id="network_virtual" name="radiogroup" class="radio" checked="checked" />
|
||||
<div class="vmpopup_offeringbox" id="network_virtual_container" style="display:none">
|
||||
<input type="checkbox" id="network_virtual" name="network_virtual_checkbox" class="radio" checked="checked" />
|
||||
<label class="label" id="network_virtual_name">Virtual Network</label>
|
||||
<div class="vmpopup_offdescriptionbox">
|
||||
<div class="vmpopup_offdescriptionbox_top">
|
||||
|
|
@ -917,7 +927,7 @@
|
|||
<span id="wizard_review_disk_offering"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vmpopup_reviewbox even">
|
||||
<div class="vmpopup_reviewbox even" id="wizard_review_virtual_network_container">
|
||||
<div class="vmopopup_reviewtextbox">
|
||||
<div class="vmpopup_reviewtick">
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -531,6 +531,11 @@ function initVMWizard() {
|
|||
$vmPopup.find("#step3 #wiz_message_continue").bind("click", function(event) {
|
||||
$vmPopup.find("#step3 #wiz_message").hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
$vmPopup.find("#step4 #wiz_message_continue").bind("click", function(event) {
|
||||
$vmPopup.find("#step4 #wiz_message").hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
function getIconForOS(osType) {
|
||||
|
|
@ -722,7 +727,8 @@ function initVMWizard() {
|
|||
var $container = $(this);
|
||||
var target = $(event.target);
|
||||
var targetId = target.attr("id");
|
||||
selectedTemplateTypeInVmPopup = "featured";
|
||||
selectedTemplateTypeInVmPopup = "featured";
|
||||
|
||||
switch (targetId) {
|
||||
case "wiz_featured":
|
||||
$vmPopup.find("#search_input").val("");
|
||||
|
|
@ -764,7 +770,8 @@ function initVMWizard() {
|
|||
$vmPopup.find("#next_step").bind("click", function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var $thisPopup = $vmPopup;
|
||||
var $thisPopup = $vmPopup;
|
||||
var $reviewNetworkTemplate = $("#wizard_network_direct_review_template");
|
||||
if (currentStepInVmPopup == 1) { //select a template/ISO
|
||||
// prevent a person from moving on if no templates are selected
|
||||
if($thisPopup.find("#step1 #template_container .rev_wiztemplistbox_selected").length == 0) {
|
||||
|
|
@ -875,7 +882,15 @@ function initVMWizard() {
|
|||
async: false,
|
||||
success: function(json) {
|
||||
var network = json.createnetworkresponse.network;
|
||||
$virtualNetworkElement.data("id", network.id);
|
||||
if (network.networkofferingavailability != 'Unavailable') {
|
||||
$virtualNetworkElement.show();
|
||||
if (network.networkofferingavailability == 'Required') {
|
||||
$virtualNetworkElement.find("#network_virtual").attr('disabled', true);
|
||||
}
|
||||
$virtualNetworkElement.data("id", network.id);
|
||||
} else {
|
||||
$virtualNetworkElement.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -884,9 +899,15 @@ function initVMWizard() {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
$virtualNetworkElement.data("id", virtualNetwork.id);
|
||||
//$virtualNetworkElement.find("#network_virtual_name").text(virtualNetwork.name);
|
||||
//$virtualNetworkElement.find("#network_virtual_desc").text(virtualNetwork.displaytext);
|
||||
if (virtualNetwork.networkofferingavailability != 'Unavailable') {
|
||||
$virtualNetworkElement.show();
|
||||
if (virtualNetwork.networkofferingavailability == 'Required') {
|
||||
$virtualNetworkElement.find("#network_virtual").attr('disabled', true);
|
||||
}
|
||||
$virtualNetworkElement.data("id", virtualNetwork.id);
|
||||
} else {
|
||||
$virtualNetworkElement.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// Setup Direct Networks
|
||||
|
|
@ -911,21 +932,41 @@ function initVMWizard() {
|
|||
|
||||
if (currentStepInVmPopup == 4) { //network
|
||||
var $selectedDirectNetworks = $thisPopup.find("input:checkbox[name=network_direct_checkbox]:checked");
|
||||
var $selectedVirtualNetworks = $thisPopup.find("input:checkbox[name=network_virtual_checkbox]:checked");
|
||||
|
||||
// prevent a person from moving on if no network has been selected
|
||||
if($selectedDirectNetworks.length == 0 && $selectedVirtualNetworks.length == 0) {
|
||||
$thisPopup.find("#step4 #wiz_message").show();
|
||||
return false;
|
||||
}
|
||||
|
||||
var modResult = 0;
|
||||
if ($selectedVirtualNetworks.length == 0) {
|
||||
$thisPopup.find("#wizard_review_virtual_network_container").hide();
|
||||
modResult = 1;
|
||||
} else {
|
||||
$thisPopup.find("#wizard_review_virtual_network_container").show();
|
||||
modResult = 0;
|
||||
}
|
||||
|
||||
var $reviewNetworkContainer = $("#wizard_review_direct_network_container").empty();
|
||||
if ($selectedDirectNetworks != null) {
|
||||
if ($selectedDirectNetworks.length != 0) {
|
||||
var networkIds = [];
|
||||
var $reviewNetworkTemplate = $("#wizard_network_direct_review_template");
|
||||
|
||||
$selectedDirectNetworks.each(function(i) {
|
||||
var json = $(this).data("jsonObj");
|
||||
networkIds.push(","+json.id);
|
||||
$reviewNetworkElement = $reviewNetworkTemplate.clone().attr("id", json.id);
|
||||
if (i % 2 == 0) {
|
||||
$reviewNetworkTemplate.removeClass("even").addClass("odd");
|
||||
if (i == 0) {
|
||||
networkIds.push(json.id);
|
||||
} else {
|
||||
$reviewNetworkTemplate.removeClass("odd").addClass("even");
|
||||
networkIds.push(","+json.id);
|
||||
}
|
||||
$reviewNetworkElement.find("#wizard_review_network_label").text("Network " + (i+2) + ":");
|
||||
$reviewNetworkElement = $reviewNetworkTemplate.clone().attr("id", "network"+json.id);
|
||||
if (i % 2 == modResult) {
|
||||
$reviewNetworkElement.addClass("odd");
|
||||
} else {
|
||||
$reviewNetworkElement.addClass("even");
|
||||
}
|
||||
$reviewNetworkElement.find("#wizard_review_network_label").text("Network " + (i+2-modResult) + ":");
|
||||
$reviewNetworkElement.find("#wizard_review_network_selected").text(json.name);
|
||||
$reviewNetworkContainer.append($reviewNetworkElement.show());
|
||||
});
|
||||
|
|
@ -951,10 +992,17 @@ function initVMWizard() {
|
|||
moreCriteria.push("&templateId="+$selectedVmWizardTemplate.data("templateId"));
|
||||
moreCriteria.push("&serviceOfferingId="+$thisPopup.find("input:radio[name=service_offering_radio]:checked").val());
|
||||
|
||||
var networkIds = $thisPopup.find("#network_virtual_container").data("id");
|
||||
var networkIds = null;
|
||||
if ($thisPopup.find("input:checkbox[name=network_virtual_checkbox]:checked").length != 0) {
|
||||
networkIds = $thisPopup.find("#network_virtual_container").data("id");
|
||||
}
|
||||
var directNetworkIds = $thisPopup.find("#wizard_review_direct_network_container").data("directNetworkIds");
|
||||
if (directNetworkIds != null) {
|
||||
networkIds += directNetworkIds;
|
||||
if (networkIds != null) {
|
||||
networkIds = networkIds+","+directNetworkIds;
|
||||
} else {
|
||||
networkIds = directNetworkIds;
|
||||
}
|
||||
}
|
||||
moreCriteria.push("&networkIds="+networkIds);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue