mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
Add API calls to update ACL item order on drag-and-drop
This commit is contained in:
parent
ff58052d2c
commit
ea440f2593
@ -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) {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user