From 621fb952272477815dd53e7a6866a752158627fd Mon Sep 17 00:00:00 2001
From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
Date: Mon, 3 Aug 2020 20:26:19 -0700
Subject: [PATCH] Auto-refresh export table if an item is processing
---
.../default/js/tables/export_table.js | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/data/interfaces/default/js/tables/export_table.js b/data/interfaces/default/js/tables/export_table.js
index 5853433b..9657f87b 100644
--- a/data/interfaces/default/js/tables/export_table.js
+++ b/data/interfaces/default/js/tables/export_table.js
@@ -93,7 +93,7 @@ export_table_options = {
if (cellData === 1 && rowData['exists']) {
$(td).html('');
} else if (cellData === 0) {
- $(td).html(' Processing');
+ $(td).html(' Processing');
} else if (cellData === -1) {
$(td).html(' Failed');
} else {
@@ -121,6 +121,13 @@ export_table_options = {
// Jump to top of page
//$('html,body').scrollTop(0);
$('#ajaxMsg').fadeOut();
+
+ if (timer) {
+ clearTimeout(timer);
+ }
+ if ($('.export-processing').length && $("#tabs-export").hasClass("active")) {
+ timer = setTimeout(redrawExportTable.bind(null, false), 5000);
+ }
},
"preDrawCallback": function(settings) {
var msg = " Fetching rows...";
@@ -150,9 +157,10 @@ $('.export_table').on('click', '> tbody > tr > td.export_delete > button', funct
var msg = 'Are you sure you want to delete the following export?
' + rowData['filename'] + '';
var url = 'delete_export?row_id=' + rowData['row_id'];
confirmAjaxCall(url, msg, null, null, redrawExportTable);
-
});
-function redrawExportTable() {
- export_table.draw();
-}
\ No newline at end of file
+function redrawExportTable(paging) {
+ export_table.draw(paging);
+}
+
+var timer;
\ No newline at end of file