]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Replace deprecated `alert-error` class 5717/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 30 Oct 2025 10:50:53 +0000 (13:50 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 30 Oct 2025 11:48:41 +0000 (14:48 +0300)
Replaces the old Bootstrap 2.x `alert-error` class with the modern
`alert-danger` equivalent.

Also removes unused `.alert h4` rules that are no longer used in the UI.

This improves compatibility and ensures consistent styling with Bootstrap ≥3.

13 files changed:
interface/css/rspamd.css
interface/index.html
interface/js/app/common.js
interface/js/app/config.js
interface/js/app/graph.js
interface/js/app/history.js
interface/js/app/rspamd.js
interface/js/app/selectors.js
interface/js/app/stats.js
interface/js/app/upload.js
interface/js/main.js
test/playwright/tests/basic.spec.mjs
test/playwright/tests/config.spec.mjs

index 592905012fbd662bed9d8f5f580fd87ea75d05a2..d23dddac1681857ff305a9fd24b7705887a0bfde 100644 (file)
@@ -173,6 +173,7 @@ table#symbolsTable input[type="number"] {
 }
 .alert {
     margin-bottom: 4px;
+    color: #c09853;
 }
 .alert.alert-modal {
     top: 0;
@@ -181,39 +182,21 @@ table#symbolsTable input[type="number"] {
     display: inline-block;
     padding-left: 35px;
 }
-.alert,
-.alert h4 {
-    color: #c09853;
-}
-.alert h4 {
-    margin: 0;
-}
 .alert-success {
     color: #468847;
     background: #dff0d8;
     border-color: #d6e9c6;
 }
