From 536e7a8a378d05dc1568eba1ade7045a0a825e9a Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Tue, 25 Mar 2025 14:00:21 +0300 Subject: [PATCH] [WebUI] Update Maps table - Display new map flags. - Rename "Lists" heading to "Maps". - Add table header. --- interface/index.html | 4 +++- interface/js/app/config.js | 21 +++++++++++++-------- interface/js/app/rspamd.js | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/interface/index.html b/interface/index.html index 9c42f4e7f6..a759ac48f9 100644 --- a/interface/index.html +++ b/interface/index.html @@ -328,7 +328,7 @@
- Lists + Maps
Editor:
@@ -342,6 +342,8 @@
+ +
FlagsTypeURLDescription
diff --git a/interface/js/app/config.js b/interface/js/app/config.js index 0f35e31073..48cac10872 100644 --- a/interface/js/app/config.js +++ b/interface/js/app/config.js @@ -115,22 +115,27 @@ define(["jquery", "app/common"], common.query("maps", { success: function (json) { const [{data}] = json; - $listmaps.empty(); - const $tbody = $(""); + const $tbody = $listmaps.children("tbody").empty(); $.each(data, (i, item) => { - let $td = 'Read'; - if (!(item.editable === false || common.read_only)) { - $td = $($td).append(' Write'); - } - const $tr = $("").append($td); + const $td = $(""); + + const badges = [ + {text: "Not loaded", cls: "text-bg-warning", cond: !item.loaded}, + {text: "Cached", cls: "text-bg-info", cond: item.cached}, + {text: "Writable", cls: "text-bg-success", cond: !(item.editable === false || common.read_only)} + ]; + badges.forEach((b) => { + if (b.cond) $td.append($(`${b.text}`)); + }); + + const $tr = $("").append($td).append($("" + item.type + "")); const $span = $('' + item.uri + "").data("item", item); $span.wrap("").parent().appendTo($tr); $("" + item.description + "").appendTo($tr); $tr.appendTo($tbody); }); - $tbody.appendTo($listmaps); $listmaps.closest(".card").show(); }, server: common.getServer() diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 61b7cf1554..6d047d6f66 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -52,7 +52,7 @@ define(["jquery", "app/common", "stickytabs", "visibility", function cleanCredentials() { sessionStorage.clear(); $("#statWidgets").empty(); - $("#listMaps").empty(); + $("#listMaps").children("tbody").empty(); $("#modalBody").empty(); } -- 2.47.3