Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamBenes3 committed Nov 30, 2023
1 parent 91a503b commit 8446e2d
Showing 1 changed file with 33 additions and 29 deletions.
62 changes: 33 additions & 29 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@
<table>
<tr>
<th>TTN fik8b last json</th>
<th><div id="fik8bTimeStamp"></div></th>
<th>
<div id="fik8bTimeStamp"></div>
</th>
<td>
<button id="fik8bButton">fik8b</button>
<div id="fik8bPanel"></div>
</td>
</tr>
<tr>
<th>TTN px4 last json</th>
<th><div id="px4TimeStamp"></div></th>
<th>
<div id="px4TimeStamp"></div>
</th>
<td>
<button id="px4Button">px4</button>
<div id="px4Panel"></div>
Expand Down Expand Up @@ -471,7 +475,7 @@
fetch('/get/fik8b')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
Expand All @@ -481,17 +485,17 @@
var timestamp = new Date(fik8b.timestamp);
document.getElementById('fik8bTimeStamp').textContent = timestamp.toLocaleString();
} else {
console.error('Received undefined data from the server');
console.log('Received undefined data from the server');
}
})
.catch(error => {
console.error('Error loading data /get/fik8b: ', error);
console.log('Error loading data /get/fik8b: ', error);
});
fetch('/get/px4')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
Expand All @@ -501,127 +505,127 @@
var timestamp = new Date(px4.timestamp);
document.getElementById('px4TimeStamp').textContent = timestamp.toLocaleString();
} else {
console.error('Received undefined data from the server');
console.log('Received undefined data from the server');
}
})
.catch(error => {
console.error('Error loading data /get/px4: ', error);
console.log('Error loading data /get/px4: ', error);
});
fetch('/get/car/data')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
.then(data => {
if (data) {
car = data.data;
} else {
console.error('Received undefined data from the server');
console.log('Received undefined data from the server');
}
})
.catch(error => {
console.error('Error loading data /get/car/data: ', error);
console.log('Error loading data /get/car/data: ', error);
});
fetch('/get/car/data/1')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
.then(data => {
if (data) {
car1 = data.data;
} else {
console.error('Received undefined data from the server');
console.log('Received undefined data from the server');
}
})
.catch(error => {
console.error('Error loading data /get/car/data/1: ', error);
console.log('Error loading data /get/car/data/1: ', error);
});
fetch('/get/car/data/2')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
.then(data => {
if (data) {
car2 = data.data;
} else {
console.error('Received undefined data from the server');
console.log('Received undefined data from the server');
}
})
.catch(error => {
console.error('Error loading data /get/car/data/2: ', error);
console.log('Error loading data /get/car/data/2: ', error);
});
fetch('/get/car/data/3')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
.then(data => {
if (data) {
car3 = data.data;
} else {
console.error('Received undefined data from the server');
console.log('Received undefined data from the server');
}
})
.catch(error => {
console.error('Error loading data /get/car/data/3: ', error);
console.log('Error loading data /get/car/data/3: ', error);
});
fetch('/get/cdp/hb')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
.then(data => {
updateStaticTableWithcdpHb(data.data.cdp_heartbeat_value);
})
.catch(error => {
console.error('Error loading data /get/cdp/hb: ', error);
console.log('Error loading data /get/cdp/hb: ', error);
});
fetch('/get/car/hb/1')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
.then(data => {
updateStaticTableWithcar1Hb(data.data.car_heartbeat_value);
})
.catch(error => {
console.error('Error loading data /get/car/hb/1: ', error);
console.log('Error loading data /get/car/hb/1: ', error);
});
fetch('/get/car/hb/2')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
.then(data => {
updateStaticTableWithcar2Hb(data.data.car_heartbeat_value);
})
.catch(error => {
console.error('Error loading /car/hb/2 data:', error);
console.log('Error loading /car/hb/2 data:', error);
});
fetch('/get/car/hb/3')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
Expand All @@ -635,15 +639,15 @@
fetch('/get/ldp/hb')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
console.log('Network response was not ok');
}
return response.json();
})
.then(data => {
updateStaticTableWithldpHb(data.data.ldp_heartbeat_value);
})
.catch(error => {
console.error('Error loading data /get/ldp/hb: ', error);
console.log('Error loading data /get/ldp/hb: ', error);
});
var now = new Date();
var lastReloadTimeElement = document.getElementById('lastReloadTime');
Expand Down

0 comments on commit 8446e2d

Please sign in to comment.