-.alert-success h4 {
-    color: #468847;
-}
-.alert-danger,
-.alert-error {
+.alert-danger {
     color: #b94a48;
     background: #f2dede;
     border-color: #eed3d7;
 }
-.alert-danger h4,
-.alert-error h4 {
-    color: #b94a48;
-}
 .alert-info {
     color: #3a87ad;
     background: #d9edf7;
     border-color: #bce8f1;
 }
-.alert-info h4 {
-    color: #3a87ad;
-}
 
 #authInvalidCharFeedback,
 #authUnauthorizedFeedback {
index c50d17fc6367b8ad8786d494f621f26d3e857f6c..1c12badf51c60e08f56b015dc7bfbb78166c6da7 100644 (file)
 
 <div class="notification-area">
        <noscript>
-       <div class="alert alert-error"><strong>Please enable JavaScript</strong></div>
+       <div class="alert alert-danger"><strong>Please enable JavaScript</strong></div>
     </noscript>
 </div>
 
index 86c01273ca6f05a055e709abb64085837dc2ed75..da3a40b3cde2fc032eddbb2ab315d91ec06db671 100644 (file)
@@ -103,7 +103,7 @@ define(["jquery", "nprogress"],
                 error: function (jqXHR, textStatus, errorThrown) {
                     neighbours_status[ind].checked = true;
                     function errorMessage() {
-                        alertMessage("alert-error", neighbours_status[ind].name + " > " +
+                        alertMessage("alert-danger", neighbours_status[ind].name + " > " +
                             (o.errorMessage ? o.errorMessage : "Request failed") +
                             (errorThrown ? ": " + errorThrown : ""));
                     }
@@ -129,7 +129,7 @@ define(["jquery", "nprogress"],
                                 alertMessage("alert-success", "Request completed");
                             }
                         } else {
-                            alertMessage("alert-error", "Request failed");
+                            alertMessage("alert-danger", "Request failed");
                         }
                         if (o.complete) o.complete();
                         NProgress.done();
@@ -351,7 +351,7 @@ define(["jquery", "nprogress"],
             readFile(files, callback, index = 0) {
                 const file = files[index];
                 const reader = new FileReader();
-                reader.onerror = () => alertMessage("alert-error", `Error reading file: ${file.name}`);
+                reader.onerror = () => alertMessage("alert-danger", `Error reading file: ${file.name}`);
                 reader.onloadend = () => callback(reader.result);
                 reader.readAsText(file);
             },
index 65a3f5e877d08b97dca24229c4630999567ee059..d19724e63bfbeb9c9b830196b0476aea417e4d57 100644 (file)
@@ -88,13 +88,13 @@ define(["jquery", "app/common"],
             // String to array for comparison
             const eltsArray = JSON.parse(elts);
             if (eltsArray[0] < 0) {
-                common.alertMessage("alert-modal alert-error", "Spam can not be negative");
+                common.alertMessage("alert-modal alert-danger", "Spam can not be negative");
             } else if (eltsArray[1] < 0) {
-                common.alertMessage("alert-modal alert-error", "Rewrite subject can not be negative");
+                common.alertMessage("alert-modal alert-danger", "Rewrite subject can not be negative");
             } else if (eltsArray[2] < 0) {
-                common.alertMessage("alert-modal alert-error", "Probable spam can not be negative");
+                common.alertMessage("alert-modal alert-danger", "Probable spam can not be negative");
             } else if (eltsArray[3] < 0) {
-                common.alertMessage("alert-modal alert-error", "Greylist can not be negative");
+                common.alertMessage("alert-modal alert-danger", "Greylist can not be negative");
             } else if (descending(eltsArray)) {
                 common.query("saveactions", {
                     method: "POST",
@@ -105,7 +105,7 @@ define(["jquery", "app/common"],
                     server: server
                 });
             } else {
-                common.alertMessage("alert-modal alert-error", "Incorrect order of actions thresholds");
+                common.alertMessage("alert-modal alert-danger", "Incorrect order of actions thresholds");
             }
         };
 
index dcd6d734e8e8ef427ce5594881120a7fdd4cf098..58dc45ad7ebf304b225c109cbfe11662511c81ca 100644 (file)
@@ -216,7 +216,7 @@ define(["jquery", "app/common", "d3evolution", "d3pie", "d3", "footable"],
                             if ((curr[0][0].x !== res[0][0].x) ||
                             (curr[0][curr[0].length - 1].x !== res[0][res[0].length - 1].x)) {
                                 time_match = false;
-                                common.alertMessage("alert-error",
+                                common.alertMessage("alert-danger",
                                     "Neighbours time extents do not match. Check if time is synchronized on all servers.");
                                 arr.splice(1); // Break out of .reduce() by mutating the source array
                             }
index 2ed8d5605fcb0e4aaed13ffbec531e91796bbefb..1e139d435df10d5706e97f0b9f8277be9c1c6209 100644 (file)
@@ -164,7 +164,7 @@ define(["jquery", "app/common", "app/libft", "footable"],
                     function differentVersions(neighbours_data) {
                         const dv = neighbours_data.some((e) => e.version !== neighbours_data[0].version);
                         if (dv) {
-                            common.alertMessage("alert-error",
+                            common.alertMessage("alert-danger",
                                 "Neighbours history backend versions do not match. Cannot display history.");
                             return true;
                         }
index ae19aec003cb85df6911dd9e1c2402f85a287909..ea19cc2ae16b1110f7d56ca1529433fa86e0b329 100644 (file)
@@ -335,7 +335,7 @@ define(["jquery", "app/common", "stickytabs", "visibility",
                             if (textStatus.statusText === "Unauthorized") {
                                 invalidFeedback("#authUnauthorizedFeedback");
                             } else {
-                                common.alertMessage("alert-modal alert-error", textStatus.statusText);
+                                common.alertMessage("alert-modal alert-danger", textStatus.statusText);
                             }
                             $("#connectPassword").val("");
                             $("#connectPassword").focus();
index 4a1c6d0d058992c59ef0415aeac921fe369da56a..6b287d693558d90967faa3b9e6fed7f5e73333a0 100644 (file)
@@ -23,7 +23,7 @@ define(["jquery", "app/common"],
                         $("#selectorsResArea")
                             .val(Object.prototype.hasOwnProperty.call(json, "data") ? json.data.toString() : "");
                     } else {
-                        common.alertMessage("alert-error", "Unexpected error processing message");
+                        common.alertMessage("alert-danger", "Unexpected error processing message");
                     }
                 },
                 server: common.getServer()
index d7510b163a721a6d66bd2d986e86dcf28a3b4d2f..e504aef799737b7c0dc8261a268fd3c6c6cc8ef9 100644 (file)
@@ -328,7 +328,7 @@ define(["jquery", "app/common", "d3pie", "d3"],
                                 error: function (jqXHR, textStatus, errorThrown) {
                                     if (!(alerted in sessionStorage)) {
                                         sessionStorage.setItem(alerted, true);
-                                        common.alertMessage("alert-error", neighbours_status[e].name + " > " +
+                                        common.alertMessage("alert-danger", neighbours_status[e].name + " > " +
                                           "Cannot receive legacy stats data" + (errorThrown ? ": " + errorThrown : ""));
                                     }
                                     process_node_stat(e);
index 69a0e20d8042585c2688ba39aa302ec565990539..4c673639ca5f3dea22c614973467cab4a58e7c5f 100644 (file)
@@ -121,20 +121,20 @@ define(["jquery", "app/common", "app/libft"],
                             });
                         }
                     } else {
-                        common.alertMessage("alert-error", "Cannot scan data");
+                        common.alertMessage("alert-danger", "Cannot scan data");
                     }
                 },
                 error: enable_disable_scan_btn,
                 errorMessage: "Cannot upload data",
                 statusCode: {
                     404: function () {
-                        common.alertMessage("alert-error", "Cannot upload data, no server found");
+                        common.alertMessage("alert-danger", "Cannot upload data, no server found");
                     },
                     500: function () {
-                        common.alertMessage("alert-error", "Cannot tokenize message: no text data");
+                        common.alertMessage("alert-danger", "Cannot tokenize message: no text data");
                     },
                     503: function () {
-                        common.alertMessage("alert-error", "Cannot tokenize message: no text data");
+                        common.alertMessage("alert-danger", "Cannot tokenize message: no text data");
                     }
                 },
                 server: common.getServer()
@@ -166,7 +166,7 @@ define(["jquery", "app/common", "app/libft"],
                         common.alertMessage("alert-success", "Message successfully processed");
                         fillHashTable(json.hashes);
                     } else {
-                        common.alertMessage("alert-error", "Unexpected error processing message");
+                        common.alertMessage("alert-danger", "Unexpected error processing message");
                     }
                 },
                 server: common.getServer()
@@ -237,7 +237,7 @@ define(["jquery", "app/common", "app/libft"],
                     uploadText(data, source, headers);
                 }
             } else {
-                common.alertMessage("alert-error", "Message source field cannot be blank");
+                common.alertMessage("alert-danger", "Message source field cannot be blank");
             }
             return false;
         });
index 4cf97ae4c7b35a505c4fb399204a22d8947e2547..64cee05a180b9ebc70e12c01747750374336bc32 100644 (file)
@@ -50,7 +50,7 @@ requirejs.onError = function (e) {
     "use strict";
     document.getElementById("loading").classList.add("d-none");
     document.getElementsByClassName("notification-area")[0].innerHTML =
-        "<div class=\"alert alert-error\">" +
+        "<div class=\"alert alert-danger\">" +
             "<strong>Module loading error: " + e.requireType + ", module: " + e.requireModules + "</strong>" +
             "<button type=\"button\" class=\"btn btn-info btn-xs float-end\" " +
                 "onClick=\"window.location.reload(); this.parentNode.parentNode.removeChild(this.parentNode);\" " +
index 139940574ca2783768388d73f99714a6d4dc3750..515e6a79355da653a893ef80fa6642ab0319005e 100644 (file)
@@ -38,8 +38,8 @@ test.describe("WebUI basic", () => {
             page.waitForResponse((resp) => resp.url().includes("/notfound") && !resp.ok()),
             page.evaluate(() => fetch("/notfound"))
         ]);
-        // WebUI shows alert-error only for errors handled via AJAX (common.query)
+        // WebUI shows alert-danger only for errors handled via AJAX (common.query)
         // If alert is not shown, the test should not fail
-        await expect(page.locator(".alert-error, .alert-modal.alert-error")).not.toBeVisible({timeout: 2000});
+        await expect(page.locator(".alert-danger, .alert-modal.alert-danger")).not.toBeVisible({timeout: 2000});
     });
 });
index 3962e7a7bcb2ef4d9e9f5e32d7504003bf34417e..da4c8fb5137702aafc194209963550bc2a5fefbf 100644 (file)
@@ -25,7 +25,7 @@ test("Config page: always checks order error and valid save for actions", async
     await expect(page.locator("#actionsFormField")).toBeVisible({timeout: 10000});
 
     function getInputs() { return page.locator("#actionsFormField input[data-id='action']"); }
-    const alert = page.locator(".alert-error, .alert-modal.alert-error");
+    const alert = page.locator(".alert-danger, .alert-modal.alert-danger");
 
     const inputs = getInputs();
     const count = await inputs.count();