cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [1/2] git commit: refs/heads/ui-multiple-nics - Make primary IP default selection
Date Fri, 08 Mar 2013 18:51:45 GMT
Make primary IP default selection


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

Branch: refs/heads/ui-multiple-nics
Commit: 03135ce4fad97c2b0a6499d8204c85e51d0c8ce8
Parents: 3cea795
Author: Brian Federle <brian.federle@citrix.com>
Authored: Fri Mar 8 10:51:03 2013 -0800
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Fri Mar 8 10:51:03 2013 -0800

----------------------------------------------------------------------
 ui/scripts/network.js |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/03135ce4/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 9eb82f9..7ab2f20 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -52,14 +52,22 @@
       success: function(json) {
         var nic = json.listnics.nic[0];
         var ips = nic.secondaryip ? nic.secondaryip : [];
+        var ipSelection = [];
+
+        // Add primary IP as default
+        ipSelection.push({ id: -1, description: nic.ipaddress + ' (Primary)' });
+
+        // Add secondary IPs
+        $(ips).map(function(index, ip) {
+          ipSelection.push({
+            id: ip.ipaddress,
+            description: ip.ipaddress
+          });
+        }); 
+
 
         args.response.success({
-          data: $(ips).map(function(index, ip) {
-            return {
-              id: ip.ipaddress,
-              description: ip.ipaddress
-            };
-          })
+          data: ipSelection
         });
       }
     })
@@ -3098,7 +3106,7 @@
                           openfirewall: false
                         };
 
-                        if (args.itemData[0]._subselect) {
+                        if (args.itemData[0]._subselect && args.itemData[0]._subselect
!= -1) {
                           data.vmguestip = args.itemData[0]._subselect;
                         }
 


Mime
View raw message