From ab7b6ecb2972132700c077a7fb106827e1aea7a1 Mon Sep 17 00:00:00 2001 From: Matthieu Leproux Date: Thu, 7 Oct 2021 14:48:24 +0200 Subject: [PATCH] related to #1465 removing the lines when api is called and added spinner during infos fetch time --- admin/themes/default/js/history.js | 12 +++++++----- admin/themes/default/template/history.tpl | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/admin/themes/default/js/history.js b/admin/themes/default/js/history.js index f25935937..7a3ecbe04 100644 --- a/admin/themes/default/js/history.js +++ b/admin/themes/default/js/history.js @@ -76,7 +76,6 @@ $(document).ready(() => { }); $(".refresh-results").on("click", function () { - $(this).addClass("animate-spin") fillHistoryResult(current_param); }) }) @@ -166,14 +165,18 @@ function fillSummaryResult(summary) { function fillHistoryResult(ajaxParam) { // console.log(current_param); - + // $(".tab .search-line").remove(); $.ajax({ url: API_METHOD, method: "POST", dataType: "JSON", data: ajaxParam, - success: function (raw_data) { + beforeSend: function () { + $(".tab .search-line").remove(); $(".loading").removeClass("hide"); + }, + success: function (raw_data) { + data = raw_data.result["lines"]; imageDisplay = raw_data.result["params"].display_thumbnail; maxPage = raw_data.result["maxPage"]; @@ -181,7 +184,7 @@ function fillHistoryResult(ajaxParam) { // console.log(raw_data); //clear lines before refill - $(".tab .search-line").remove(); + var id = 0; data.forEach(line => { @@ -198,7 +201,6 @@ function fillHistoryResult(ajaxParam) { activateLineOptions(); $(".loading").addClass("hide"); updatePagination(maxPage); - $(".refresh-results").removeClass("animate-spin") }) } diff --git a/admin/themes/default/template/history.tpl b/admin/themes/default/template/history.tpl index 6c30bf791..5dfe382d2 100644 --- a/admin/themes/default/template/history.tpl +++ b/admin/themes/default/template/history.tpl @@ -677,4 +677,8 @@ jQuery(document).ready( function() { #start_unset:hover, #end_unset:hover { color: #ffa500; } + +.loading { + font-size: 25px; +} \ No newline at end of file