mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
@@ -197,6 +197,7 @@ function generateRow(topic, key, value) {
|
||||
break;
|
||||
}
|
||||
|
||||
case "enum (unsigned integer)": // fallthrough
|
||||
case "enum (string)": {
|
||||
box +=
|
||||
'<label class="col-sm-4 control-label">Selected Option</label>' +
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2023 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/* global setConfigValues: false, apiFailure: false */
|
||||
|
||||
function getConfig() {
|
||||
$.ajax({
|
||||
url: "/api/config/?detailed=true",
|
||||
})
|
||||
.done(function (data) {
|
||||
setConfigValues("", "", data.config);
|
||||
})
|
||||
.fail(function (data) {
|
||||
apiFailure(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
getConfig();
|
||||
});
|
||||
@@ -28,7 +28,9 @@ function setConfigValues(topic, key, value) {
|
||||
if (!("description" in value)) {
|
||||
Object.keys(value).forEach(function (subkey) {
|
||||
var subvalue = value[subkey];
|
||||
setConfigValues(topic, key + "." + subkey, subvalue);
|
||||
// If the key is empty, we are at the top level
|
||||
var newKey = key === "" ? subkey : key + "." + subkey;
|
||||
setConfigValues(topic, newKey, subvalue);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -36,6 +38,7 @@ function setConfigValues(topic, key, value) {
|
||||
// else: we have a setting we can set
|
||||
var escapedKey = key.replace(/\./g, "\\.");
|
||||
switch (value.type) {
|
||||
case "enum (unsigned integer)": // fallthrough
|
||||
case "enum (string)": {
|
||||
// Remove all options from select
|
||||
$("#" + escapedKey + " option").remove();
|
||||
@@ -68,7 +71,13 @@ function setConfigValues(topic, key, value) {
|
||||
|
||||
default: {
|
||||
// Set input field values (if available)
|
||||
$("#" + escapedKey).val(value.value);
|
||||
// Set text if this is a <span> or <code> element
|
||||
if ($("#" + escapedKey).is("span") || $("#" + escapedKey).is("code")) {
|
||||
$("#" + escapedKey).text(value.value);
|
||||
} else {
|
||||
// Set value if this is an <input> element
|
||||
$("#" + escapedKey).val(value.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
</li>
|
||||
<li class="<? if scriptname == 'settings-privacy.lp' then mg.write(" active") end ?>">
|
||||
<a href="settings-privacy.lp">
|
||||
<i class="fa-fw menu-icon fa-solid fa-binoculars"></i> <span class="text-red">Privacy</span>
|
||||
<i class="fa-fw menu-icon fa-solid fa-binoculars"></i> <span class="text-green">Privacy</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="<? if scriptname == 'settings-advanced.lp' then mg.write(" active") end ?> settings-level-2">
|
||||
|
||||
Reference in New Issue
Block a user