cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [2/2] git commit: updated refs/heads/master to c94cb0f
Date Mon, 08 Jul 2013 17:58:26 GMT
CLOUDSTACK-3153: On reorder, only update target ACL item's number


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

Branch: refs/heads/master
Commit: c94cb0fc41591a29d178877f34c9139485b67c38
Parents: 1b86759
Author: Brian Federle <brian.federle@citrix.com>
Authored: Mon Jul 8 10:58:04 2013 -0700
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Mon Jul 8 10:58:04 2013 -0700

----------------------------------------------------------------------
 ui/scripts/ui/widgets/multiEdit.js | 15 ++++++++---
 ui/scripts/vpc.js                  | 46 +++++++++++++++++----------------
 2 files changed, 36 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c94cb0fc/ui/scripts/ui/widgets/multiEdit.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js
index 26a6bdb..08bd0bf 100755
--- a/ui/scripts/ui/widgets/multiEdit.js
+++ b/ui/scripts/ui/widgets/multiEdit.js
@@ -833,15 +833,24 @@ $.fn.multiEdit = function(args) {
       handle: '.action.moveDrag',
       
       update: function(event, ui) {
+        var $loading = $('<div>').addClass('loading-overlay');
+
+        $loading.prependTo($multi);
         reorder.moveDrag.action({
+          targetIndex: ui.item.index(),
           context: $.extend(true, {}, context, {
             // Passes all rules, so that each index can be updated
-            multiRule: $multi.find('.data-item').map(function(index, item) {
-              return $(item).data('json-obj');
-            })
+            multiRule: [ui.item.data('json-obj')]
           }),
           response: {
             success: function(args) {
+              $multi.trigger('refresh');
+              $loading.remove();
+            },
+            error: function(msg) {
+              $multi.trigger('refresh');
+              cloudStack.dialog.notice(msg);
+              $loading.remove();
             }
           }
         });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c94cb0fc/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index efa987f..d2c8134 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -30,28 +30,30 @@
     reorder: {
       moveDrag: {
         action: function(args) {
-          $(args.context.multiRule.toArray().reverse()).map(function(index, rule) {
-            $.ajax({
-              url: createURL('updateNetworkACLItem'),
-              data: {
-                id: rule.id,
-                number: index + 1
-              },
-              success: function(json) {
-                var pollTimer = setInterval(function() {
-                  pollAsyncJobResult({
-                    _custom: { jobId: json.createnetworkaclresponse.jobid },
-                    complete: function() {
-                      clearInterval(pollTimer);
-                    },
-                    error: function(errorMsg) {
-                      clearInterval(pollTimer);                      
-                      cloudStack.dialog.notice(errorMsg);
-                    }
-                  });
-                }, 1000);               
-              }
-            });
+          var rule = args.context.multiRule[0];
+          var index = args.targetIndex;
+
+          $.ajax({
+            url: createURL('updateNetworkACLItem'),
+            data: {
+              id: rule.id,
+              number: index + 1
+            },
+            success: function(json) {
+              var pollTimer = setInterval(function() {
+                pollAsyncJobResult({
+                  _custom: { jobId: json.createnetworkaclresponse.jobid },
+                  complete: function() {
+                    clearInterval(pollTimer);
+                    args.response.success();
+                  },
+                  error: function(errorMsg) {
+                    clearInterval(pollTimer);                      
+                    args.response.error(parseXMLHttpResponse(errorMsg));
+                  }
+                });
+              }, 1000);               
+            }
           });
         }
       }


Mime
View raw message