Skip to content

Commit 10380ce

Browse files
committed
CLOUDSTACK-768:ACLs on Private GATEWAY
1 parent b5bb9f2 commit 10380ce

1 file changed

Lines changed: 130 additions & 8 deletions

File tree

‎ui/scripts/vpc.js‎

Lines changed: 130 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,32 @@
723723
isBoolean:true,
724724
isChecked:false
725725

726-
}
726+
},
727+
728+
aclid:{
729+
label:'ACL',
730+
select:function(args){
731+
$.ajax({
732+
url: createURL('listNetworkACLLists'),
733+
dataType: 'json',
734+
async: true,
735+
success: function(json) {
736+
var objs = json.listnetworkacllistsresponse.networkacllist;
737+
var items = [];
738+
$(objs).each(function() {
739+
if(this.name == "default_deny")
740+
items.unshift({id:this.id,description:this.name});
741+
else
742+
items.push({id: this.id, description: this.name});
743+
744+
745+
});
746+
args.response.success({data: items});
747+
}
748+
});
727749

728-
750+
}
751+
}
729752
}
730753
},
731754
action: function(args) {
@@ -745,7 +768,9 @@
745768
ipaddress: args.data.ipaddress,
746769
gateway: args.data.gateway,
747770
netmask: args.data.netmask,
748-
vlan: args.data.vlan
771+
vlan: args.data.vlan,
772+
aclid:args.data.aclid
773+
749774
},
750775
success: function(json) {
751776
var jid = json.createprivategatewayresponse.jobid;
@@ -834,11 +859,34 @@
834859
isBoolean:true,
835860
isChecked:false
836861

837-
}
862+
},
838863

839-
}
864+
aclid:{
865+
label:'ACL',
866+
select:function(args){
867+
$.ajax({
868+
url: createURL('listNetworkACLLists'),
869+
dataType: 'json',
870+
async: true,
871+
success: function(json) {
872+
var objs = json.listnetworkacllistsresponse.networkacllist;
873+
var items = [];
874+
$(objs).each(function() {
875+
if(this.name == "default_deny")
876+
items.unshift({id:this.id,description:this.name});
877+
else
878+
items.push({id: this.id, description: this.name});
879+
880+
881+
});
882+
args.response.success({data: items});
883+
}
884+
});
840885

886+
}
887+
}
841888

889+
}
842890

843891
},
844892
action:function(args){
@@ -851,15 +899,17 @@
851899
array1.push("&sourcenatsupported=false");
852900

853901

854-
$.ajax({
902+
$.ajax({
855903
url: createURL('createPrivateGateway'+ array1.join("")),
856904
data: {
857-
physicalnetworkid: args.data.physicalnetworkid,
905+
physicalnetworkid: args.data.physicalnetworkid,
858906
vpcid: args.context.vpc[0].id,
859907
ipaddress: args.data.ipaddress,
860908
gateway: args.data.gateway,
861909
netmask: args.data.netmask,
862-
vlan: args.data.vlan
910+
vlan: args.data.vlan,
911+
aclid:args.data.aclid
912+
863913
},
864914
success: function(json) {
865915
var jid = json.createprivategatewayresponse.jobid;
@@ -933,7 +983,77 @@
933983
notification: {
934984
poll: pollAsyncJobResult
935985
}
986+
},
987+
988+
replaceACL:{
989+
label:'Replace ACL',
990+
createForm:{
991+
title:'Replace ACL',
992+
label:'Replace ACL',
993+
fields:{
994+
aclid:{
995+
label:'ACL',
996+
select:function(args){
997+
$.ajax({
998+
url: createURL('listNetworkACLLists'),
999+
dataType: 'json',
1000+
async: true,
1001+
success: function(json) {
1002+
var objs = json.listnetworkacllistsresponse.networkacllist;
1003+
var items = [];
1004+
$(objs).each(function() {
1005+
1006+
items.push({id: this.id, description: this.name});
1007+
});
1008+
args.response.success({data: items});
1009+
}
1010+
});
1011+
}
9361012
}
1013+
}
1014+
},
1015+
1016+
action: function(args) {
1017+
$.ajax({
1018+
url: createURL("replaceNetworkACLList&gatewayid=" + args.context.vpcGateways[0].id + "&aclid=" + args.data.aclid ),
1019+
dataType: "json",
1020+
success: function(json) {
1021+
var jid = json.replacenetworkacllistresponse.jobid;
1022+
args.response.success(
1023+
1024+
{_custom:
1025+
{
1026+
jobId: jid,
1027+
getUpdatedItem: function(json) {
1028+
var item = json.queryasyncjobresultresponse.jobresult.aclid;
1029+
return {data:item};
1030+
}
1031+
}
1032+
}
1033+
1034+
)
1035+
},
1036+
1037+
error:function(json){
1038+
1039+
args.response.error(parseXMLHttpResponse(json));
1040+
}
1041+
});
1042+
},
1043+
1044+
notification: {
1045+
poll: pollAsyncJobResult
1046+
},
1047+
1048+
messages: {
1049+
confirm: function(args) {
1050+
return 'Do you want to replace the ACL with a new one ?';
1051+
},
1052+
notification: function(args) {
1053+
return 'ACL replaced';
1054+
}
1055+
}
1056+
}
9371057
},
9381058
tabs: {
9391059
details: {
@@ -975,6 +1095,8 @@
9751095
var allowedActions = [];
9761096
if(isAdmin()) {
9771097
allowedActions.push("remove");
1098+
allowedActions.push("replaceACL");
1099+
9781100
}
9791101
return allowedActions;
9801102
}

0 commit comments

Comments
 (0)