allow to hide invalid boat data items
This commit is contained in:
		
							parent
							
								
									ac0ecf9b68
								
							
						
					
					
						commit
						123da40aeb
					
				| 
						 | 
					@ -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",
 | 
					        "name": "minXdrInterval",
 | 
				
			||||||
        "label":"min XDR interval",
 | 
					        "label":"min XDR interval",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										23
									
								
								web/index.js
								
								
								
								
							
							
						
						
									
										23
									
								
								web/index.js
								
								
								
								
							| 
						 | 
					@ -1215,15 +1215,7 @@ function parseBoatDataLine(line){
 | 
				
			||||||
function createDashboard() {
 | 
					function createDashboard() {
 | 
				
			||||||
    let frame = document.getElementById('dashboardPage');
 | 
					    let frame = document.getElementById('dashboardPage');
 | 
				
			||||||
    if (!frame) return;
 | 
					    if (!frame) return;
 | 
				
			||||||
    getText("api/boatDataString").then(function (txt) {
 | 
					    frame.innerHTML = '';
 | 
				
			||||||
        frame.innerHTML = '';
 | 
					 | 
				
			||||||
        let values=txt.split('\n');
 | 
					 | 
				
			||||||
        for (let n in values) {
 | 
					 | 
				
			||||||
            let def=parseBoatDataLine(values[n]);
 | 
					 | 
				
			||||||
            createDashboardItem(def.name, def, frame);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        updateDashboard(values);
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
function sourceName(v){
 | 
					function sourceName(v){
 | 
				
			||||||
    if (v == 0) return "N2K";
 | 
					    if (v == 0) return "N2K";
 | 
				
			||||||
| 
						 | 
					@ -1235,15 +1227,24 @@ function sourceName(v){
 | 
				
			||||||
let lastSelectList=[];
 | 
					let lastSelectList=[];
 | 
				
			||||||
function updateDashboard(data) {
 | 
					function updateDashboard(data) {
 | 
				
			||||||
    let frame = document.getElementById('dashboardPage');
 | 
					    let frame = document.getElementById('dashboardPage');
 | 
				
			||||||
 | 
					    let showInvalid=true;
 | 
				
			||||||
 | 
					    forEl('select[name=showInvalidData]',function(el){
 | 
				
			||||||
 | 
					        if (el.value == 'false') showInvalid=false;
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
    let names={};
 | 
					    let names={};
 | 
				
			||||||
    for (let n in data) {
 | 
					    for (let n in data) {
 | 
				
			||||||
        let current=parseBoatDataLine(data[n]);
 | 
					        let current=parseBoatDataLine(data[n]);
 | 
				
			||||||
        if (! current.name) continue;
 | 
					        if (! current.name) continue;
 | 
				
			||||||
        names[current.name]=true;
 | 
					        names[current.name]=true;
 | 
				
			||||||
        let de = document.getElementById('data_' + current.name);
 | 
					        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);   
 | 
					            de=createDashboardItem(current.name,current,frame);   
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (de && (!isValid && !showInvalid)){
 | 
				
			||||||
 | 
					            de.parentElement.remove();
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (de) {
 | 
					        if (de) {
 | 
				
			||||||
            let newContent='----';
 | 
					            let newContent='----';
 | 
				
			||||||
            if (current.valid) {
 | 
					            if (current.valid) {
 | 
				
			||||||
| 
						 | 
					@ -1339,8 +1340,8 @@ window.addEventListener('load', function () {
 | 
				
			||||||
            handleTab(ev.target);
 | 
					            handleTab(ev.target);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    loadConfigDefinitions();
 | 
					 | 
				
			||||||
    createDashboard();
 | 
					    createDashboard();
 | 
				
			||||||
 | 
					    loadConfigDefinitions();
 | 
				
			||||||
    let statusPage=document.getElementById('statusPageContent');
 | 
					    let statusPage=document.getElementById('statusPageContent');
 | 
				
			||||||
    if (statusPage){
 | 
					    if (statusPage){
 | 
				
			||||||
        let even=true;
 | 
					        let even=true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue