rhtyd commented on a change in pull request #2216: CLOUDSTACK-10027 Repeating 
the same list for Internal LB in VPC
URL: https://github.com/apache/cloudstack/pull/2216#discussion_r134490103
 
 

 ##########
 File path: ui/scripts/vpc.js
 ##########
 @@ -745,9 +745,22 @@
                         }
                     },
                     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('listLoadBalancers'),
+                            url: createURL('listLoadBalancers' + 
array1.join("")),
                             data: {
+                                page: args.page,
+                                pageSize: pageSize,
                                 networkid: args.context.networks[0].id,
 
 Review comment:
   Thanks @vedulasantosh, however, we can still improve the code, instead of 
putting the keys/values in an array, why not create a `data` object and push 
keys/values to it and directly give it to `$.ajax`. Furthermore, the nested 
`ifs and switch/case` can be clubbed together. Sorry to nitpick on this, your 
code is valid but it would be great if you can improve it further.
 
----------------------------------------------------------------
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


With regards,
Apache Git Services

Reply via email to