cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] nvazquez commented on a change in pull request #2456: [CLOUDSTACK-10293] Single view network ACL rules listing
Date Thu, 01 Jan 1970 00:00:00 GMT
nvazquez commented on a change in pull request #2456: [CLOUDSTACK-10293] Single view network
ACL rules listing
URL: https://github.com/apache/cloudstack/pull/2456#discussion_r168984710
 
 

 ##########
 File path: ui/scripts/vpc.js
 ##########
 @@ -1333,35 +1321,65 @@
                                             $.ajax({
                                                 url: createURL('listNetworkACLs&aclid='
+ args.context.aclLists[0].id),
                                                 success: function(json) {
-                                                    var items = json.listnetworkaclsresponse.networkacl.sort(function(a,
b) {
-                                                        return a.number >= b.number;
-                                                    }).map(function(acl) {
-                                                        if (parseInt(acl.protocol)) { //
protocol number
-                                                            acl.protocolnumber = acl.protocol;
-                                                            acl.protocol = "protocolnumber";
-                                                        }
-
-                                                        return acl;
-                                                    });
+                                                    var items = json.listnetworkaclsresponse.networkacl;
+
+                                                    if(items){
+                                                        items.sort(function(a, b) {
+                                                            return a.number >= b.number;
+                                                        }).map(function(acl) {
+                                                            if (parseInt(acl.protocol)) {
// protocol number
+                                                                acl.protocolnumber = acl.protocol;
+                                                                acl.protocol = "protocolnumber";
+                                                            }
+    
+                                                            return acl;
+                                                        });
+                                                    }
 
                                                     args.response.success({
                                                         data: items
-                                                        /* {
-                               cidrlist: '10.1.1.0/24',
-                               protocol: 'TCP',
-                               startport: 22, endport: 22,
-                               networkid: 0,
-                               traffictype: 'Egress'
-                               },
-                               {
-                               cidrlist: '10.2.1.0/24',
-                               protocol: 'UDP',
-                               startport: 56, endport: 72,
-                               networkid: 0,
-                               trafficType: 'Ingress'
-                               }
-                               ]*/
                                                     });
+                                                    if(jQuery('#details-tab-aclRules').siblings('div.toolbar').children('div.add').size()
=== 0){
+                                                        var $addAclRuleDivButton = jQuery('<div>').addClass('button
add');
+                                                        var $spanAddAclRuleButtonMessage
= jQuery('<span>').html(_l('label.add.ACL'));
+                                                        
+                                                        $addAclRuleDivButton.html($spanAddAclRuleButtonMessage);
+                                                        $addAclRuleDivButton.click(function(){
+                                                        	cloudStack.dialog.createForm({
+                                                        		 form: {
+                                                                     title: 'label.add.rule',
+                                                                     desc: 'Create a new
ACL rule',
+                                                                     fields: aclRuleFields
+                                                                 },
+                                                                 after: function(argsLocal)
{
+                                                                	 var data = argsLocal.data;
+                                                                	 data.aclid = argsLocal.context.aclLists[0].id;
+                                                                	 if(data.protocol != 'icmp'){
+                                                                		 data.icmpcode = undefined;
+                                                                		 data.icmptype  = undefined;
+                                                                	 }
+                                                                	 if(data.protocol != 'protocolnumber'){
+                                                                		 data.protocolnumber =
undefined;
+                                                                	 }
+                                                                	 if(data.protocol === 'all'){
 
 Review comment:
   Shouldn't be safer to perform these checks on the server side depending on the protocol
parameter for createNetworkACL API method instead of undefining parameters to be sent?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message