Add totals to directory and admin
This commit is contained in:
parent
13303e4e24
commit
14bd9726ce
|
@ -53,4 +53,7 @@ function populateTable(routes) {
|
||||||
`;
|
`;
|
||||||
tableBody.appendChild(row);
|
tableBody.appendChild(row);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// populate serverCount
|
||||||
|
document.getElementById('serverCount').innerText = routes.length;
|
||||||
}
|
}
|
|
@ -8,6 +8,8 @@ function getDirectoryEntries() {
|
||||||
row.innerHTML = `<td>${entry.number}</td><td>${entry.name}</td>`;
|
row.innerHTML = `<td>${entry.number}</td><td>${entry.name}</td>`;
|
||||||
table.appendChild(row);
|
table.appendChild(row);
|
||||||
});
|
});
|
||||||
|
// Set dirCount to the number of entries in the directory
|
||||||
|
document.getElementById('dirCount').innerText = data.length;
|
||||||
})
|
})
|
||||||
.catch(error => console.error('Error fetching directory:', error));
|
.catch(error => console.error('Error fetching directory:', error));
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
<a href="/admin" class="btn btn-outline-light">Admin Login</a>
|
<a href="/admin" class="btn btn-outline-light">Admin Login</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="d-flex align-items-center gap-3 mb-3">
|
<div class="d-flex align-items-center justify-content-center gap-3 mb-3">
|
||||||
<h2 class="m-0 text-center w-100">AstroCom Directory</h2>
|
<h2 class="m-0">AstroCom Directory</h2>
|
||||||
|
<p class="m-0">Total Entries: <span id="dirCount">0</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="container mt-4" style="max-width: 400px;">
|
<div class="container mt-4" style="max-width: 400px;">
|
||||||
<table class="table table-dark table-striped">
|
<table class="table table-dark table-striped">
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<div class="d-flex align-items-center gap-3 mb-3">
|
<div class="d-flex align-items-center gap-3 mb-3">
|
||||||
<h2 class="m-0">Admin Dashboard</h2>
|
<h2 class="m-0">Admin Dashboard</h2>
|
||||||
<a href="/admin/create" class="btn btn-primary">Create New Server</a>
|
<a href="/admin/create" class="btn btn-primary">Create New Server</a>
|
||||||
|
<p class="m-0">Total Servers: <span id="serverCount">0</span> | Total Directory Entries: <span id="dirCount">0</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
|
|
Loading…
Reference in a new issue