commit 62f6a21: [WebUI] Fix "Clean history" button

moisseev moiseev at mezonplus.ru
Wed Apr 5 19:00:03 UTC 2023


Author: moisseev
Date: 2023-04-05 17:07:31 +0300
URL: https://github.com/rspamd/rspamd/commit/62f6a211838d8ebb48fa9acca773b123a820231f

[WebUI] Fix "Clean history" button
enabling/disabling in the Scan tab

---
 interface/index.html       | 2 +-
 interface/js/app/upload.js | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/interface/index.html b/interface/index.html
index 61ecc5b2e..2fad32b2f 100644
--- a/interface/index.html
+++ b/interface/index.html
@@ -493,7 +493,7 @@
 								</select>
 							<label for="scan_page_size" class="ms-2">Rows per page:</label>
 							<input id="scan_page_size" class="form-control ms-1" value="25" min="1" type="number">
-							<button class="btn btn-secondary btn-sm ms-2" id="cleanScanHistory">
+							<button class="btn btn-secondary btn-sm ms-2" id="cleanScanHistory" disabled>
 								<i class="fas fa-trash-alt"></i> Clean history
 							</button>
 						</div>
diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js
index 59cd7514e..f9f6c53c6 100644
--- a/interface/js/app/upload.js
+++ b/interface/js/app/upload.js
@@ -152,6 +152,7 @@ define(["jquery"],
                     function scrollTop(rows_total) {
                         // Is there a way to get an event when all rows are loaded?
                         rspamd.waitForRowsDisplayed("scan", rows_total, function () {
+                            $("#cleanScanHistory").removeAttr("disabled", true);
                             $("html, body").animate({
                                 scrollTop: $("#scanResult").offset().top
                             }, 1000);
@@ -210,10 +211,11 @@ define(["jquery"],
                 }
                 rspamd.destroyTable("scan");
                 rspamd.symbols.scan.length = 0;
+                $("#cleanScanHistory").attr("disabled", true);
             });
 
             function enable_disable_scan_btn() {
-                $("#scan button:not(#scanOptionsToggle)").prop("disabled", ($.trim($("textarea").val()).length === 0));
+                $("#scan button:not(#cleanScanHistory, #scanOptionsToggle)").prop("disabled", ($.trim($("textarea").val()).length === 0));
             }
             enable_disable_scan_btn();
             $("textarea").on("input", function () {
@@ -221,7 +223,7 @@ define(["jquery"],
             });
 
             $("#scanClean").on("click", function () {
-                $("#scan button:not(#scanOptionsToggle)").attr("disabled", true);
+                $("#scan button:not(#cleanScanHistory, #scanOptionsToggle)").attr("disabled", true);
                 $("#scanForm")[0].reset();
                 $("#scanResult").hide();
                 $("#scanOutput tbody").remove();


More information about the Commits mailing list