mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-3153: On reorder, only update target ACL item's number
This commit is contained in:
parent
1b86759f7a
commit
c94cb0fc41
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user