You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/05/02 20:26:24 UTC

[1/3] git commit: updated refs/heads/4.4 to 0ef9c9a

Repository: cloudstack
Updated Branches:
  refs/heads/4.4 dd88720c9 -> 0ef9c9a1c


CLOUDSTACK-6438: WIP: If VM has additional IPs, keep showing in add screen


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

Branch: refs/heads/4.4
Commit: 0e002ffa84a11c7a2ce2e684959cb203e4cc860e
Parents: dd88720
Author: Brian Federle <br...@citrix.com>
Authored: Thu May 1 13:13:28 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Fri May 2 20:25:16 2014 +0200

----------------------------------------------------------------------
 ui/scripts/network.js | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e002ffa/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index f0141b6..10d5a05 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -3380,6 +3380,28 @@
                                                                         return item.id == instance.id;
                                                                     }).length;
 
+                                                                    // Check if there are any remaining IPs
+                                                                    if (!notExisting) {
+                                                                        $.ajax({
+                                                                            url: createURL('listNics'),
+                                                                            async: false,
+                                                                            data: {
+                                                                                virtualmachineid: instance.id
+                                                                            },
+                                                                            success: function(json) {
+                                                                                var nics = json.listnicsresponse.nic;
+
+                                                                                $(nics).map(function (index, nic) {
+                                                                                    if (nic.secondaryip) {
+                                                                                        notExisting = true;
+
+                                                                                        return false;
+                                                                                    }
+                                                                                });
+                                                                            }
+                                                                        })
+                                                                    }
+
                                                                     return nonAutoScale && isActiveState && notExisting;
                                                                 }
                                                             );


[3/3] git commit: updated refs/heads/4.4 to 0ef9c9a

Posted by da...@apache.org.
CLOUDSTACK-6438: Filter out existing IPs in dropdown


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

Branch: refs/heads/4.4
Commit: 0ef9c9a1c0fcfd1d0afd1b8ba70b8fc2e54713cd
Parents: 2ff3623
Author: Brian Federle <br...@citrix.com>
Authored: Thu May 1 15:38:26 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Fri May 2 20:26:12 2014 +0200

----------------------------------------------------------------------
 ui/scripts/network.js              | 23 +++++++++++++++--------
 ui/scripts/ui/widgets/multiEdit.js | 14 +++++++++++++-
 2 files changed, 28 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ef9c9a1/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index abfaac3..7a495c1 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -179,19 +179,26 @@
                     var primaryIp = nic.ipaddress;
                     var secondaryIps = nic.secondaryip ? nic.secondaryip : [];
                     var ipSelection = [];
+                    var existingIps = $(args.context.subItemData).map(
+                        function(index, item) { return item.itemIp; }
+                    );
 
                     // Add primary IP as default
-                    ipSelection.push({
-                        id: primaryIp,
-                        description: primaryIp + ' (Primary)'
-                    });
+                    if ($.inArray(primaryIp, existingIps) == -1) {
+                        ipSelection.push({
+                            id: primaryIp,
+                            description: primaryIp + ' (Primary)'
+                        });
+                    }
 
                     // Add secondary IPs
                     $(secondaryIps).map(function(index, secondaryIp) {
-                        ipSelection.push({
-                            id: secondaryIp.ipaddress,
-                            description: secondaryIp.ipaddress
-                        });
+                        if ($.inArray(secondaryIp.ipaddress, existingIps) == -1) {
+                            ipSelection.push({
+                                id: secondaryIp.ipaddress,
+                                description: secondaryIp.ipaddress
+                            });
+                        }
                     });
 
                     args.response.success({

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ef9c9a1/ui/scripts/ui/widgets/multiEdit.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js
index 367cc27..47e5f43 100755
--- a/ui/scripts/ui/widgets/multiEdit.js
+++ b/ui/scripts/ui/widgets/multiEdit.js
@@ -196,11 +196,21 @@
                     } else if (field.addButton && !options.noSelect) {
                         if (options.multipleAdd) {
                             $addButton.click(function() {
+                                var context = $.extend(true, {}, options.context);
+
                                 if ($td.hasClass('disabled')) return false;
 
+                                var $subItems = $td.closest('.data-item').find('.expandable-listing tr');
+
+                                if ($subItems.size()) {
+                                    context.subItemData = $subItems.map(function() {
+                                        return $(this).data('json-obj');
+                                    });
+                                }
+
                                 _medit.vmList($multi,
                                     options.listView,
-                                    options.context,
+                                    context,
                                     options.multipleAdd, _l('label.add.vms'),
                                     addItemAction, {
                                         multiRule: multiRule
@@ -820,6 +830,8 @@
                     var field = this;
                     var $tr = _medit.multiItem.itemRow(field, itemActions, multiRule, $tbody).appendTo($tbody);
 
+                    $tr.data('json-obj', field);
+
                     cloudStack.evenOdd($tbody, 'tr', {
                         even: function($elem) {
                             $elem.addClass('even');


[2/3] git commit: updated refs/heads/4.4 to 0ef9c9a

Posted by da...@apache.org.
CLOUDSTACK-6438: WIP: Add filtering to check against existing IPs


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

Branch: refs/heads/4.4
Commit: 2ff3623054eff9c1bbac7060bd568ba7406bef20
Parents: 0e002ff
Author: Brian Federle <br...@citrix.com>
Authored: Thu May 1 15:07:25 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Fri May 2 20:25:38 2014 +0200

----------------------------------------------------------------------
 ui/scripts/network.js | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff36230/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 10d5a05..abfaac3 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -3393,9 +3393,23 @@
 
                                                                                 $(nics).map(function (index, nic) {
                                                                                     if (nic.secondaryip) {
-                                                                                        notExisting = true;
+                                                                                        var targetIPs = $(nic.secondaryip).map(function (index, sip) {
+                                                                                            return sip.ipaddress;
+                                                                                        });
 
-                                                                                        return false;
+                                                                                        var lbIPs = $(itemData).map(function(index, item) { return item.itemIp; });
+
+                                                                                        targetIPs.push(nic.ipaddress);
+
+                                                                                        var matchingIPs = $.grep(targetIPs, function(item) {
+                                                                                            return $.inArray(item, lbIPs) > -1;
+                                                                                        });
+
+                                                                                        if (targetIPs.length - matchingIPs.length) {
+                                                                                            notExisting = true;
+
+                                                                                            return false;
+                                                                                        }
                                                                                     }
                                                                                 });
                                                                             }