issue 593 - batch manager block deletion; simpler php code + exact progress feed back ...

This commit is contained in:
modus75
2017-01-10 21:24:25 +01:00
parent bf5b50c979
commit 37fc55e6b6
3 changed files with 28 additions and 27 deletions
+26 -19
View File
@@ -278,25 +278,32 @@ jQuery('#applyAction').click(function(e) {
continue;
}
queuedManager.add({
type: 'POST',
url: 'ws.php?format=json',
data: {
method: "pwg.images.delete",
pwg_token: jQuery("input[name=pwg_token").val(),
return_details: true,
image_id: image_ids.join(',')
},
dataType: 'json',
success: ( function(data) {
todo += data.result.nb_processed;
progressDelete(todo, progressBar_max, true)
}),
error: ( function(data) {
todo += deleteBlockSize; // TODO: might be not exact, if last query
progressDelete(todo, progressBar_max, false)
})
});
(function(ids) {
var thisBatchSize = ids.length;
queuedManager.add({
type: 'POST',
url: 'ws.php?format=json',
data: {
method: "pwg.images.delete",
pwg_token: jQuery("input[name=pwg_token").val(),
image_id: ids
},
dataType: 'json',
success: function(data) {
todo += thisBatchSize;
var isOk = data.stat && "ok" == data.stat;
if (isOk && data.result != thisBatchSize)
/*TODO: user feedback only data.result images out of thisBatchSize were deleted*/;
/*TODO: user feedback if isError*/
progressDelete(todo, progressBar_max, isOk);
},
error: function(data) {
todo += thisBatchSize;
/*TODO: user feedback*/
progressDelete(todo, progressBar_max, false);
}
});
} )(image_ids);
image_ids = Array();
}