mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
createIpForwardingRule API, createPortForwardingRule API has changed to take in id parameter instead of ipaddress parameter. Here is related UI change.
This commit is contained in:
parent
b813800496
commit
f15a2b7c52
@ -155,20 +155,18 @@ function afterLoadIpJSP() {
|
|||||||
$("#tab_content_port_range #grid_content").append($template.show());
|
$("#tab_content_port_range #grid_content").append($template.show());
|
||||||
|
|
||||||
var $spinningWheel = $template.find("#row_container").find("#spinning_wheel");
|
var $spinningWheel = $template.find("#row_container").find("#spinning_wheel");
|
||||||
//$spinningWheel.find("#description").text("Adding....");
|
|
||||||
$spinningWheel.find("#description").text(g_dictionary["label.adding.processing"]);
|
$spinningWheel.find("#description").text(g_dictionary["label.adding.processing"]);
|
||||||
$spinningWheel.show();
|
$spinningWheel.show();
|
||||||
|
|
||||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||||
var ipObj = $midmenuItem1.data("jsonObj");
|
var ipObj = $midmenuItem1.data("jsonObj");
|
||||||
var ipAddress = ipObj.ipaddress;
|
|
||||||
|
var startPort = $createPortRangeRow.find("#start_port").val();
|
||||||
var startPort = $createPortRangeRow.find("#start_port").val();
|
|
||||||
var endPort = $createPortRangeRow.find("#end_port").val();
|
var endPort = $createPortRangeRow.find("#end_port").val();
|
||||||
var protocol = $createPortRangeRow.find("#protocol").val();
|
var protocol = $createPortRangeRow.find("#protocol").val();
|
||||||
|
|
||||||
var array1 = [];
|
var array1 = [];
|
||||||
array1.push("&ipaddress="+ipAddress);
|
array1.push("&ipaddressid="+ipObj.id);
|
||||||
array1.push("&startPort="+startPort);
|
array1.push("&startPort="+startPort);
|
||||||
array1.push("&endPort="+endPort);
|
array1.push("&endPort="+endPort);
|
||||||
array1.push("&protocol="+protocol);
|
array1.push("&protocol="+protocol);
|
||||||
@ -257,7 +255,6 @@ function afterLoadIpJSP() {
|
|||||||
|
|
||||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||||
var ipObj = $midmenuItem1.data("jsonObj");
|
var ipObj = $midmenuItem1.data("jsonObj");
|
||||||
var ipAddress = ipObj.ipaddress;
|
|
||||||
|
|
||||||
var publicPort = $createPortForwardingRow.find("#public_port").val();
|
var publicPort = $createPortForwardingRow.find("#public_port").val();
|
||||||
var privatePort = $createPortForwardingRow.find("#private_port").val();
|
var privatePort = $createPortForwardingRow.find("#private_port").val();
|
||||||
@ -265,7 +262,7 @@ function afterLoadIpJSP() {
|
|||||||
var virtualMachineId = $createPortForwardingRow.find("#vm").val();
|
var virtualMachineId = $createPortForwardingRow.find("#vm").val();
|
||||||
|
|
||||||
var array1 = [];
|
var array1 = [];
|
||||||
array1.push("&ipaddress="+ipAddress);
|
array1.push("&ipaddressid="+ipObj.id);
|
||||||
array1.push("&publicport="+publicPort);
|
array1.push("&publicport="+publicPort);
|
||||||
array1.push("&privateport="+privatePort);
|
array1.push("&privateport="+privatePort);
|
||||||
array1.push("&protocol="+protocol);
|
array1.push("&protocol="+protocol);
|
||||||
@ -528,17 +525,12 @@ function ipJsonToPortRangeTab() {
|
|||||||
ipClearPortRangeTab();
|
ipClearPortRangeTab();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var networkObj = $midmenuItem1.data("networkObj");
|
|
||||||
|
|
||||||
var ipAddress = ipObj.ipaddress;
|
|
||||||
if(ipAddress == null || ipAddress.length == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var $thisTab = $("#right_panel_content #tab_content_port_range");
|
var $thisTab = $("#right_panel_content #tab_content_port_range");
|
||||||
$thisTab.find("#tab_container").hide();
|
$thisTab.find("#tab_container").hide();
|
||||||
$thisTab.find("#tab_spinning_wheel").show();
|
$thisTab.find("#tab_spinning_wheel").show();
|
||||||
|
|
||||||
|
var networkObj = $midmenuItem1.data("networkObj");
|
||||||
if(networkObj != null) {
|
if(networkObj != null) {
|
||||||
var firewallServiceObj = ipFindNetworkServiceByName("Firewall", networkObj);
|
var firewallServiceObj = ipFindNetworkServiceByName("Firewall", networkObj);
|
||||||
if(firewallServiceObj != null) {
|
if(firewallServiceObj != null) {
|
||||||
@ -556,7 +548,7 @@ function ipJsonToPortRangeTab() {
|
|||||||
refreshCreatePortRangeRow();
|
refreshCreatePortRangeRow();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=listIpForwardingRules&ipaddress=" + ipAddress),
|
data: createURL("command=listIpForwardingRules&ipaddressid=" + ipObj.id),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var items = json.listipforwardingrulesresponse.ipforwardingrule;
|
var items = json.listipforwardingrulesresponse.ipforwardingrule;
|
||||||
@ -586,18 +578,13 @@ function ipJsonToPortForwardingTab() {
|
|||||||
if(ipObj == null) {
|
if(ipObj == null) {
|
||||||
ipClearPortForwardingTab();
|
ipClearPortForwardingTab();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var networkObj = $midmenuItem1.data("networkObj");
|
|
||||||
|
|
||||||
var ipAddress = ipObj.ipaddress;
|
|
||||||
if(ipAddress == null || ipAddress.length == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var $thisTab = $("#right_panel_content #tab_content_port_forwarding");
|
var $thisTab = $("#right_panel_content #tab_content_port_forwarding");
|
||||||
$thisTab.find("#tab_container").hide();
|
$thisTab.find("#tab_container").hide();
|
||||||
$thisTab.find("#tab_spinning_wheel").show();
|
$thisTab.find("#tab_spinning_wheel").show();
|
||||||
|
|
||||||
|
var networkObj = $midmenuItem1.data("networkObj");
|
||||||
if(networkObj != null) {
|
if(networkObj != null) {
|
||||||
var firewallServiceObj = ipFindNetworkServiceByName("Firewall", networkObj);
|
var firewallServiceObj = ipFindNetworkServiceByName("Firewall", networkObj);
|
||||||
if(firewallServiceObj != null) {
|
if(firewallServiceObj != null) {
|
||||||
@ -615,7 +602,7 @@ function ipJsonToPortForwardingTab() {
|
|||||||
refreshCreatePortForwardingRow();
|
refreshCreatePortForwardingRow();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=listPortForwardingRules&ipaddress=" + ipAddress),
|
data: createURL("command=listPortForwardingRules&ipaddressid=" + ipObj.id),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var items = json.listportforwardingrulesresponse.portforwardingrule;
|
var items = json.listportforwardingrulesresponse.portforwardingrule;
|
||||||
@ -1114,16 +1101,14 @@ function ipJsonToDetailsTab() {
|
|||||||
|
|
||||||
var networkObj = $midmenuItem1.data("networkObj");
|
var networkObj = $midmenuItem1.data("networkObj");
|
||||||
|
|
||||||
var ipaddress = ipObj.ipaddress;
|
var id = ipObj.id;
|
||||||
if(ipaddress == null || ipaddress.length == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var $thisTab = $("#right_panel_content").find("#tab_content_details");
|
var $thisTab = $("#right_panel_content").find("#tab_content_details");
|
||||||
$thisTab.find("#tab_container").hide();
|
$thisTab.find("#tab_container").hide();
|
||||||
$thisTab.find("#tab_spinning_wheel").show();
|
$thisTab.find("#tab_spinning_wheel").show();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=listPublicIpAddresses&ipaddress="+ipaddress),
|
data: createURL("command=listPublicIpAddresses&id="+id),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
@ -1336,8 +1321,7 @@ function doReleaseIp($actionLink, $detailsTab, $midmenuItem1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doEnableStaticNAT($actionLink, $detailsTab, $midmenuItem1) {
|
function doEnableStaticNAT($actionLink, $detailsTab, $midmenuItem1) {
|
||||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
var ipObj = $midmenuItem1.data("jsonObj");
|
||||||
var id = jsonObj.id;
|
|
||||||
|
|
||||||
$("#dialog_enable_static_NAT")
|
$("#dialog_enable_static_NAT")
|
||||||
.dialog('option', 'buttons', {
|
.dialog('option', 'buttons', {
|
||||||
@ -1351,8 +1335,8 @@ function doEnableStaticNAT($actionLink, $detailsTab, $midmenuItem1) {
|
|||||||
|
|
||||||
$thisDialog.dialog("close");
|
$thisDialog.dialog("close");
|
||||||
|
|
||||||
var apiCommand = "command=enableStaticNat&ipaddressid="+id+"&virtualmachineid="+vmId;
|
var apiCommand = "command=enableStaticNat&ipaddressid="+ipObj.id+"&virtualmachineid="+vmId;
|
||||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
doActionToTab(ipObj.id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
||||||
},
|
},
|
||||||
"Cancel": function() {
|
"Cancel": function() {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
@ -1361,8 +1345,7 @@ function doEnableStaticNAT($actionLink, $detailsTab, $midmenuItem1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doDisableStaticNAT($actionLink, $detailsTab, $midmenuItem1) {
|
function doDisableStaticNAT($actionLink, $detailsTab, $midmenuItem1) {
|
||||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
var ipObj = $midmenuItem1.data("jsonObj");
|
||||||
var id = jsonObj.id;
|
|
||||||
|
|
||||||
$("#dialog_info")
|
$("#dialog_info")
|
||||||
.text(dictionary["message.action.disable.static.NAT"])
|
.text(dictionary["message.action.disable.static.NAT"])
|
||||||
@ -1370,8 +1353,8 @@ function doDisableStaticNAT($actionLink, $detailsTab, $midmenuItem1) {
|
|||||||
"Confirm": function() {
|
"Confirm": function() {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
|
|
||||||
var apiCommand = "command=disableStaticNat&ipaddressid="+id;
|
var apiCommand = "command=disableStaticNat&ipaddressid="+ipObj.id;
|
||||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
doActionToTab(ipObj.id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
||||||
},
|
},
|
||||||
"Cancel": function() {
|
"Cancel": function() {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
@ -1555,89 +1538,7 @@ function portForwardingJsonToTemplate(jsonObj, $template) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
$template.find("#edit_link").unbind("click").bind("click", function(event){
|
|
||||||
$rowContainer.hide();
|
|
||||||
$rowContainerEdit.show();
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
$template.find("#cancel_link").unbind("click").bind("click", function(event){
|
|
||||||
$rowContainer.show();
|
|
||||||
$rowContainerEdit.hide();
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
$template.find("#save_link").unbind("click").bind("click", function(event){
|
|
||||||
// validate values
|
|
||||||
var isValid = true;
|
|
||||||
isValid &= validateInteger("Private Port", $rowContainerEdit.find("#private_port"), $rowContainerEdit.find("#private_port_errormsg"), 1, 65535);
|
|
||||||
if (!isValid) return;
|
|
||||||
|
|
||||||
var $spinningWheel = $rowContainerEdit.find("#spinning_wheel");
|
|
||||||
$spinningWheel.find("#description").text(g_dictionary["label.saving.processing"]);
|
|
||||||
$spinningWheel.show();
|
|
||||||
|
|
||||||
var publicPort = $rowContainerEdit.find("#public_port").text();
|
|
||||||
var privatePort = $rowContainerEdit.find("#private_port").val();
|
|
||||||
var protocol = $rowContainerEdit.find("#protocol").text();
|
|
||||||
var virtualMachineId = $rowContainerEdit.find("#vm").val();
|
|
||||||
|
|
||||||
var array1 = [];
|
|
||||||
array1.push("&ipaddress="+ipAddress);
|
|
||||||
array1.push("&privateport="+privatePort);
|
|
||||||
array1.push("&publicport="+publicPort);
|
|
||||||
array1.push("&protocol="+protocol);
|
|
||||||
array1.push("&virtualmachineid=" + virtualMachineId);
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
data: createURL("command=updatePortForwardingRule"+array1.join("")),
|
|
||||||
dataType: "json",
|
|
||||||
success: function(json) {
|
|
||||||
var jobId = json.updateportforwardingruleresponse.jobid;
|
|
||||||
var timerKey = "updateportforwardingruleJob"+jobId;
|
|
||||||
|
|
||||||
$("body").everyTime(2000, timerKey, function() {
|
|
||||||
$.ajax({
|
|
||||||
data: createURL("command=queryAsyncJobResult&jobId="+jobId),
|
|
||||||
dataType: "json",
|
|
||||||
success: function(json) {
|
|
||||||
var result = json.queryasyncjobresultresponse;
|
|
||||||
if (result.jobstatus == 0) {
|
|
||||||
return; //Job has not completed
|
|
||||||
} else {
|
|
||||||
$("body").stopTime(timerKey);
|
|
||||||
if (result.jobstatus == 1) { // Succeeded
|
|
||||||
var item = result.jobresult.portforwardingrule;
|
|
||||||
portForwardingJsonToTemplate(item,$template);
|
|
||||||
$spinningWheel.hide();
|
|
||||||
$rowContainerEdit.hide();
|
|
||||||
$rowContainer.show();
|
|
||||||
} else if (result.jobstatus == 2) { //Fail
|
|
||||||
$spinningWheel.hide();
|
|
||||||
$("#dialog_alert").text(fromdb(result.jobresult.errortext)).dialog("open");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(XMLHttpResponse) {
|
|
||||||
handleError(XMLHttpResponse);
|
|
||||||
$("body").stopTime(timerKey);
|
|
||||||
$spinningWheel.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 0);
|
|
||||||
},
|
|
||||||
error: function(XMLHttpResponse) {
|
|
||||||
handleError(XMLHttpResponse);
|
|
||||||
$spinningWheel.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshCreatePortForwardingRow() {
|
function refreshCreatePortForwardingRow() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user