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: updated refs/heads/4.2 to 585fdd9
Date Wed, 24 Jul 2013 18:04:47 GMT
Updated Branches:
  refs/heads/4.2 5009d3b82 -> 585fdd978
  refs/heads/master cd51303f2 -> bcfe4c2e9


CLOUDSTACK-3153: Fix numbering of ACL items

Re-number dragged items in increments of ten, and use an average of
the previous and next number, so that multiple reorders can occur
before conflicts happen.


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

Branch: refs/heads/4.2
Commit: 585fdd9781742a7355f29e7316ada62bef2aca42
Parents: 5009d3b
Author: Brian Federle <brian.federle@citrix.com>
Authored: Wed Jul 24 11:04:22 2013 -0700
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Wed Jul 24 11:04:29 2013 -0700

----------------------------------------------------------------------
 ui/scripts/ui/widgets/multiEdit.js |  2 ++
 ui/scripts/vpc.js                  | 16 ++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585fdd97/ui/scripts/ui/widgets/multiEdit.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js
index 83d1e52..5e30d03 100755
--- a/ui/scripts/ui/widgets/multiEdit.js
+++ b/ui/scripts/ui/widgets/multiEdit.js
@@ -854,6 +854,8 @@
                     $loading.prependTo($multi);
                     reorder.moveDrag.action({
                         targetIndex: ui.item.index(),
+                        nextItem: ui.item.next().size() ? ui.item.next().data('json-obj')
: null,
+                        prevItem: ui.item.prev().size() ? ui.item.prev().data('json-obj')
: null,
                         context: $.extend(true, {}, context, {
                             // Passes all rules, so that each index can be updated
                             multiRule: [ui.item.data('json-obj')]

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585fdd97/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index 0b670dd..94a42f5 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -31,13 +31,25 @@
             moveDrag: {
                 action: function(args) {
                     var rule = args.context.multiRule[0];
-                    var index = args.targetIndex;
+                    var number = 0;
+                    var prevItem = args.prevItem ? args.prevItem.number : null;
+                    var nextItem = args.nextItem ? args.nextItem.number : null;
+
+                    if (!nextItem) { // Last item
+                        number = prevItem + 100;
+                    } else {
+                        if (nextItem - prevItem <= 10) {
+                            number = nextItem - parseInt(((nextItem - prevItem) / 2));
+                        } else {
+                            number = nextItem > 1 ? nextItem - 10 : 1;
+                        }
+                    }
 
                     $.ajax({
                         url: createURL('updateNetworkACLItem'),
                         data: {
                             id: rule.id,
-                            number: index + 1
+                            number: number
                         },
                         success: function(json) {
                             var pollTimer = setInterval(function() {


Mime
View raw message