From c0c878c20b1259cc10b46ab60de7137d63d3cf49 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 10 Aug 2022 12:55:47 +0300 Subject: [PATCH] fix mass action --- client/src/views/export/modals/idle.js | 12 +++++++++--- client/src/views/modals/mass-action.js | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client/src/views/export/modals/idle.js b/client/src/views/export/modals/idle.js index f5945edf2c..19656422e9 100644 --- a/client/src/views/export/modals/idle.js +++ b/client/src/views/export/modals/idle.js @@ -106,7 +106,12 @@ define('views/export/modals/idle', ['views/modal', 'model'], function (Dep, Mode }); this.on('close', () => { - if (this.model.get('status') !== 'Pending') { + let status = this.model.get('status'); + + if ( + status !== 'Pending' && + status !== 'Running' + ) { return; } @@ -126,14 +131,15 @@ define('views/export/modals/idle', ['views/modal', 'model'], function (Dep, Mode .then(response => { let status = response.status; - if (status === 'Pending') { + this.model.set('status', status); + + if (status === 'Pending' || status === 'Running') { setTimeout(() => this.checkStatus(), this.checkInterval); return; } this.model.set({ - status: response.status, attachmentId: response.attachmentId, }); diff --git a/client/src/views/modals/mass-action.js b/client/src/views/modals/mass-action.js index b22407a687..3ad241aef3 100644 --- a/client/src/views/modals/mass-action.js +++ b/client/src/views/modals/mass-action.js @@ -106,7 +106,12 @@ define('views/modals/mass-action', ['views/modal', 'model'], function (Dep, Mode }); this.on('close', () => { - if (this.model.get('status') !== 'Pending') { + let status = this.model.get('status'); + + if ( + status !== 'Pending' && + status !== 'Running' + ) { return; } @@ -126,14 +131,15 @@ define('views/modals/mass-action', ['views/modal', 'model'], function (Dep, Mode .then(response => { let status = response.status; - if (status === 'Pending') { + this.model.set('status', status); + + if (status === 'Pending' || status === 'Running') { setTimeout(() => this.checkStatus(), this.checkInterval); return; } this.model.set({ - status: response.status, processedCount: response.processedCount, });