Files
Ludwig Lehnert 70fe6076a4 initial commit
2026-02-03 16:39:37 +01:00

89 lines
2.5 KiB
Plaintext

<%- include('partials/header', { title: 'Admin', user }) %>
<section class="panel">
<h1>Access logs</h1>
<p class="muted">Every authenticated request and share operation is recorded.</p>
<div class="table-wrap">
<table class="table">
<thead>
<tr>
<th>Time (UTC)</th>
<th>User</th>
<th>Action</th>
<th>Method</th>
<th>Path</th>
<th>Status</th>
<th>Share</th>
</tr>
</thead>
<tbody>
<% logs.forEach((log) => { %>
<tr>
<td><%= log.occurred_at %></td>
<td><%= log.user_upn %></td>
<td><%= log.action %></td>
<td><%= log.method %></td>
<td><%= log.path %></td>
<td><%= log.status_code || '' %></td>
<td><%= log.share_id || '' %></td>
</tr>
<% }) %>
</tbody>
</table>
</div>
</section>
<section class="grid">
<div class="panel">
<h2>Daily activity</h2>
<canvas id="dailyChart" height="200"></canvas>
</div>
<div class="panel">
<h2>Actions breakdown</h2>
<canvas id="actionChart" height="200"></canvas>
</div>
</section>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.2/dist/chart.umd.min.js"></script>
<script>
const dailyLabels = <%- JSON.stringify(daily.map(item => item.day)) %>;
const dailyCounts = <%- JSON.stringify(daily.map(item => item.count)) %>;
const actionLabels = <%- JSON.stringify(actions.map(item => item.action)) %>;
const actionCounts = <%- JSON.stringify(actions.map(item => item.count)) %>;
new Chart(document.getElementById('dailyChart'), {
type: 'line',
data: {
labels: dailyLabels,
datasets: [{
label: 'Requests',
data: dailyCounts,
borderColor: '#d26b2f',
backgroundColor: 'rgba(210, 107, 47, 0.2)',
tension: 0.3,
fill: true
}]
},
options: {
responsive: true,
plugins: { legend: { display: false } }
}
});
new Chart(document.getElementById('actionChart'), {
type: 'bar',
data: {
labels: actionLabels,
datasets: [{
label: 'Count',
data: actionCounts,
backgroundColor: '#b75522'
}]
},
options: {
responsive: true,
plugins: { legend: { display: false } }
}
});
</script>
<%- include('partials/footer') %>