mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Add possibility to highlight line on the Groups Domain Management page with specifying the domainid as GET parameter.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -11,6 +11,7 @@ var table;
|
||||
var groups = [];
|
||||
var token = $("#token").html();
|
||||
var info = null;
|
||||
var GETDict = {};
|
||||
|
||||
function showAlert(type, icon, title, message) {
|
||||
var opts = {};
|
||||
@@ -88,6 +89,13 @@ function datetime(date) {
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
window.location.search
|
||||
.substr(1)
|
||||
.split("&")
|
||||
.forEach(function(item) {
|
||||
GETDict[item.split("=")[0]] = item.split("=")[1];
|
||||
});
|
||||
|
||||
$("#btnAdd").on("click", addDomain);
|
||||
|
||||
get_groups();
|
||||
@@ -186,6 +194,13 @@ function initTable() {
|
||||
);
|
||||
}
|
||||
|
||||
// Highlight row
|
||||
if ("domainid" in GETDict && data.id === parseInt(GETDict.domainid)) {
|
||||
$(row)
|
||||
.find("td")
|
||||
.addClass("highlight");
|
||||
}
|
||||
|
||||
// Select assigned groups
|
||||
sel.val(data.groups);
|
||||
// Initialize multiselect
|
||||
@@ -230,6 +245,18 @@ function initTable() {
|
||||
data.columns[0].visible = false;
|
||||
// Apply loaded state to table
|
||||
return data;
|
||||
},
|
||||
initComplete: function() {
|
||||
if ("domainid" in GETDict) {
|
||||
var pos = table
|
||||
.column(0, { order: "current" })
|
||||
.data()
|
||||
.indexOf(parseInt(GETDict.domainid));
|
||||
if (pos >= 0) {
|
||||
var page = Math.floor(pos / table.page.info().length);
|
||||
table.page(page).draw(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -239,3 +239,7 @@
|
||||
.text-vivid-blue {
|
||||
color: #36f !important;
|
||||
}
|
||||
|
||||
td.highlight {
|
||||
background-color: yellow;
|
||||
}
|
||||
Reference in New Issue
Block a user