Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C56C39A72 for ; Wed, 22 May 2013 22:50:29 +0000 (UTC) Received: (qmail 39632 invoked by uid 500); 22 May 2013 22:50:29 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 39600 invoked by uid 500); 22 May 2013 22:50:29 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 39593 invoked by uid 99); 22 May 2013 22:50:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 May 2013 22:50:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3BBBA893BF6; Wed, 22 May 2013 22:50:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bfederle@apache.org To: commits@cloudstack.apache.org Message-Id: <47439b11d910402d8e4763cd25776587@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/ui-vpc-redesign to ea440f2 Date: Wed, 22 May 2013 22:50:29 +0000 (UTC) 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 Authored: Wed May 22 15:50:19 2013 -0700 Committer: Brian Federle 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($('').append($(''))); $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) { $('
').addClass('reorder').appendTo($thead); $('').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); + } + }); + }); } } },