You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/03/18 20:33:38 UTC

[GitHub] rafaelweingartner commented on a change in pull request #2494: [CLOUDSTACK-10329] Button in ACL rules page to export all rules as a CSV file

rafaelweingartner commented on a change in pull request #2494: [CLOUDSTACK-10329] Button in ACL rules page to export all rules as a CSV file
URL: https://github.com/apache/cloudstack/pull/2494#discussion_r175302601
 
 

 ##########
 File path: ui/scripts/vpc.js
 ##########
 @@ -15,6 +15,53 @@
 // specific language governing permissions and limitations
 // under the License.
 (function($, cloudStack) {
+    var isNumeric = function (n) {
+        return !isNaN(parseFloat(n));
+    };
+    var createSafeCsvValue = function(value){
+        if(value){
+            return '"' + value + '"';
 
 Review comment:
   @nitin-maharana thanks for the review, but I did not quite understand your question.
   Here is an example of CSV generated using the code of this PR:
   ```
   "id","#Rule","CIDR","Action","Protocol","#Protocol","Start Port","End Port","ICMP Type","ICMP Code","Traffic Type","Reason"
   "ef06c57e-dc8b-40d9-a461-5a30072384ab","2","19.168.56.0/12","Allow","all",,,,,,"Ingress",
   "45835dfb-260c-461d-8051-444ac764151e","102","19.168.56.0/12","Allow","tcp",,"1","1",,,"Ingress",
   ```
   
   I am using this `createSafeCsvValue ` to enclose the value with double quotes, which will avoid problems with values that may have commas in them. If you open the file generated with this code in Excel, it is transparent for users.

----------------------------------------------------------------
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