From fb165ae368f902b54cfc5a4f1b0df6339673565e Mon Sep 17 00:00:00 2001 From: Andreas Knab Date: Mon, 18 Mar 2024 13:42:08 -0400 Subject: [PATCH] Print timing to console --- .../webclient/javascript/ome.progress_overlay.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/omeroweb/webclient/static/webclient/javascript/ome.progress_overlay.js b/omeroweb/webclient/static/webclient/javascript/ome.progress_overlay.js index b40a136a75..e9010a4ef2 100644 --- a/omeroweb/webclient/static/webclient/javascript/ome.progress_overlay.js +++ b/omeroweb/webclient/static/webclient/javascript/ome.progress_overlay.js @@ -6,10 +6,12 @@ * or repeated before it is completed. * @param promise When this promise resolves (successfully or otherwise) the overlay closes * @param message The optional message to display (defaults to "Please wait") + * @param quiet Don't print timing to console * @returns {*|jQuery} The jQuery element holding the dialog; no need to do anything with it */ -OME.progress_overlay = function (promise, message) { +OME.progress_overlay = function (promise, message, quiet) { 'use strict'; + const startTime = new Date().getTime(); const dialog = $('
' + (message || 'Please wait') + '
') .appendTo(document.body) .dialog({ @@ -22,7 +24,12 @@ OME.progress_overlay = function (promise, message) { 'ui-dialog': 'ome-modal-progress', } }); - promise.finally(() => dialog.dialog('destroy').remove()); + promise.finally(() => { + dialog.dialog('destroy').remove(); + if (!quiet) { + window.console.log('UI blocked for ' + (new Date().getTime() - startTime).toString() + 'ms'); + } + }); return dialog; };