[ https://issues.apache.org/jira/browse/CLOUDSTACK-10293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16368988#comment-16368988 ]
ASF GitHub Bot commented on CLOUDSTACK-10293: --------------------------------------------- rafaelweingartner 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_r169043024 ########## 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: Yes, and they are in fact already performed there. The point is that if some of these combinations are sent to the server side, such as ICMP codes and TCP protocol, the server side will throw an exception. That is why I am cleaning up undesired information here (based on the protocol selected). ---------------------------------------------------------------- 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: us...@infra.apache.org > Single view network ACL rules listing > ------------------------------------- > > Key: CLOUDSTACK-10293 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10293 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: Rafael Weingärtner > Assignee: Rafael Weingärtner > Priority: Major > Fix For: 4.12 > > > The ACL rules editing/addition page is not user-friendly. Users are not able > to see in a single view all of the detail of the ACL rule (they need to use a > scroll bar on the horizontal). The problem becomes worse when there are a > considerable number of rules. Therefore, we are proposing the following > changes: > # Instead of using the table to create new ACL, we can create a button like > the one presented in attached pictures, where users can click, and then a > modal popup would appear and users would be able to create the new ACL there. > This is similar to the workings of the ACL edit button. > # Remove the ability to add new ACL via table where they are presented. All > ACLs should be entered via the “New ACL” button. Therefore, the section “Add > ACL” would be removed as well; > # Move the action section of the list ACL table to the most left position; > > These changes would reduce the information in the table and facilitate users > to add new rules and easily edit them as well. -- This message was sent by Atlassian JIRA (v7.6.3#76005)