diff --git a/scripts/pi-hole/js/settings-advanced.js b/scripts/pi-hole/js/settings-advanced.js index 9f73bf74..3d7e4332 100644 --- a/scripts/pi-hole/js/settings-advanced.js +++ b/scripts/pi-hole/js/settings-advanced.js @@ -24,42 +24,24 @@ function addAllowedValues(allowed) { } } -function generateRow(topic, key, value) { - // If the value is an object, we need to recurse - if (!("description" in value)) { - Object.keys(value).forEach(function (subkey) { - var subvalue = value[subkey]; - generateRow(topic, key + "." + subkey, subvalue); - }); - return; - } - - // else: we have a setting we can display - var box = - '
' + - '
' + - '

' + - key + +function boxIcons(value) { + return ( + '' + (value.modified - ? '  ' + ? '' : "") + (value.flags.restart_dnsmasq - ? '  ' + ? '' : "") + (value.flags.env_var - ? '  ' + ? '' : "") + - "

" + - "

" + - utils.escapeHtml(value.description).replaceAll("\n", "
") + - "

" + - "
" + - '
' + - '
'; + "" + ); +} + +function valueDetails(key, value) { + // Define default hint text let defaultValueHint = ""; if (value.modified) { defaultValueHint = ""; @@ -91,18 +73,21 @@ function generateRow(topic, key, value) { } } + // Define extraAttributes, if needed let extraAttributes = ""; if (value.flags.env_var) { extraAttributes = " disabled"; } + // Format the output depending on the value type + let content = ""; switch (value.type) { case "IPv4 address": case "IPv6 address": case "string": { - box += - '' + - '
' + + content += + '' + + '
' + '' + '
Enabled ' + defaultValueHint + - "" + + "
" + "
"; break; } case "double": { - box += - '' + - '
' + + content += + '' + + '
' + 'Value (integer)' + - '
' + + content += + '' + + '
' + 'Value (unsigned integer)' + + content += + '' + '
' + 'Value (unsigned 16bit integer)' + + content += + '' + '
' + 'Values (one item per line)' + - '
' + + content += + '' + + '
' + '