Skip to content

Agent Mesh

fix mobile console

Antonio Ojea24408b66ee7c
diff --git a/cmd/sam-console/public/app.js b/cmd/sam-console/public/app.js
index a4d6d5eb..00bdb0db 100644
--- a/cmd/sam-console/public/app.js
+++ b/cmd/sam-console/public/app.js
@@ -17,6 +17,9 @@ document.addEventListener('DOMContentLoaded', () => {
// Optionally fetch data specifically for that view if needed
// Currently, loadData() fetches everything from the status endpoint.
+
+ // On mobile the sidebar is an overlay drawer; close it after navigating.
+ closeSidebar();
});
});
@@ -24,6 +27,16 @@ document.addEventListener('DOMContentLoaded', () => {
checkAuthAndLoad();
});
+window.toggleSidebar = function() {
+ document.querySelector('.sidebar').classList.toggle('open');
+ document.getElementById('sidebar-scrim').classList.toggle('active');
+};
+
+window.closeSidebar = function() {
+ document.querySelector('.sidebar').classList.remove('open');
+ document.getElementById('sidebar-scrim').classList.remove('active');
+};
+
async function checkAuthAndLoad() {
try {
const infoResp = await fetch('info');
diff --git a/cmd/sam-console/public/index.html b/cmd/sam-console/public/index.html
index 00bb10e7..162e9615 100644
--- a/cmd/sam-console/public/index.html
+++ b/cmd/sam-console/public/index.html
@@ -91,9 +91,15 @@
</nav>
</aside>
+ <!-- Sidebar scrim, shown behind the drawer on mobile -->
+ <div class="sidebar-scrim" id="sidebar-scrim" onclick="closeSidebar()"></div>
+
<!-- Main Content Area -->
<main class="main-content">
<header class="topbar">
+ <button class="sidebar-toggle" id="sidebar-toggle" onclick="toggleSidebar()" aria-label="Toggle navigation">
+ <svg viewBox="0 0 24 24" width="22" height="22" stroke="currentColor" stroke-width="2" fill="none"><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
+ </button>
<div class="search-bar">
<svg viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2" fill="none"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
<input type="text" placeholder="Search resources...">
@@ -150,6 +156,7 @@
<h2>Users</h2>
</div>
<div class="card">
+ <div class="table-responsive">
<table class="data-table">
<thead>
<tr>
@@ -163,6 +170,7 @@
<tr><td colspan="4" class="text-center">Loading...</td></tr>
</tbody>
</table>
+ </div>
</div>
</section>
@@ -172,6 +180,7 @@
<h2>Enrolled Nodes</h2>
</div>
<div class="card">
+ <div class="table-responsive">
<table class="data-table">
<thead>
<tr>
@@ -185,6 +194,7 @@
<tr><td colspan="4" class="text-center">Loading...</td></tr>
</tbody>
</table>
+ </div>
</div>
</section>
@@ -194,6 +204,7 @@
<h2>Enrollment Requests</h2>
</div>
<div class="card">
+ <div class="table-responsive">
<table class="data-table">
<thead>
<tr>
@@ -207,6 +218,7 @@
<tr><td colspan="4" class="text-center">Loading...</td></tr>
</tbody>
</table>
+ </div>
</div>
</section>
@@ -216,6 +228,7 @@
<h2>Active Routers (Leases)</h2>
</div>
<div class="card">
+ <div class="table-responsive">
<table class="data-table">
<thead>
<tr>
@@ -228,6 +241,7 @@
<tr><td colspan="3" class="text-center">Loading...</td></tr>
</tbody>
</table>
+ </div>
</div>
</section>
@@ -268,6 +282,7 @@
</div>
<div class="card">
<h3>Active Tokens</h3>
+ <div class="table-responsive">
<table class="data-table">
<thead>
<tr>
@@ -282,6 +297,7 @@
<tr><td colspan="5" class="text-center">Loading...</td></tr>
</tbody>
</table>
+ </div>
</div>
</section>
diff --git a/cmd/sam-console/public/style.css b/cmd/sam-console/public/style.css
index 9a898812..0bf95ad0 100644
--- a/cmd/sam-console/public/style.css
+++ b/cmd/sam-console/public/style.css
@@ -31,6 +31,7 @@ body {
display: flex;
height: 100vh;
width: 100vw;
+ position: relative;
}
/* Sidebar */
@@ -99,6 +100,21 @@ body {
display: flex;
flex-direction: column;
overflow: hidden;
+ min-width: 0;
+}
+
+.sidebar-toggle {
+ display: none;
+ background: none;
+ border: none;
+ color: var(--text-primary);
+ cursor: pointer;
+ padding: 8px;
+ margin-right: 12px;
+}
+
+.sidebar-scrim {
+ display: none;
}
.topbar {
@@ -158,6 +174,12 @@ body {
padding: 32px;
}
+.table-responsive {
+ width: 100%;
+ overflow-x: auto;
+ -webkit-overflow-scrolling: touch;
+}
+
/* Views */
.view-section {
display: none;
@@ -564,3 +586,117 @@ body {
.form-control:focus {
border-color: var(--accent);
}
+
+/* Mobile / responsive layout */
+@media (max-width: 860px) {
+ body {
+ overflow: auto;
+ height: auto;
+ min-height: 100vh;
+ }
+
+ .app-container {
+ height: auto;
+ min-height: 100vh;
+ }
+
+ .sidebar-toggle {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .sidebar {
+ position: fixed;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ z-index: 1100;
+ width: 260px;
+ max-width: 80vw;
+ transform: translateX(-100%);
+ transition: transform 0.25s ease;
+ }
+
+ .sidebar.open {
+ transform: translateX(0);
+ }
+
+ .sidebar-scrim {
+ display: none;
+ position: fixed;
+ top: 0; left: 0; right: 0; bottom: 0;
+ background: rgba(0, 0, 0, 0.5);
+ z-index: 1050;
+ }
+
+ .sidebar-scrim.active {
+ display: block;
+ }
+
+ .main-content {
+ width: 100%;
+ }
+
+ .topbar {
+ padding: 0 16px;
+ height: 60px;
+ }
+
+ .topbar .search-bar {
+ display: none;
+ }
+
+ .user-profile span {
+ display: none;
+ }
+
+ .content-scroll {
+ padding: 16px;
+ }
+
+ .header-banner {
+ flex-direction: column;
+ gap: 12px;
+ }
+
+ .header-banner h1 {
+ font-size: 1.5rem;
+ }
+
+ .stats-grid {
+ grid-template-columns: 1fr 1fr;
+ gap: 12px;
+ }
+
+ .card {
+ padding: 16px !important;
+ }
+
+ .data-table th,
+ .data-table td {
+ padding: 10px;
+ white-space: nowrap;
+ }
+
+ .modal-content {
+ width: 90vw;
+ max-width: 400px;
+ padding: 20px;
+ }
+
+ .landing-content {
+ width: 90vw;
+ padding: 2rem 1.5rem;
+ }
+
+ #form-generate-token {
+ max-width: 100% !important;
+ }
+}
+
+@media (max-width: 480px) {
+ .stats-grid {
+ grid-template-columns: 1fr;
+ }
+}