Files
Archive/echo/internal/web/templates/_navbar.html
2024-09-09 20:33:16 +02:00

86 lines
3.0 KiB
HTML

<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item" href="/">
<h1 class="title is-4">Ehco Relay</h1>
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarMenu">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarMenu" class="navbar-menu">
<div class="navbar-start">
<a href="/rules/" class="navbar-item">
<span class="icon"><i class="fas fa-list"></i></span>
<span>Rules</span>
</a>
<a href="/rule_metrics/" class="navbar-item">
<span class="icon"><i class="fas fa-chart-line"></i></span>
<span>Monitor</span>
</a>
<a href="/logs/" class="navbar-item">
<span class="icon"><i class="fas fa-file-alt"></i></span>
<span>Logs</span>
</a>
<a href="/connections/?conn_type=active/" class="navbar-item">
<span class="icon"><i class="fas fa-link"></i></span>
<span>Connections</span>
</a>
</div>
<div class="navbar-end">
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
<span class="icon"><i class="fas fa-external-link-alt"></i></span>
<span>Quick Links</span>
</a>
<div class="navbar-dropdown">
<a href="/metrics/" class="navbar-item">
<span class="icon"><i class="fas fa-chart-line"></i></span>
<span>Metrics</span>
</a>
<a href="/debug/pprof/" class="navbar-item">
<span class="icon"><i class="fas fa-bug"></i></span>
<span>Debug</span>
</a>
<a href="/api/v1/config/" class="navbar-item">
<span class="icon"><i class="fas fa-cog"></i></span>
<span>Config</span>
</a>
</div>
</div>
</div>
</div>
</div>
</nav>
<hr />
<script>
document.addEventListener('DOMContentLoaded', () => {
// Get all "navbar-burger" elements
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
// Add a click event on each of them
$navbarBurgers.forEach((el) => {
el.addEventListener('click', () => {
// Get the target from the "data-target" attribute
const target = el.dataset.target;
const $target = document.getElementById(target);
// Check if the target element exists
if ($target) {
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
} else {
console.error(`Target element with id "${target}" not found`);
}
});
});
});
</script>