allow to hide invalid boat data items

This commit is contained in:
wellenvogel 2021-12-11 20:13:14 +01:00
parent ac0ecf9b68
commit 123da40aeb
2 changed files with 20 additions and 11 deletions

View File

@ -123,6 +123,14 @@
]
}
},
{
"name": "showInvalidData",
"label": "show all data",
"type": "boolean",
"default": "true",
"description": "show also not received items on data page",
"category": "system"
},
{
"name": "minXdrInterval",
"label":"min XDR interval",

View File

@ -1215,15 +1215,7 @@ function parseBoatDataLine(line){
function createDashboard() {
let frame = document.getElementById('dashboardPage');
if (!frame) return;
getText("api/boatDataString").then(function (txt) {
frame.innerHTML = '';
let values=txt.split('\n');
for (let n in values) {
let def=parseBoatDataLine(values[n]);
createDashboardItem(def.name, def, frame);
}
updateDashboard(values);
});
frame.innerHTML = '';
}
function sourceName(v){
if (v == 0) return "N2K";
@ -1235,15 +1227,24 @@ function sourceName(v){
let lastSelectList=[];
function updateDashboard(data) {
let frame = document.getElementById('dashboardPage');
let showInvalid=true;
forEl('select[name=showInvalidData]',function(el){
if (el.value == 'false') showInvalid=false;
})
let names={};
for (let n in data) {
let current=parseBoatDataLine(data[n]);
if (! current.name) continue;
names[current.name]=true;
let de = document.getElementById('data_' + current.name);
if (! de && frame){
let isValid=current.valid;
if (! de && frame && (isValid || showInvalid)){
de=createDashboardItem(current.name,current,frame);
}
if (de && (!isValid && !showInvalid)){
de.parentElement.remove();
continue;
}
if (de) {
let newContent='----';
if (current.valid) {
@ -1339,8 +1340,8 @@ window.addEventListener('load', function () {
handleTab(ev.target);
});
}
loadConfigDefinitions();
createDashboard();
loadConfigDefinitions();
let statusPage=document.getElementById('statusPageContent');
if (statusPage){
let even=true;