169 lines
5.5 KiB
HTML
Executable File
169 lines
5.5 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Responsive Sidebar Template</title>
|
|
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
|
|
<style>
|
|
body {
|
|
overflow-x: hidden;
|
|
}
|
|
#sidebar a.nav-link {
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
#sidebar a.nav-link:hover {
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
}
|
|
#sidebar a.nav-link svg {
|
|
margin-right: 8px; /* Add spacing between icons and text */
|
|
}
|
|
#sidebar {
|
|
transition: transform 0.3s ease-in-out;
|
|
}
|
|
.offcanvas-backdrop {
|
|
z-index: 1040;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- Topbar -->
|
|
<span id="topbar"></span>
|
|
|
|
<!-- Sidebar Offcanvas for Mobile -->
|
|
<div class="offcanvas offcanvas-start text-white bg-dark" tabindex="-1" id="sidebarOffcanvas" aria-labelledby="sidebarOffcanvasLabel">
|
|
<div class="offcanvas-header">
|
|
<h5 class="offcanvas-title" id="sidebarOffcanvasLabel">NebuleAir</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
|
</div>
|
|
<div class="offcanvas-body" id="sidebar_mobile">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container-fluid mt-5">
|
|
<div class="row">
|
|
<aside class="col-md-2 col-lg-1 d-none d-md-block vh-100 position-fixed bg-dark text-white" id="sidebar">
|
|
</aside>
|
|
<!-- Main content -->
|
|
<main class="col-md-10 ms-sm-auto col-lg-11 offset-md-2 offset-lg-1 px-md-4">
|
|
<h1 class="mt-4">Le journal</h1>
|
|
<p>Le journal des logs permet de savoir si les processus du capteur se déroulent correctement.</p>
|
|
<div class="row">
|
|
<!-- card 1 -->
|
|
<div class="col-lg-6 col-12">
|
|
<div class="card" style="height: 80vh;">
|
|
<div class="card-header">
|
|
Loop logs
|
|
</div>
|
|
<div class="card-body overflow-auto" id="card_loop_content">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- card 2 -->
|
|
<div class="col-lg-6 col-12">
|
|
<div class="card" style="height: 80vh;">
|
|
<div class="card-header">
|
|
Boot logs
|
|
</div>
|
|
<div class="card-body overflow-auto" id="card_boot_content">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- JAVASCRIPT -->
|
|
|
|
<!-- Link Ajax locally -->
|
|
<script src="assets/jquery/jquery-3.7.1.min.js"></script>
|
|
<!-- Link Bootstrap JS and Popper.js locally -->
|
|
<script src="assets/js/bootstrap.bundle.js"></script>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const elementsToLoad = [
|
|
{ id: 'topbar', file: 'topbar.html' },
|
|
{ id: 'sidebar', file: 'sidebar.html' },
|
|
{ id: 'sidebar_mobile', file: 'sidebar.html' }
|
|
];
|
|
|
|
elementsToLoad.forEach(({ id, file }) => {
|
|
fetch(file)
|
|
.then(response => response.text())
|
|
.then(data => {
|
|
const element = document.getElementById(id);
|
|
if (element) {
|
|
element.innerHTML = data;
|
|
}
|
|
})
|
|
.catch(error => console.error(`Error loading ${file}:`, error));
|
|
});
|
|
|
|
const loop_card_content = document.getElementById('card_loop_content');
|
|
const boot_card_content = document.getElementById('card_boot_content');
|
|
|
|
fetch('../logs/loop.log')
|
|
.then((response) => {
|
|
if (!response.ok) {
|
|
throw new Error('Failed to fetch the log file.');
|
|
}
|
|
return response.text();
|
|
})
|
|
.then((data) => {
|
|
const lines = data.split('\n');
|
|
|
|
// Format log content
|
|
const formattedLog = lines
|
|
.map((line) => line.trim()) // Remove extra whitespace
|
|
.filter((line) => line) // Remove empty lines
|
|
.join('<br>'); // Join formatted lines with line breaks
|
|
|
|
loop_card_content.innerHTML = `<pre style="white-space: pre-wrap; word-wrap: break-word; margin: 0;">${formattedLog}</pre>`;
|
|
loop_card_content.scrollTop = loop_card_content.scrollHeight; // Scroll to the bottom
|
|
|
|
})
|
|
.catch((error) => {
|
|
console.error(error);
|
|
loop_card_content.textContent = 'Error loading log file.';
|
|
});
|
|
|
|
fetch('../logs/app.log')
|
|
.then((response) => {
|
|
if (!response.ok) {
|
|
throw new Error('Failed to fetch the log file.');
|
|
}
|
|
return response.text();
|
|
})
|
|
.then((data) => {
|
|
const lines = data.split('\n');
|
|
|
|
// Format log content
|
|
const formattedLog = lines
|
|
.map((line) => line.trim()) // Remove extra whitespace
|
|
.filter((line) => line) // Remove empty lines
|
|
.join('<br>'); // Join formatted lines with line breaks
|
|
|
|
boot_card_content.innerHTML = `<pre style="white-space: pre-wrap; word-wrap: break-word; margin: 0;">${formattedLog}</pre>`;
|
|
boot_card_content.scrollTop = loop_card_content.scrollHeight; // Scroll to the bottom
|
|
|
|
})
|
|
.catch((error) => {
|
|
console.error(error);
|
|
boot_card_content.textContent = 'Error loading log file.';
|
|
});
|
|
|
|
|
|
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|