108 lines
3.8 KiB
HTML
108 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" data-bs-theme="dark">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Admin Dashboard</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="/static/bootstrap.min.css" rel="stylesheet">
|
|
</head>
|
|
<body class="bg-dark text-light d-flex flex-column min-vh-100">
|
|
<div class="container py-5 flex-grow-1">
|
|
<h1 class="mb-4 text-center">🧠 Admin Dashboard</h1>
|
|
<ul class="nav nav-tabs mb-4" id="dashboardTabs" role="tablist">
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link active" id="uploads-tab" data-bs-toggle="tab" data-bs-target="#uploads" type="button" role="tab">Uploads</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link" id="downloads-tab" data-bs-toggle="tab" data-bs-target="#downloads" type="button" role="tab">Downloads</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link" id="chart-tab" data-bs-toggle="tab" data-bs-target="#chart" type="button" role="tab">Chart</button>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content bg-dark p-3 rounded shadow">
|
|
<div class="tab-pane fade show active" id="uploads" role="tabpanel">
|
|
<h4 class="mb-3">Uploads</h4>
|
|
<div class="table-responsive">
|
|
<table class="table table-dark table-hover mb-0 align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th>IP</th>
|
|
<th>File</th>
|
|
<th>Time</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Events}} {{if eq .Action "upload"}}
|
|
<tr>
|
|
<td>{{.IP}}</td>
|
|
<td>{{.File}}</td>
|
|
<td>{{.Timestamp.Format "2006-01-02 15:04:05"}}</td>
|
|
</tr>
|
|
{{end}} {{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="tab-pane fade" id="downloads" role="tabpanel">
|
|
<h4 class="mb-3">Downloads</h4>
|
|
<div class="table-responsive">
|
|
<table class="table table-dark table-hover mb-0 align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th>IP</th>
|
|
<th>File</th>
|
|
<th>Time</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Events}} {{if eq .Action "download"}}
|
|
<tr>
|
|
<td>{{.IP}}</td>
|
|
<td>{{.File}}</td>
|
|
<td>{{.Timestamp.Format "2006-01-02 15:04:05"}}</td>
|
|
</tr>
|
|
{{end}} {{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="tab-pane fade" id="chart" role="tabpanel">
|
|
<h4 class="mb-3">Downloads Chart</h4>
|
|
<div class="bg-light p-3 rounded text-dark">
|
|
<canvas id="downloadChart" height="120"></canvas>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="text-center mt-5">
|
|
<a href="/" class="btn btn-outline-info">Go Back</a>
|
|
</div>
|
|
</div>
|
|
<footer class="text-center py-3 bg-black text-muted border-top border-secondary mt-auto">
|
|
Powered by <strong>Golang</strong>
|
|
</footer>
|
|
<script src="/static/bootstrap.bundle.min.js"></script>
|
|
<script src="/static/chart.min.js"></script>
|
|
<script>
|
|
fetch("/dashboard-data").then(r => r.json()).then(data => {
|
|
const ctx = document.getElementById('downloadChart').getContext('2d')
|
|
const labels = data.map(e => e.ip + ": " + e.file)
|
|
const values = data.map(e => e.count)
|
|
new Chart(ctx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: labels,
|
|
datasets: [{ label: "Downloads", data: values, backgroundColor: '#00d1b2' }]
|
|
},
|
|
options: {
|
|
scales: {
|
|
x: { ticks: { color: "#000" } },
|
|
y: { ticks: { color: "#000" }, beginAtZero: true }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|