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:26 UTC
[3/3] git commit: updated refs/heads/4.4 to 0ef9c9a
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');