diff --git a/ui/scripts/cloud.core.js b/ui/scripts/cloud.core.js
index 0b218fb42ce..3b1a8defcfe 100644
--- a/ui/scripts/cloud.core.js
+++ b/ui/scripts/cloud.core.js
@@ -1013,6 +1013,13 @@ function handleErrorInDialog(XMLHttpResponse, $thisDialog) {
$infoContainer.show();
}
+function parseXMLHttpResponse(XMLHttpResponse) {
+ var start = XMLHttpResponse.responseText.indexOf("h1") + 3;
+ var end = XMLHttpResponse.responseText.indexOf("";
$thisWizard.find("#spinning_wheel").hide();
$zoneNode = $("#leftmenu_zone_node_template").clone(true);
@@ -513,11 +513,12 @@ function addZoneWizardSubmit($thisWizard) {
var item = json.createzoneresponse.zone;
zoneJSONToTreeNode(item, $zoneNode);
- zoneId = item.id;
+ zoneId = item.id;
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
- handleErrorInDialog(XMLHttpResponse, $thisWizard);
+ afterActionMsg += ("Failed to create zone. " + parseXMLHttpResponse(XMLHttpResponse) + "
");
+ $thisWizard.find("#spinning_wheel").hide();
});
}
});
@@ -542,8 +543,8 @@ function addZoneWizardSubmit($thisWizard) {
data: createURL("command=createPod"+array1.join("")),
dataType: "json",
async: false,
- success: function(json) {
- createPodSuccessful = true;
+ success: function(json) {
+ afterActionMsg += "Pod was created successfully
";
$thisWizard.find("#spinning_wheel").hide();
var item = json.createpodresponse.pod;
@@ -568,7 +569,8 @@ function addZoneWizardSubmit($thisWizard) {
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
- handleErrorInDialog(XMLHttpResponse, $thisWizard);
+ afterActionMsg += ("Failed to create Pod. " + parseXMLHttpResponse(XMLHttpResponse) + "
");
+ $thisWizard.find("#spinning_wheel").hide();
});
}
});
@@ -593,37 +595,20 @@ function addZoneWizardSubmit($thisWizard) {
$.ajax({
data: createURL("command=createVlanIpRange" + array1.join("")),
dataType: "json",
- success: function(json) {
- createVLANSuccessful = true;
+ success: function(json) {
+ afterActionMsg += "Guest IP range was created successfully
";
var item = json.createvlaniprangeresponse.vlan;
vlanId = item.id;
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
- handleErrorInDialog(XMLHttpResponse, $thisWizard);
+ afterActionMsg += ("Failed to create Guest IP range. " + parseXMLHttpResponse(XMLHttpResponse) + "
");
+ $thisWizard.find("#spinning_wheel").hide();
});
}
});
}
-
- var afterActionMsg = "";
- if(createZoneSuccessful)
- afterActionMsg += "Zone was created successfully
";
- else
- afterActionMsg += "failed to create zone
";
- if(createPodSuccessful)
- afterActionMsg += "Pod was created successfully
";
- else
- afterActionMsg += "failed to create pod
";
-
- if($thisWizard.find("#step3").find("#guestip_container").css("display") != "none") {
- if(createVLANSuccessful)
- afterActionMsg += "Guest IP range was created successfully
";
- else
- afterActionMsg += "failed to create Guest IP range
";
- }
-
$thisWizard.find("#after_action_message").html(afterActionMsg);
}