fix(dashboard): readable audit labels in the recent-events panel (v0.9.52)

The /audit page already rendered human-readable action labels (v0.9.48), but the
Dashboard's "recent events" panel still showed the raw codes (wg.set-endpoint,
deploy.update_request). It now uses the same AuditEvent::action_label + is_error
styling, so failures show red with an alert icon — consistent with the audit page.

Test: dashboard recent events render the readable label, not the raw code. 372
pass, Pint clean, dashboard loads 200 with no console errors and no raw codes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/v1-foundation v0.9.52
boban 2026-06-22 00:27:13 +02:00
parent 4b2aee3941
commit 91be170e78
4 changed files with 43 additions and 4 deletions

View File

@ -13,7 +13,13 @@ getaggte Releases (Kanal `stable`, optional `beta`) — niemals Entwicklungs-Bui
_Keine offenen Änderungen — der nächste Stand wird hier gesammelt und als `vX.Y.Z` getaggt._
## [0.9.51] - 2026-06-22
## [0.9.52] - 2026-06-22
### Behoben
- **Audit-Panel auf dem Dashboard zeigte noch Roh-Codes.** Die „letzten Ereignisse" auf dem Dashboard
wurden noch als `wg.set-endpoint` / `deploy.update_request` angezeigt (die /audit-Seite war bereits
lesbar). Jetzt zeigt auch das Dashboard die verständlichen Bezeichnungen, und fehlgeschlagene /
sicherheitsrelevante Ereignisse erscheinen rot mit Warn-Symbol — konsistent mit der Audit-Seite.
### Behoben
- **„Was ist neu" wurde nicht angezeigt.** Der Vorschau-Block lud die `CHANGELOG.md` am Tag `0.9.50`,

View File

@ -2,7 +2,7 @@
return [
// First tagged release is v0.1.0 (semantic, not -dev).
'version' => '0.9.51',
'version' => '0.9.52',
// Deployed commit + branch. install.sh bakes these into .env from the host's .git (the prod
// image ships no .git); the Versions page prefers them and falls back to a live .git read in

View File

@ -138,9 +138,17 @@
<div class="divide-y divide-line">
@forelse ($events as $e)
<div class="flex items-start gap-3 px-4 py-2.5 sm:px-5">
<span class="mt-0.5 grid h-7 w-7 shrink-0 place-items-center rounded-sm bg-raised text-ink-3"><x-icon name="audit" class="h-3.5 w-3.5" /></span>
<span @class([
'mt-0.5 grid h-7 w-7 shrink-0 place-items-center rounded-sm',
'bg-offline/10 text-offline' => $e->is_error,
'bg-raised text-ink-3' => ! $e->is_error,
])><x-icon :name="$e->is_error ? 'alert' : 'audit'" class="h-3.5 w-3.5" /></span>
<div class="min-w-0 flex-1">
<p class="text-sm text-ink"><span class="text-ink-2">{{ $e->actor }}</span> · {{ $e->action }}</p>
<p class="text-sm text-ink">
<span class="text-ink-2">{{ $e->actor }}</span>
<span class="text-ink-4">·</span>
<span @class(['font-medium', 'text-offline' => $e->is_error, 'text-ink' => ! $e->is_error])>{{ $e->action_label }}</span>
</p>
<p class="truncate font-mono text-[11px] text-ink-3">{{ $e->target }}</p>
</div>
<span class="shrink-0 font-mono text-[11px] text-ink-4">{{ $e->created_at->diffForHumans(null, true) }}</span>

View File

@ -0,0 +1,25 @@
<?php
namespace Tests\Feature;
use App\Livewire\Dashboard;
use App\Models\AuditEvent;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
use Tests\TestCase;
class DashboardAuditTest extends TestCase
{
use RefreshDatabase;
public function test_dashboard_recent_events_use_readable_labels(): void
{
$this->actingAs(User::factory()->create(['must_change_password' => false]));
AuditEvent::create(['actor' => 'Administrator', 'action' => 'wg.set-endpoint', 'target' => '10.10.90.165', 'ip' => '127.0.0.1']);
Livewire::test(Dashboard::class)
->assertSee('WireGuard-Endpoint geändert') // readable label
->assertDontSee('wg.set-endpoint'); // not the raw code
}
}