From d6e2bdd419e1d77561066e3b7202587497c5fd48 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand <benjamin.bertrand@ess.eu> Date: Thu, 16 Apr 2020 11:15:56 +0200 Subject: [PATCH] Add tooltip on search box Tooltip only added when server side processing is used. JIRA INFRA-1893 #action In Progress --- app/static/js/csentry.js | 14 ++++++++++++++ app/static/js/groups.js | 2 ++ app/static/js/hosts.js | 2 ++ app/static/js/items.js | 2 ++ 4 files changed, 20 insertions(+) diff --git a/app/static/js/csentry.js b/app/static/js/csentry.js index b978aa4..cbb0d7a 100644 --- a/app/static/js/csentry.js +++ b/app/static/js/csentry.js @@ -104,6 +104,20 @@ function update_stack_member() { ); } +// Function to initialize tooltip on DataTables search box +// Only used when using server side processing +function configure_search_tooltip() { + $(".dataTables_filter").tooltip({ + title: + "Enter keyword(s) or use wildcard character '*' for partial match. See the help for more information.", + }); + + // Hide the tooltip when clicking in the search box + $("input[type='search'").focus(function () { + $(".dataTables_filter").tooltip("hide"); + }); +} + $(document).ready(function () { // When an invalid input was submitted, the server // adds the "is-invalid" class to form fields to display diff --git a/app/static/js/groups.js b/app/static/js/groups.js index 20262b9..1378d3b 100644 --- a/app/static/js/groups.js +++ b/app/static/js/groups.js @@ -114,5 +114,7 @@ $(document).ready(function () { .buttons() .container() .appendTo("#groups_table_wrapper .col-md-3:eq(0)"); + + configure_search_tooltip(); } }); diff --git a/app/static/js/hosts.js b/app/static/js/hosts.js index dcfa056..031a207 100644 --- a/app/static/js/hosts.js +++ b/app/static/js/hosts.js @@ -196,5 +196,7 @@ $(document).ready(function () { .buttons() .container() .appendTo("#hosts_table_wrapper .col-md-3:eq(0)"); + + configure_search_tooltip(); } }); diff --git a/app/static/js/items.js b/app/static/js/items.js index 2ddbb68..016b683 100644 --- a/app/static/js/items.js +++ b/app/static/js/items.js @@ -144,4 +144,6 @@ $(document).ready(function () { .container() .appendTo("#items_table_wrapper .col-md-3:eq(0)"); } + + configure_search_tooltip(); }); -- GitLab