oups
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
{{define "title"}}Audit Log{{end}}
|
||||
{{define "header"}}Audit Log{{end}}
|
||||
{{define "content"}}
|
||||
|
||||
<!-- Filters -->
|
||||
<form method="GET" action="/audit" class="bg-discord-card rounded-lg border border-discord-border p-4 mb-6">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3 mb-3">
|
||||
<div>
|
||||
<label class="block text-xs text-gray-400 mb-1">Admin ID (interne)</label>
|
||||
<input type="text" name="admin_id" value="{{.FAdminID}}" placeholder="ex: 1"
|
||||
class="w-full bg-discord-hover border border-discord-border rounded-lg px-3 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-discord-accent">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs text-gray-400 mb-1">Action</label>
|
||||
<select name="action" class="w-full bg-discord-hover border border-discord-border rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-discord-accent">
|
||||
<option value="">Toutes les actions</option>
|
||||
{{range .Actions}}
|
||||
<option value="{{.}}" {{if eq . $.FAction}}selected{{end}}>{{.}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs text-gray-400 mb-1">Du</label>
|
||||
<input type="date" name="from" value="{{.FFrom}}"
|
||||
class="w-full bg-discord-hover border border-discord-border rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-discord-accent">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs text-gray-400 mb-1">Au</label>
|
||||
<input type="date" name="to" value="{{.FTo}}"
|
||||
class="w-full bg-discord-hover border border-discord-border rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-discord-accent">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<button type="submit"
|
||||
class="px-4 py-2 bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-medium rounded-lg transition-colors">
|
||||
Filtrer
|
||||
</button>
|
||||
<a href="/audit" class="px-4 py-2 text-sm text-gray-400 hover:text-white border border-discord-border rounded-lg transition-colors">
|
||||
Réinitialiser
|
||||
</a>
|
||||
<span class="text-xs text-gray-500 ml-auto">{{.Total}} entrée{{if gt .Total 1}}s{{end}}</span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Audit table -->
|
||||
<div class="bg-discord-card rounded-lg border border-discord-border overflow-hidden">
|
||||
{{if .Entries}}
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead>
|
||||
<tr class="text-xs text-gray-400 uppercase border-b border-discord-border">
|
||||
<th class="px-4 py-2 text-left">Date</th>
|
||||
<th class="px-4 py-2 text-left">Admin ID</th>
|
||||
<th class="px-4 py-2 text-left">Action</th>
|
||||
<th class="px-4 py-2 text-left">Entité</th>
|
||||
<th class="px-4 py-2 text-left">Entité ID</th>
|
||||
<th class="px-4 py-2 text-left">IP</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-discord-border">
|
||||
{{range .Entries}}
|
||||
<tr class="hover:bg-white/5 transition-colors">
|
||||
<td class="px-4 py-2 text-gray-400 text-xs whitespace-nowrap">{{.CreatedAt.Format "02/01/2006 15:04:05"}}</td>
|
||||
<td class="px-4 py-2 text-gray-300 font-mono text-xs">{{.AdminID}}</td>
|
||||
<td class="px-4 py-2">
|
||||
<span class="px-2 py-0.5 rounded text-xs font-mono bg-discord-hover text-indigo-300 border border-discord-border">{{.Action}}</span>
|
||||
</td>
|
||||
<td class="px-4 py-2 text-gray-400 text-xs">{{.EntityType}}</td>
|
||||
<td class="px-4 py-2 text-gray-400 text-xs font-mono">
|
||||
{{if .EntityID.Valid}}{{.EntityID.Int64}}{{else}}—{{end}}
|
||||
</td>
|
||||
<td class="px-4 py-2 text-gray-500 text-xs font-mono">{{.IPAddress}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{{if gt .Pages 1}}
|
||||
<div class="px-5 py-3 border-t border-discord-border flex items-center gap-2 text-sm">
|
||||
{{if gt .Page 1}}
|
||||
<a href="?page={{add .Page -1}}&admin_id={{.FAdminID}}&action={{.FAction}}&from={{.FFrom}}&to={{.FTo}}"
|
||||
class="px-3 py-1 rounded border border-discord-border text-gray-300 hover:text-white hover:border-gray-500 transition-colors">← Précédent</a>
|
||||
{{end}}
|
||||
<span class="text-gray-400">Page {{.Page}} / {{.Pages}}</span>
|
||||
{{if lt .Page .Pages}}
|
||||
<a href="?page={{add .Page 1}}&admin_id={{.FAdminID}}&action={{.FAction}}&from={{.FFrom}}&to={{.FTo}}"
|
||||
class="px-3 py-1 rounded border border-discord-border text-gray-300 hover:text-white hover:border-gray-500 transition-colors">Suivant →</a>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{else}}
|
||||
<div class="px-5 py-12 text-center text-gray-500 text-sm">
|
||||
Aucune entrée d'audit pour ces critères.
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user