From 21e70d52f59c75b2d409c5ce7a08b66be8d25f32 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 Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall Signed-off-by: Kyle M Hall --- .../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 3f17b20e32..417b533b6a 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 4b36850c4a..4bc9225f01 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.39.5