From 14763a8773950937276ee4532174ee25692e3ace Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 17 Jan 2022 15:45:06 +0100 Subject: [PATCH] Bug 29893: Prevent ES mappings UI to remove hidden rows If you are editing ES mappings and you use the DataTable filtering option, the table won't contain all the mappings you have in the DB. If the form is submitted they will be removed and data will be lost! Test plan: Edit ES mappings, filter and submit the form. Confirm that the table are redrawn before the form submission which prevent data loss --- .../modules/admin/searchengine/elasticsearch/mappings.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt index 3f17b20e321..417b533b6ac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt @@ -114,7 +114,7 @@ a.add, a.delete { -
+
  • Search fields
  • diff --git a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js index 4b36850c4a2..4bc9225f011 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js +++ b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js @@ -82,4 +82,12 @@ $(document).ready(function () { $("#facet_biblios > table").tableDnD({ onDragClass: "dragClass highlighted-row", }); + + $("#es_mappings").on("submit", function(e){ + e.preventDefault(); + $("#search_fields_table").DataTable().search('').draw(); + $("#mapping_biblios_table").DataTable().search('').draw(); + $("#mapping_authorities_table").DataTable().search('').draw(); + this.submit(); + }); }); -- 2.25.1