]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Add check/uncheck all checkboxes buttons 4864/head
authormoisseev <moiseev@mezonplus.ru>
Fri, 8 Mar 2024 16:47:18 +0000 (19:47 +0300)
committermoisseev <moiseev@mezonplus.ru>
Fri, 8 Mar 2024 16:47:18 +0000 (19:47 +0300)
to table filter dropdowns

interface/css/rspamd.css
interface/js/app/common.js
interface/js/app/libft.js
interface/js/app/symbols.js

index d21dfd60521d0c4cb4444fa0c16fb719892e4195..4885e6d7f01ce0ae09b88837efa38248c90dff4d 100644 (file)
@@ -311,6 +311,10 @@ table#symbolsTable input[type="number"] {
 .footable tr:not(.footable-detail-row) > td {
     font-size: 11px;
 }
+.footable-dropdown-btn-group {
+    padding: 0 20px;
+    margin: 7px 0;
+}
 
 .status-table tr:last-child td:last-child {
     border-radius: 0 0 calc(var(--bs-border-radius) + 1px) 0;
index 0364ed0e90e62959c5c94391b199cc70559fe4fc..1fc723542135d87cadc34256090a461861a46f72 100644 (file)
@@ -234,5 +234,24 @@ define(["jquery", "nprogress"],
             return String(string).replace(htmlEscaper, (match) => htmlEscapes[match]);
         };
 
+        ui.appendButtonsToFtFilterDropdown = (ftFilter) => {
+            function button(text, classes, check) {
+                return $("<button/>", {
+                    type: "button",
+                    class: "btn btn-xs " + classes,
+                    text: text,
+                    click: () => {
+                        const checkboxes = ftFilter.$dropdown.find(".checkbox input");
+                        return (check) ? checkboxes.attr("checked", "checked") : checkboxes.removeAttr("checked");
+                    }
+                });
+            }
+
+            $("<div/>", {class: "d-flex justify-content-between footable-dropdown-btn-group"}).append(
+                button("Check all", "btn-secondary", true),
+                button("Uncheck all", "btn-outline-secondary ms-1")
+            ).appendTo(ftFilter.$dropdown);
+        };
+
         return ui;
     });
index 1dfc9ef792c686b005c48bf24c33a5fc9c235a25..faf16489b599c9edf687ddc78fc471b9bbfa0485 100644 (file)
@@ -293,6 +293,8 @@ define(["jquery", "app/common", "footable"],
                     $.each(self.actions, (i, action) => {
                         self.$action.append($("<option/>").text(action));
                     });
+
+                    common.appendButtonsToFtFilterDropdown(self);
                 },
                 _onStatusDropdownChanged: function (e) {
                     const {self} = e.data;
index 21d83b1c347110201ee86f9238b43be986145be1..893eddb3b7e3771bcf2cfaf3e464cf1a4ecec21f 100644 (file)
@@ -160,6 +160,8 @@ define(["jquery", "app/common", "footable"],
                             $.each(self.groups, (i, group) => {
                                 self.$group.append($("<option/>").text(group));
                             });
+
+                            common.appendButtonsToFtFilterDropdown(self);
                         },
                         _onStatusDropdownChanged: function (e) {
                             const {self} = e.data;