towerops/lib/towerops_web/live/admin/dashboard_live.html.heex
Graham McIntire d2e38e351e
feat: display all timestamps in user's timezone
- Add timezone to socket assigns in mount_current_scope
- Detect user timezone from browser using Intl.DateTimeFormat
- Auto-save detected timezone to user profile on first connection
- Update all templates to use TimeHelpers with timezone parameter
- Update agent helper functions to accept timezone parameter
- Templates updated:
  - Alert list (triggered, acknowledged, resolved)
  - Device list (last checked)
  - Agent list and show (created, last seen, updated)
  - Admin dashboard (impersonation logs)
  - Admin org/user lists (created/joined dates)
  - Main dashboard (alert times)
2026-01-18 12:19:17 -06:00

40 lines
1.7 KiB
Text

<Layouts.admin flash={@flash}>
<div class="space-y-6">
<div>
<h1 class="text-2xl font-bold text-zinc-900">Admin Dashboard</h1>
<p class="text-zinc-600">System overview and recent activity</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-white rounded-lg border border-zinc-200 p-6">
<h2 class="text-lg font-semibold text-zinc-900 mb-2">Users</h2>
<p class="text-3xl font-bold text-zinc-900">{@user_count}</p>
<.link navigate={~p"/admin/users"} class="text-blue-600 hover:underline text-sm">
View all users →
</.link>
</div>
<div class="bg-white rounded-lg border border-zinc-200 p-6">
<h2 class="text-lg font-semibold text-zinc-900 mb-2">Organizations</h2>
<p class="text-3xl font-bold text-zinc-900">{@org_count}</p>
<.link navigate={~p"/admin/organizations"} class="text-blue-600 hover:underline text-sm">
View all organizations →
</.link>
</div>
</div>
<div class="bg-white rounded-lg border border-zinc-200">
<div class="px-4 py-3 border-b border-zinc-200">
<h2 class="text-lg font-semibold text-zinc-900">Recent Audit Logs</h2>
</div>
<.table id="audit-logs" rows={@recent_logs}>
<:col :let={log} label="Action">{log.action}</:col>
<:col :let={log} label="Superuser">{log.superuser && log.superuser.email}</:col>
<:col :let={log} label="Target">{log.target_user && log.target_user.email}</:col>
<:col :let={log} label="Time">
{ToweropsWeb.TimeHelpers.format_iso8601(log.inserted_at, @timezone)}
</:col>
</.table>
</div>
</div>
</Layouts.admin>