mirror of https://github.com/apache/cloudstack.git
cloudstack 3.0 UI - VPC - site-to-site VPN - pass vpcid to listVpnConnections and listVirtualMachines API since site-to-site VPN has been moved under VPC.
This commit is contained in:
parent
6641f35885
commit
ecf730356d
|
|
@ -40,7 +40,8 @@
|
|||
$browser.cloudBrowser('addPanel', {
|
||||
title: 'IP Addresses',
|
||||
maximizeIfSelected: true,
|
||||
complete: function($panel) {
|
||||
complete: function($panel) {
|
||||
//ipAddresses.listView is a function
|
||||
$panel.listView(ipAddresses.listView(), {context: ipAddresses.context});
|
||||
}
|
||||
});
|
||||
|
|
@ -51,11 +52,9 @@
|
|||
$browser.cloudBrowser('addPanel', {
|
||||
title: 'Site-to-site VPNs',
|
||||
maximizeIfSelected: true,
|
||||
complete: function($panel) {
|
||||
$panel.listView(
|
||||
$.isFunction(siteToSiteVPN.listView) ?
|
||||
siteToSiteVPN.listView() : siteToSiteVPN.listView
|
||||
);
|
||||
complete: function($panel) {
|
||||
//siteToSiteVPN is an object
|
||||
$panel.listView(siteToSiteVPN, {context: siteToSiteVPN.context});
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -413,460 +413,463 @@
|
|||
|
||||
},
|
||||
siteToSiteVPN: {//start siteToSiteVPN
|
||||
listView: { //start siteToSiteVPN.listView
|
||||
type: 'select',
|
||||
title: 'site-to-site VPN',
|
||||
listView: {
|
||||
id: 'siteToSiteVpn',
|
||||
label: 'site-to-site VPN',
|
||||
fields: {
|
||||
publicip: { label: 'label.ip.address' },
|
||||
gateway: { label: 'label.gateway' },
|
||||
cidrlist: { label: 'CIDR list' },
|
||||
ipsecpsk: { label: 'IPsec Preshared-Key' },
|
||||
ikepolicy: { label: 'IKE policy' },
|
||||
esppolicy: { label: 'ESP policy' }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
var array1 = [];
|
||||
if(args.filterBy != null) {
|
||||
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
|
||||
switch(args.filterBy.search.by) {
|
||||
case "name":
|
||||
if(args.filterBy.search.value.length > 0)
|
||||
array1.push("&keyword=" + args.filterBy.search.value);
|
||||
break;
|
||||
}
|
||||
type: 'select',
|
||||
title: 'site-to-site VPN',
|
||||
listView: {
|
||||
id: 'siteToSiteVpn',
|
||||
label: 'site-to-site VPN',
|
||||
fields: {
|
||||
publicip: { label: 'label.ip.address' },
|
||||
gateway: { label: 'label.gateway' },
|
||||
cidrlist: { label: 'CIDR list' },
|
||||
ipsecpsk: { label: 'IPsec Preshared-Key' },
|
||||
ikepolicy: { label: 'IKE policy' },
|
||||
esppolicy: { label: 'ESP policy' }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
var array1 = [];
|
||||
if(args.filterBy != null) {
|
||||
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
|
||||
switch(args.filterBy.search.by) {
|
||||
case "name":
|
||||
if(args.filterBy.search.value.length > 0)
|
||||
array1.push("&keyword=" + args.filterBy.search.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
url: createURL("listVpnConnections&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var items = json.listvpnconnectionsresponse.vpnconnection;
|
||||
args.response.success({data:items});
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
url: createURL("listVpnConnections&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
|
||||
data: {
|
||||
vpcid: args.context.vpc[0].id
|
||||
},
|
||||
success: function(json) {
|
||||
var items = json.listvpnconnectionsresponse.vpnconnection;
|
||||
args.response.success({data:items});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
add: {
|
||||
label: 'add site-to-site VPN',
|
||||
messages: {
|
||||
notification: function(args) {
|
||||
return 'add site-to-site VPN';
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
add: {
|
||||
label: 'add site-to-site VPN',
|
||||
messages: {
|
||||
notification: function(args) {
|
||||
return 'add site-to-site VPN';
|
||||
}
|
||||
},
|
||||
createForm: {
|
||||
title: 'add site-to-site VPN',
|
||||
fields: {
|
||||
publicipid: {
|
||||
label: 'label.ip.address',
|
||||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listPublicIpAddresses'),
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var items = [];
|
||||
var objs = json.listpublicipaddressesresponse.publicipaddress;
|
||||
if(objs != null && objs.length > 0) {
|
||||
for(var i = 0; i < objs.length; i++) {
|
||||
items.push({id: objs[i].id, description: objs[i].ipaddress});
|
||||
}
|
||||
}
|
||||
args.response.success({data: items});
|
||||
},
|
||||
createForm: {
|
||||
title: 'add site-to-site VPN',
|
||||
fields: {
|
||||
publicipid: {
|
||||
label: 'label.ip.address',
|
||||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listPublicIpAddresses'),
|
||||
dataType: 'json',
|
||||
data: {
|
||||
vpcid: args.context.vpc[0].id
|
||||
},
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var items = [];
|
||||
var objs = json.listpublicipaddressesresponse.publicipaddress;
|
||||
if(objs != null && objs.length > 0) {
|
||||
for(var i = 0; i < objs.length; i++) {
|
||||
items.push({id: objs[i].id, description: objs[i].ipaddress});
|
||||
}
|
||||
}
|
||||
args.response.success({data: items});
|
||||
}
|
||||
});
|
||||
},
|
||||
validation: { required: true }
|
||||
},
|
||||
gateway: {
|
||||
label: 'label.gateway',
|
||||
validation: { required: true }
|
||||
},
|
||||
cidrlist: {
|
||||
label: 'CIDR list',
|
||||
validation: { required: true }
|
||||
},
|
||||
ipsecpsk: {
|
||||
label: 'IPsec Preshared-Key',
|
||||
validation: { required: true }
|
||||
},
|
||||
ikepolicy: {
|
||||
label: 'IKE policy',
|
||||
select: function(args) {
|
||||
var items = [];
|
||||
items.push({id: '3des-md5', description: '3des-md5'});
|
||||
items.push({id: 'aes-md5', description: 'aes-md5'});
|
||||
items.push({id: 'aes128-md5', description: 'aes128-md5'});
|
||||
items.push({id: 'des-md5', description: 'des-md5'});
|
||||
items.push({id: '3des-sha1', description: '3des-sha1'});
|
||||
items.push({id: 'aes-sha1', description: 'aes-sha1'});
|
||||
items.push({id: 'aes128-sha1', description: 'aes128-sha1'});
|
||||
items.push({id: 'des-sha1', description: 'des-sha1'});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
},
|
||||
esppolicy: {
|
||||
label: 'ESP policy',
|
||||
select: function(args) {
|
||||
var items = [];
|
||||
items.push({id: '3des-md5', description: '3des-md5'});
|
||||
items.push({id: 'aes-md5', description: 'aes-md5'});
|
||||
items.push({id: 'aes128-md5', description: 'aes128-md5'});
|
||||
items.push({id: 'des-md5', description: 'des-md5'});
|
||||
items.push({id: '3des-sha1', description: '3des-sha1'});
|
||||
items.push({id: 'aes-sha1', description: 'aes-sha1'});
|
||||
items.push({id: 'aes128-sha1', description: 'aes128-sha1'});
|
||||
items.push({id: 'des-sha1', description: 'des-sha1'});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
},
|
||||
lifetime: {
|
||||
label: 'Lifetime (second)',
|
||||
defaultValue: '86400',
|
||||
validation: { required: false, number: true }
|
||||
}
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('createVpnGateway'),
|
||||
data: {
|
||||
publicipid: args.data.publicipid
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
var jid = json.createvpngatewayresponse.jobid;
|
||||
var createvpngatewayIntervalID = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobid=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
});
|
||||
},
|
||||
validation: { required: true }
|
||||
},
|
||||
gateway: {
|
||||
label: 'label.gateway',
|
||||
validation: { required: true }
|
||||
},
|
||||
cidrlist: {
|
||||
label: 'CIDR list',
|
||||
validation: { required: true }
|
||||
},
|
||||
ipsecpsk: {
|
||||
label: 'IPsec Preshared-Key',
|
||||
validation: { required: true }
|
||||
},
|
||||
ikepolicy: {
|
||||
label: 'IKE policy',
|
||||
select: function(args) {
|
||||
var items = [];
|
||||
items.push({id: '3des-md5', description: '3des-md5'});
|
||||
items.push({id: 'aes-md5', description: 'aes-md5'});
|
||||
items.push({id: 'aes128-md5', description: 'aes128-md5'});
|
||||
items.push({id: 'des-md5', description: 'des-md5'});
|
||||
items.push({id: '3des-sha1', description: '3des-sha1'});
|
||||
items.push({id: 'aes-sha1', description: 'aes-sha1'});
|
||||
items.push({id: 'aes128-sha1', description: 'aes128-sha1'});
|
||||
items.push({id: 'des-sha1', description: 'des-sha1'});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
},
|
||||
esppolicy: {
|
||||
label: 'ESP policy',
|
||||
select: function(args) {
|
||||
var items = [];
|
||||
items.push({id: '3des-md5', description: '3des-md5'});
|
||||
items.push({id: 'aes-md5', description: 'aes-md5'});
|
||||
items.push({id: 'aes128-md5', description: 'aes128-md5'});
|
||||
items.push({id: 'des-md5', description: 'des-md5'});
|
||||
items.push({id: '3des-sha1', description: '3des-sha1'});
|
||||
items.push({id: 'aes-sha1', description: 'aes-sha1'});
|
||||
items.push({id: 'aes128-sha1', description: 'aes128-sha1'});
|
||||
items.push({id: 'des-sha1', description: 'des-sha1'});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
},
|
||||
lifetime: {
|
||||
label: 'Lifetime (second)',
|
||||
defaultValue: '86400',
|
||||
validation: { required: false, number: true }
|
||||
}
|
||||
else {
|
||||
clearInterval(createvpngatewayIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
var obj = result.jobresult.vpngateway;
|
||||
var vpngatewayid = obj.id;
|
||||
|
||||
$.ajax({
|
||||
url: createURL('createVpnCustomerGateway'),
|
||||
data: {
|
||||
gateway: args.data.gateway,
|
||||
cidrlist: args.data.cidrlist,
|
||||
ipsecpsk: args.data.ipsecpsk,
|
||||
ikepolicy: args.data.ikepolicy,
|
||||
esppolicy: args.data.esppolicy,
|
||||
lifetime: args.data.lifetime
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
var jid = json.createvpncustomergatewayresponse.jobid;
|
||||
var createvpncustomergatewayIntervalID = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobid=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(createvpncustomergatewayIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
var obj = result.jobresult.vpncustomergateway;
|
||||
var vpncustomergatewayid = obj.id;
|
||||
|
||||
$.ajax({
|
||||
url: createURL('createVpnConnection'),
|
||||
data: {
|
||||
s2svpngatewayid: vpngatewayid,
|
||||
s2scustomergatewayid: vpncustomergatewayid
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
var jid = json.createvpnconnectionresponse.jobid;
|
||||
var createvpnconnectionIntervalID = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobid=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(createvpnconnectionIntervalID);
|
||||
|
||||
if (result.jobstatus == 1) {
|
||||
//remove loading image on table row
|
||||
var $listviewTable = $("div.list-view div.data-table table.body tbody");
|
||||
var $tr1 = $listviewTable.find("tr.loading").removeClass("loading");
|
||||
$tr1.find("td div.loading").removeClass("loading");
|
||||
|
||||
var item = result.jobresult.vpnconnection;
|
||||
$tr1.find("td.publicip span").text(item.publicip);
|
||||
|
||||
cloudStack.dialog.notice({ message: "site-to-site VPN is created successfully." });
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
detailView: {
|
||||
name: 'label.details',
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'label.details',
|
||||
fields: [
|
||||
{
|
||||
id: { label: 'label.id' },
|
||||
|
||||
//s2svpngatewayid: { label: 'VPN gateway ID' },
|
||||
publicip: { label: 'label.ip.address' },
|
||||
|
||||
//s2scustomergatewayid: { label: 'Customer gateway ID' },
|
||||
gateway: { label: 'label.gateway' },
|
||||
cidrlist: { label: 'CIDR list' },
|
||||
ipsecpsk: { label: 'IPsec Preshared-Key' },
|
||||
ikepolicy: { label: 'IKE policy' },
|
||||
esppolicy: { label: 'ESP policy' },
|
||||
lifetime: { label: 'Lifetime (second)' },
|
||||
|
||||
created: { label: 'label.date', converter: cloudStack.converters.toLocalDate }
|
||||
}
|
||||
],
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listVpnConnections&id=" + args.context.siteToSiteVpn[0].id),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var item = json.listvpnconnectionsresponse.vpnconnection[0];
|
||||
args.response.success({data: item});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
restart: {
|
||||
label: 'Reset VPN connection',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm that you want to reset VPN connection' ;
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Reset VPN connection';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('createVpnGateway'),
|
||||
url: createURL("resetVpnConnection"),
|
||||
data: {
|
||||
publicipid: args.data.publicipid
|
||||
},
|
||||
dataType: 'json',
|
||||
id: args.context.siteToSiteVpn[0].id
|
||||
},
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.createvpngatewayresponse.jobid;
|
||||
var createvpngatewayIntervalID = setInterval(function() {
|
||||
var jid = json.resetvpnconnectionresponse.jobid;
|
||||
args.response.success(
|
||||
{_custom:
|
||||
{
|
||||
jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.vpnconnection;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
remove: {
|
||||
label: 'delete site-to-site VPN',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm that you want to delete this site-to-site VPN';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'delete site-to-site VPN';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("deleteVpnConnection"),
|
||||
dataType: "json",
|
||||
data: {
|
||||
id: args.context.siteToSiteVpn[0].id
|
||||
},
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.deletevpnconnectionresponse.jobid;
|
||||
var deleteVpnConnectionIntervalID = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobid=" + jid),
|
||||
url: createURL("queryAsyncJobResult&jobId=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(createvpngatewayIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
var obj = result.jobresult.vpngateway;
|
||||
var vpngatewayid = obj.id;
|
||||
|
||||
else {
|
||||
clearInterval(deleteVpnConnectionIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
$.ajax({
|
||||
url: createURL('createVpnCustomerGateway'),
|
||||
url: createURL("deleteVpnGateway"),
|
||||
dataType: "json",
|
||||
data: {
|
||||
gateway: args.data.gateway,
|
||||
cidrlist: args.data.cidrlist,
|
||||
ipsecpsk: args.data.ipsecpsk,
|
||||
ikepolicy: args.data.ikepolicy,
|
||||
esppolicy: args.data.esppolicy,
|
||||
lifetime: args.data.lifetime
|
||||
id: args.context.siteToSiteVpn[0].s2svpngatewayid
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
var jid = json.createvpncustomergatewayresponse.jobid;
|
||||
var createvpncustomergatewayIntervalID = setInterval(function() {
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.deletevpngatewayresponse.jobid;
|
||||
var deleteVpnGatewayIntervalID = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobid=" + jid),
|
||||
url: createURL("queryAsyncJobResult&jobId=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(createvpncustomergatewayIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
var obj = result.jobresult.vpncustomergateway;
|
||||
var vpncustomergatewayid = obj.id;
|
||||
|
||||
else {
|
||||
clearInterval(deleteVpnGatewayIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
$.ajax({
|
||||
url: createURL('createVpnConnection'),
|
||||
url: createURL("deleteVpnCustomerGateway"),
|
||||
dataType: "json",
|
||||
data: {
|
||||
s2svpngatewayid: vpngatewayid,
|
||||
s2scustomergatewayid: vpncustomergatewayid
|
||||
id: args.context.siteToSiteVpn[0].s2scustomergatewayid
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
var jid = json.createvpnconnectionresponse.jobid;
|
||||
var createvpnconnectionIntervalID = setInterval(function() {
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.deletecustomergatewayresponse.jobid;
|
||||
var deleteVpnCustomerGatewayIntervalID = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobid=" + jid),
|
||||
url: createURL("queryAsyncJobResult&jobId=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(createvpnconnectionIntervalID);
|
||||
|
||||
if (result.jobstatus == 1) {
|
||||
//remove loading image on table row
|
||||
var $listviewTable = $("div.list-view div.data-table table.body tbody");
|
||||
var $tr1 = $listviewTable.find("tr.loading").removeClass("loading");
|
||||
$tr1.find("td div.loading").removeClass("loading");
|
||||
|
||||
var item = result.jobresult.vpnconnection;
|
||||
$tr1.find("td.publicip span").text(item.publicip);
|
||||
|
||||
cloudStack.dialog.notice({ message: "site-to-site VPN is created successfully." });
|
||||
else {
|
||||
clearInterval(deleteVpnCustomerGatewayIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: "site-to-site VPN has been deleted." });
|
||||
$.removeDetailViewAndTableRow();
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
$.removeTableRowInAction();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
else if (result.jobstatus == 2) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$.removeTableRowInAction();
|
||||
error: function(XMLHttpResponse) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
detailView: {
|
||||
name: 'label.details',
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'label.details',
|
||||
fields: [
|
||||
{
|
||||
id: { label: 'label.id' },
|
||||
|
||||
//s2svpngatewayid: { label: 'VPN gateway ID' },
|
||||
publicip: { label: 'label.ip.address' },
|
||||
|
||||
//s2scustomergatewayid: { label: 'Customer gateway ID' },
|
||||
gateway: { label: 'label.gateway' },
|
||||
cidrlist: { label: 'CIDR list' },
|
||||
ipsecpsk: { label: 'IPsec Preshared-Key' },
|
||||
ikepolicy: { label: 'IKE policy' },
|
||||
esppolicy: { label: 'ESP policy' },
|
||||
lifetime: { label: 'Lifetime (second)' },
|
||||
|
||||
created: { label: 'label.date', converter: cloudStack.converters.toLocalDate }
|
||||
}
|
||||
],
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listVpnConnections&id=" + args.context.siteToSiteVpn[0].id),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var item = json.listvpnconnectionsresponse.vpnconnection[0];
|
||||
args.response.success({data: item});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
restart: {
|
||||
label: 'Reset VPN connection',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm that you want to reset VPN connection' ;
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Reset VPN connection';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("resetVpnConnection"),
|
||||
data: {
|
||||
id: args.context.siteToSiteVpn[0].id
|
||||
},
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.resetvpnconnectionresponse.jobid;
|
||||
args.response.success(
|
||||
{_custom:
|
||||
{
|
||||
jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.vpnconnection;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
remove: {
|
||||
label: 'delete site-to-site VPN',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm that you want to delete this site-to-site VPN';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'delete site-to-site VPN';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("deleteVpnConnection"),
|
||||
dataType: "json",
|
||||
data: {
|
||||
id: args.context.siteToSiteVpn[0].id
|
||||
},
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.deletevpnconnectionresponse.jobid;
|
||||
var deleteVpnConnectionIntervalID = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobId=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(deleteVpnConnectionIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
$.ajax({
|
||||
url: createURL("deleteVpnGateway"),
|
||||
dataType: "json",
|
||||
data: {
|
||||
id: args.context.siteToSiteVpn[0].s2svpngatewayid
|
||||
},
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.deletevpngatewayresponse.jobid;
|
||||
var deleteVpnGatewayIntervalID = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobId=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(deleteVpnGatewayIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
$.ajax({
|
||||
url: createURL("deleteVpnCustomerGateway"),
|
||||
dataType: "json",
|
||||
data: {
|
||||
id: args.context.siteToSiteVpn[0].s2scustomergatewayid
|
||||
},
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var jid = json.deletecustomergatewayresponse.jobid;
|
||||
var deleteVpnCustomerGatewayIntervalID = setInterval(function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobId=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(deleteVpnCustomerGatewayIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: "site-to-site VPN has been deleted." });
|
||||
$.removeDetailViewAndTableRow();
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$("div.detail-view div.loading-overlay").remove();
|
||||
cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} //end listView
|
||||
},//end site-to-siteVPN
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tiers: {
|
||||
actionPreFilter: function(args) {
|
||||
var tier = args.context.tiers[0];
|
||||
|
|
|
|||
Loading…
Reference in New Issue