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:
24
web/index.js
24
web/index.js
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user