cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject git commit: updated refs/heads/ui-vpc-redesign to ea440f2
Date Wed, 22 May 2013 22:50:29 GMT
Updated Branches:
  refs/heads/ui-vpc-redesign ff58052d2 -> ea440f259


Add API calls to update ACL item order on drag-and-drop


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

Branch: refs/heads/ui-vpc-redesign
Commit: ea440f2593b82344c1b2cc6437a2f7fc9ad68e9b
Parents: ff58052
Author: Brian Federle <brian.federle@citrix.com>
Authored: Wed May 22 15:50:19 2013 -0700
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Wed May 22 15:50:19 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea440f25/ui/scripts/ui/widgets/multiEdit.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js
index 14f379f..936c20c 100755
--- a/ui/scripts/ui/widgets/multiEdit.js
+++ b/ui/scripts/ui/widgets/multiEdit.js
@@ -34,6 +34,7 @@
 
       $item.append($('<table>').append($('<tbody>')));
       $tr = $('<tr>').appendTo($item.find('tbody'));
+      $item.data('json-obj', multiRule);
 
       if (itemData) {
         $tr.data('multi-edit-data', itemData);
@@ -828,7 +829,22 @@ $.fn.multiEdit = function(args) {
     $('<th>').addClass('reorder').appendTo($thead);
     $('<td>').addClass('reorder').appendTo($inputForm);
     $multi.find('.data-body').sortable({
-      handle: '.action.moveDrag'
+      handle: '.action.moveDrag',
+      
+      update: function(event, ui) {
+        reorder.moveDrag.action({
+          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');
+            })
+          }),
+          response: {
+            success: function(args) {
+            }
+          }
+        });
+      }
     });
   }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea440f25/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index 5c2f026..d27e1fc 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -30,7 +30,29 @@
     reorder: {
       moveDrag: {
         action: function(args) {
-          args.response.success();
+          $(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);               
+              }
+            });
+          });
         }
       }
     },


Mime
View raw message