From 31fdaf5e555c3a5bf7252fcf501122a332c77c4e Mon Sep 17 00:00:00 2001 From: ajugo Date: Thu, 1 Jun 2023 09:52:58 +0200 Subject: [PATCH] Remove search terms on datatable refresh [SCI-8574] (#5533) --- .../javascripts/label_templates/label_templates_datatable.js | 5 ++++- app/assets/javascripts/protocols/index.js | 3 +++ app/assets/javascripts/reports/reports_datatable.js | 4 ++++ app/assets/javascripts/repositories/index.js | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/label_templates/label_templates_datatable.js b/app/assets/javascripts/label_templates/label_templates_datatable.js index ff0bff81b..0c153a9d2 100644 --- a/app/assets/javascripts/label_templates/label_templates_datatable.js +++ b/app/assets/javascripts/label_templates/label_templates_datatable.js @@ -1,5 +1,5 @@ /* global I18n DataTableHelpers HelperModule */ -/* eslint-disable no-use-before-define */ +/* eslint-disable no-use-before-define no-param-reassign */ (function() { 'use strict'; @@ -282,6 +282,9 @@ initRefreshFluicsButton(); window.initActionToolbar(); window.actionToolbarComponent.setBottomOffset(68); + }, + stateLoadParams: function(_, state) { + state.search.search = ''; } }); } diff --git a/app/assets/javascripts/protocols/index.js b/app/assets/javascripts/protocols/index.js index 390001dc4..444148cf8 100644 --- a/app/assets/javascripts/protocols/index.js +++ b/app/assets/javascripts/protocols/index.js @@ -269,6 +269,9 @@ var ProtocolsIndex = (function() { initProtocolsFilters(); initRowSelection(); }, + stateLoadParams: function(_, state) { + state.search.search = ''; + }, stateLoadCallback: function() { // Load the table state for the current team var state = localStorage.getItem(`datatables_protocols_state/${protocolsTableEl.data('team-id')}/${repositoryType}`); diff --git a/app/assets/javascripts/reports/reports_datatable.js b/app/assets/javascripts/reports/reports_datatable.js index 72ac61fa1..f97a2073e 100644 --- a/app/assets/javascripts/reports/reports_datatable.js +++ b/app/assets/javascripts/reports/reports_datatable.js @@ -1,4 +1,5 @@ /* global I18n DataTableHelpers DataTableCheckboxes animateSpinner HelperModule Promise */ +/* eslint-disable no-param-reassign */ (function() { 'use strict'; @@ -238,6 +239,9 @@ }, rowCallback: function(row) { if (CHECKBOX_SELECTOR) CHECKBOX_SELECTOR.checkRowStatus(row); + }, + stateLoadParams: function(_, state) { + state.search.search = ''; } }); } diff --git a/app/assets/javascripts/repositories/index.js b/app/assets/javascripts/repositories/index.js index 6d5522302..7305279ea 100644 --- a/app/assets/javascripts/repositories/index.js +++ b/app/assets/javascripts/repositories/index.js @@ -1,5 +1,6 @@ /* global I18n animateSpinner HelperModule DataTableHelpers DataTableCheckboxes notTurbolinksPreview */ +/* eslint-disable no-param-reassign */ (function() { 'use strict'; @@ -140,6 +141,9 @@ } if (CHECKBOX_SELECTOR) CHECKBOX_SELECTOR.checkRowStatus(row); + }, + stateLoadParams: function(_, state) { + state.search.search = ''; } }); });