1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-12 13:33:06 +01:00

allow to hide config items from the ui and allow to change config values in the init function

This commit is contained in:
wellenvogel
2022-01-14 23:16:43 +01:00
parent e70591eb4f
commit 966ef0c4fb
6 changed files with 49 additions and 10 deletions

View File

@@ -953,17 +953,23 @@ function createConfigDefinitions(parent, capabilities, defs,includeXdr) {
category = item.category;
}
let showItem=true;
if (item.capabilities !== undefined) {
for (let capability in item.capabilities) {
let values = item.capabilities[capability];
let found = false;
if (! (values instanceof Array)) values=[values];
values.forEach(function (v) {
let itemCapabilities=item.capabilities||{};
itemCapabilities['HIDE'+item.name]=null;
for (let capability in itemCapabilities) {
let values = itemCapabilities[capability];
let found = false;
if (! (values instanceof Array)) values=[values];
values.forEach(function (v) {
if ( v === null){
if (capabilities[capability] === undefined) found=true;
}
else{
if (capabilities[capability] == v) found = true;
});
if (!found) showItem=false;
}
}
});
if (!found) showItem=false;
}
if (showItem) {
currentCategoryPopulated=true;
let row = addEl('div', 'row', categoryEl);