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 <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2022-01-17 15:45:06 +01:00 committed by Fridolin Somers
parent 0b71d861eb
commit 0fa0f486c5
2 changed files with 9 additions and 1 deletions

View File

@ -114,7 +114,7 @@ a.add, a.delete {
</ol>
</div>
<form method="post">
<form id="es_mappings" method="post">
<div id="tabs" class="toptabs ui-tabs" style="clear:both">
<ul>
<li><a href="#search_fields">Search fields</a></li>

View File

@ -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();
});
});