Project

General

Profile

Actions

Feature #40901

closed

Disable custom query links while loading to prevent multiple requests

Added by Mizuki ISHIKAWA 6 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
UI
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

In scenarios where custom queries involve complex conditions, accessing the destination via the query link might take some time. During this waiting period, users might click the link multiple times, causing unnecessary server load. To prevent this, we propose adding the :disable_with option to the link.
This feature will disable the link once it is clicked and preventing multiple submissions. This approach not only enhances the user experience by reducing confusion but also helps maintain optimal server performance.

For more information on the :disable_with option, you can refer to the official Rails documentation https://api.rubyonrails.org/v5.0/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to

The following code can be used to add disable_with:

diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index 453149436..47f7db0f2 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -507,7 +507,8 @@ module QueriesHelper
                       link_to(query.name,
                               url_params.merge(:query_id => query),
                               :class => css,
-                              :title => query.description) +
+                              :title => query.description,
+                              :data => { :disable_with => query.name }) +
                         clear_link.html_safe)
         end.join("\n").html_safe,
         :class => 'queries'

Actions #1

Updated by Go MAEDA 6 months ago

  • Tracker changed from Patch to Feature
  • Subject changed from Adding disable_with option to Custom Query Links to Disable custom query links while loading to prevent multiple requests
  • Target version set to 6.0.0

Setting the target version to 6.0.0.

Actions #2

Updated by Go MAEDA 6 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r22901. Thank you.

Actions

Also available in: Atom PDF