lp1207744 Report templates loading duplicates user/mccanna/lp1207744-report-template-dupes-signoff
authorMike Risher <mrisher@catalyte.io>
Fri, 12 Jun 2020 22:17:44 +0000 (22:17 +0000)
committerTerran McCanna <tmccanna@georgialibraries.org>
Wed, 12 Aug 2020 21:44:18 +0000 (17:44 -0400)
When you repeatedly click the link to load a template on the reports
UI, the same template loads as many times as you click.  Address
this bug and prevent duplicate templates from loading.

Signed-off-by: Mike Risher <mrisher@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/web/reports/oils_rpt_folder_window.js

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/web/reports/oils_rpt_folder_window.js

index 488cba6..b971995 100644 (file)
@@ -5,7 +5,7 @@ var NG_NEW_TEMPLATE_INTERFACE = '/eg/staff/reporter/template/new';
 var NG_CLONE_TEMPLATE_INTERFACE = '/eg/staff/reporter/template/clone';
 var OILS_TEMPLATE_INTERFACE = 'xul/template_builder.xul';
 var OILS_LEGACY_TEMPLATE_INTERFACE = 'oils_rpt_builder.xhtml';
-
+var currentlyLoading = false;
 
 /* generic folder window class */
 oilsRptSetSubClass('oilsRptFolderWindow', 'oilsRptObject');
@@ -24,6 +24,8 @@ oilsRptFolderWindow.folderIdMap = {};
 
 // Here lie the contents of a specific folder
 oilsRptFolderWindow.prototype.draw = function(viaPaging) {
+       if (currentlyLoading) return; // avoids loading same data repeatedly
+       currentlyLoading=true;
 
        _debug('drawing folder window for ' + this.folderNode.folder.name() );
 
@@ -535,7 +537,6 @@ oilsRptFolderWindow.prototype.createSearchRequest = function() {
 }
 
 oilsRptFolderWindow.prototype.fetchFolderData = function(callback) {
-
        hideMe(DOM.oils_rpt_content_count_row_2);
        hideMe(DOM.oils_rpt_content_row_2);
 
@@ -605,6 +606,7 @@ oilsRptFolderWindow.prototype.fetchFolderData = function(callback) {
                                        }
                                );
                        }
+                       currentlyLoading=false;
                }
        );
        req.send();