How to block the refresh button in Report?

We have a certain script report that tends to hog a lot of system resources, and it seems that the query is accessing the disk leading to high cpu usage. I wish to have a short term solution till I can fix the MySQL configuration.

Is there a way to block the refresh the button till the query has finished and the report has been rendered ?

I’m assuming you’re on master branch V10. You can disable button in $("button:contains('Refresh')").prop("disabled",true) refresh function and enable refresh button in _refresh function (in callback frappe.call) $("button:contains('Refresh')").prop("disabled",false);.

Edit:
After made change
bench build

Or you can pass the refresh button object in frappe.call in the btn property. It will disable the button until the call has been executed.

Example:

https://github.com/frappe/erpnext/blob/master/erpnext/hub_node/page/hub/hub.js#L675

2 Likes