|
@@ -4,6 +4,7 @@ $(document).delegate( '.js-bartend', 'click', function () {
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/ajax/bartender.php',
|
|
|
+// type: 'post',
|
|
|
data: {
|
|
|
action: 'shake',
|
|
|
dossier: $(this).data('dossier'),
|
|
@@ -27,10 +28,13 @@ $(document).delegate( '.js-bartend', 'click', function () {
|
|
|
|
|
|
|
|
|
function status () {
|
|
|
+ var deferreds = [];
|
|
|
+ var need_refresh = 0;
|
|
|
+
|
|
|
$('.js-status').each( function () {
|
|
|
var statusdiv = $(this);
|
|
|
|
|
|
- $.ajax({
|
|
|
+ deferreds.push($.ajax({
|
|
|
url: '/ajax/bartender.php',
|
|
|
data: {
|
|
|
action: 'status',
|
|
@@ -46,12 +50,17 @@ function status () {
|
|
|
statusdiv.find('.js-time-placeholder').text(data.time);
|
|
|
|
|
|
if (data.status === 'IN_PROGRESS') // on relance la vérif de statut dans 3s pour voir si la compil est terminée
|
|
|
- setTimeout(status,3000);
|
|
|
+ need_refresh++;
|
|
|
},
|
|
|
error: function () {
|
|
|
alert("Je n'ai pas pu contacter le barman pour le statut de compilation...");
|
|
|
}
|
|
|
- });
|
|
|
+ }));
|
|
|
+ });
|
|
|
+
|
|
|
+ $.when.apply($,deferreds).done( function () {
|
|
|
+ if (need_refresh > 0)
|
|
|
+ setTimeout(status,3000);
|
|
|
});
|
|
|
}
|
|
|
$(document).ready( function () {
|