diff --git a/groups-adlists.php b/groups-adlists.php index 94c26a7e..bf2a3b41 100644 --- a/groups-adlists.php +++ b/groups-adlists.php @@ -41,6 +41,7 @@
pihole -g or update your gravity list online after modifying your adlists.| Health status of this list: | " + + statusText + + " |
| This list was added to Pi-hole on | " + + utils.datetime(data.date_added, false) + + " |
| Database entry was last modified on | " + + utils.datetime(data.date_modified, false) + + " |
| The list contents were last updated on | " + + (data.date_updated !== null ? utils.datetime(data.date_updated, false) : "N/A") + + " |
| Number of valid domains on this list: | " + + (data.number !== null ? data.number : "N/A") + + " |
| Number of invalid domains on this list: | " + + (data.invalid_domains !== null ? data.invalid_domains : "N/A") + + " |
| Database ID of this list: | " + + data.id + + " |
' +
- data.address +
- ""
- );
var disabled = data.enabled === 0;
+ var statusCode = 0;
+ // If there is no status or the list is disabled, we keep
+ // status 0 (== unknown)
+ if (data.status !== null && disabled !== true) {
+ statusCode = parseInt(data.status, 10);
+ }
+
+ $("td:eq(0)", row).addClass("list-status-" + statusCode);
+ $("td:eq(0)", row).html("");
+
$("td:eq(1)", row).html(
+ '' +
+ data.address +
+ ""
+ );
+
+ $("td:eq(2)", row).html(
'"
);
var statusEl = $("#status_" + data.id, row);
@@ -86,13 +135,13 @@ function initTable() {
});
statusEl.on("change", editAdlist);
- $("td:eq(2)", row).html('');
+ $("td:eq(3)", row).html('');
var commentEl = $("#comment_" + data.id, row);
commentEl.val(utils.unescapeHtml(data.comment));
commentEl.on("change", editAdlist);
- $("td:eq(3)", row).empty();
- $("td:eq(3)", row).append(
+ $("td:eq(4)", row).empty();
+ $("td:eq(4)", row).append(
''
);
var selectEl = $("#multiselect_" + data.id, row);
@@ -162,7 +211,7 @@ function initTable() {
'">' +
'' +
"";
- $("td:eq(4)", row).html(button);
+ $("td:eq(5)", row).html(button);
},
dom:
"<'row'<'col-sm-4'l><'col-sm-8'f>>" +
@@ -204,6 +253,22 @@ function initTable() {
$("#resetButton").addClass("hidden");
});
+ // Add event listener for opening and closing details
+ $("#adlistsTable tbody").on("click", "td.details-control", function () {
+ var tr = $(this).closest("tr");
+ var row = table.row(tr);
+
+ if (row.child.isShown()) {
+ // This row is already open - close it
+ row.child.hide();
+ tr.removeClass("shown");
+ } else {
+ // Open this row
+ row.child(format(row.data())).show();
+ tr.addClass("shown");
+ }
+ });
+
// Disable autocorrect in the search box
var input = document.querySelector("input[type=search]");
if (input !== null) {
diff --git a/style/pi-hole.css b/style/pi-hole.css
index 63500631..d60da7fb 100644
--- a/style/pi-hole.css
+++ b/style/pi-hole.css
@@ -330,3 +330,27 @@
.small-box {
border-radius: 10px;
}
+
+.list-status-0 {
+ color: #7D7D7D;
+}
+
+.list-status-1 {
+ color: #74c700;
+}
+
+.list-status-2 {
+ color: #98ca52;
+}
+
+.list-status-3 {
+ color: #ff8c00;
+}
+
+.list-status-4 {
+ color: #cc0000;
+}
+
+td.details-control {
+ cursor: pointer;
+}