incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject git commit: Apply same dataProvider map to both ingress and egress rules
Date Tue, 23 Oct 2012 00:21:04 GMT
Updated Branches:
  refs/heads/master 7fda33bbd -> d01bbb941


Apply same dataProvider map to both ingress and egress rules

-Because the dataProvider for both ingress and egress rules are
 handled the same, use a shared data mapping for both


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/d01bbb94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d01bbb94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d01bbb94

Branch: refs/heads/master
Commit: d01bbb9417a5978b19166694113fc4a43778ec23
Parents: 7fda33b
Author: Brian Federle <brian.federle@citrix.com>
Authored: Mon Oct 22 17:20:06 2012 -0700
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Mon Oct 22 17:20:48 2012 -0700

----------------------------------------------------------------------
 ui/scripts/network.js |   49 ++++++++++++++++++-------------------------
 1 files changed, 21 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d01bbb94/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index f1d46ed..66e9cfc 100644
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -16,6 +16,25 @@
 // under the License.
 
 (function(cloudStack, $) {
+  var ingressEgressDataMap = function(elem) {
+    var elemData = {
+      id: elem.ruleid,
+      protocol: elem.protocol,
+      startport: elem.startport,
+      endport: elem.endport,
+      cidr: elem.cidr ? elem.cidr : ''.concat(elem.account, ' - ', elem.securitygroupname)
+    };
+
+    if (elemData.startport == 0 && elemData.endport) {
+      elemData.startport = '0';
+    } else if (elem.icmptype && elem.icmpcode) {
+      elemData.startport = elem.icmptype;
+      elemData.endport = elem.icmpcode;
+    }
+
+    return elemData;
+  };
+  
   var ipChangeNotice = function() {
     cloudStack.dialog.confirm({
       message: 'message.ip.address.changed',
@@ -3470,15 +3489,7 @@
                           data: $.map(
                             data.listsecuritygroupsresponse.securitygroup[0].ingressrule
? 
                               data.listsecuritygroupsresponse.securitygroup[0].ingressrule
: [],
-                            function(elem) {
-                              return {
-                                id: elem.ruleid,
-                                protocol: elem.protocol,
-                                startport: elem.startport ? elem.startport : elem.icmptype,
-                                endport: elem.endport ? elem.endport : elem.icmpcode,
-                                cidr: elem.cidr ? elem.cidr : ''.concat(elem.account, ' -
', elem.securitygroupname)
-                              };
-                            }
+                            ingressEgressDataMap
                           )
                         });
                       }
@@ -3647,25 +3658,7 @@
                           data: $.map(
                             data.listsecuritygroupsresponse.securitygroup[0].egressrule ?

                               data.listsecuritygroupsresponse.securitygroup[0].egressrule
: [],
-                            
-                            function(elem) {
-                              var elemData = {
-                                id: elem.ruleid,
-                                protocol: elem.protocol,
-                                startport: elem.startport,
-                                endport: elem.endport,
-                                cidr: elem.cidr ? elem.cidr : ''.concat(elem.account, ' -
', elem.securitygroupname)
-                              };
-
-                              if (elemData.startport == 0 && elemData.endport) {
-                                elemData.startport = '0';
-                              } else if (elem.icmptype && elem.icmpcode) {
-                                elemData.startport = elem.icmptype;
-                                elemData.endport = elem.icmpcode;
-                              }
-
-                              return elemData;
-                            }
+                            ingressEgressDataMap
                           )
                         });
                       }


Mime
View raw message