refactor(audit): system-audit detail view on app-details-card pattern

Migrates the event-details section to the .app-details-card summary +
container pattern with outcome badge in the summary meta slot, and
truncates request ID / IP hash / user-agent hash for readable inline
display. Same content, consistent with the rest of the detail-page
design language.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 23:52:38 +02:00
parent b2982bdac7
commit e9f210decb

View File

@@ -22,6 +22,7 @@ if ($metadataJson !== '') {
}
$requestId = trim((string) ($auditLog['request_id'] ?? ''));
$requestIdDisplay = $requestId !== '' ? substr($requestId, 0, 10) : '-';
$eventType = trim((string) ($auditLog['event_type'] ?? ''));
$channel = strtoupper(trim((string) ($auditLog['channel'] ?? '')));
$errorCode = trim((string) ($auditLog['error_code'] ?? ''));
@@ -30,7 +31,9 @@ $path = trim((string) ($auditLog['path'] ?? ''));
$targetType = trim((string) ($auditLog['target_type'] ?? ''));
$targetUuid = trim((string) ($auditLog['target_uuid'] ?? ''));
$ipHash = trim((string) ($auditLog['ip_hash'] ?? ''));
$ipHashDisplay = $ipHash !== '' ? substr($ipHash, 0, 16) . '...' : '-';
$userAgentHash = trim((string) ($auditLog['user_agent_hash'] ?? ''));
$userAgentHashDisplay = $userAgentHash !== '' ? substr($userAgentHash, 0, 16) . '...' : '-';
$actorLabel = trim((string) ($auditLog['actor_user_display_name'] ?? ''));
$actorEmail = trim((string) ($auditLog['actor_user_email'] ?? ''));
@@ -56,47 +59,46 @@ if ($tenantLabel === '') {
?>
<div class="app-details-content">
<details open>
<summary><?php e(t('Event details')); ?></summary>
<hr>
<details class="app-details-card" open>
<summary>
<span class="app-details-card-summary-title"><?php e(t('Event details')); ?></span>
<span class="app-details-card-summary-meta">
<span class="badge" data-variant="<?php e($outcomeVariant); ?>"><?php e(t($outcome->labelToken())); ?></span>
</span>
</summary>
<div class="app-details-card-container">
<div class="grid">
<div>
<small><?php e(t('Event type')); ?></small>
<p><code><?php e($eventType !== '' ? $eventType : '-'); ?></code></p>
</div>
<div>
<small><?php e(t('Outcome')); ?></small>
<p><span class="badge" data-variant="<?php e($outcomeVariant); ?>"><?php e(t($outcome->labelToken())); ?></span></p>
<small><?php e(t('Channel')); ?></small>
<p><?php e($channel !== '' ? $channel : '-'); ?></p>
</div>
</div>
<div class="grid">
<div>
<small><?php e(t('Channel')); ?></small>
<p><?php e($channel !== '' ? $channel : '-'); ?></p>
<small><?php e(t('Method')); ?></small>
<p><span class="badge" data-variant="neutral"><?php e($method !== '' ? $method : '-'); ?></span></p>
</div>
<div>
<small><?php e(t('Error code')); ?></small>
<p><?php e($errorCode !== '' ? $errorCode : '-'); ?></p>
</div>
</div>
<?php if ($method !== '' || $path !== ''): ?>
<div class="grid">
<div>
<small><?php e(t('Method')); ?></small>
<p><?php e($method !== '' ? $method : '-'); ?></p>
</div>
<div>
<small><?php e(t('Path')); ?></small>
<p><code><?php e($path !== '' ? $path : '-'); ?></code></p>
</div>
</div>
<?php endif; ?>
</details>
<hr>
<details>
<summary><?php e(t('Scope')); ?></summary>
<hr>
<details class="app-details-card" open>
<summary>
<span class="app-details-card-summary-title"><?php e(t('Scope')); ?></span>
</summary>
<div class="app-details-card-container">
<div class="grid">
<div>
<small><?php e(t('Actor')); ?></small>
@@ -129,14 +131,17 @@ if ($tenantLabel === '') {
<p><code><?php e($targetUuid !== '' ? $targetUuid : '-'); ?></code></p>
</div>
</div>
</div>
</details>
<?php if ($metadataPretty !== '-'): ?>
<hr>
<details>
<summary><?php e(t('Metadata')); ?></summary>
<hr>
<textarea readonly rows="14"><?php e($metadataPretty); ?></textarea>
<details class="app-details-card">
<summary>
<span class="app-details-card-summary-title"><?php e(t('Metadata')); ?></span>
</summary>
<div class="app-details-card-container">
<pre><code><?php e($metadataPretty); ?></code></pre>
</div>
</details>
<?php endif; ?>
</div>
@@ -167,17 +172,25 @@ if ($tenantLabel === '') {
<small><?php e(t('Request ID')); ?></small>
<p>
<span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e($requestId); ?>">
<?php e($requestId !== '' ? substr($requestId, 0, 10) : '-'); ?>
<?php e($requestIdDisplay); ?>
</span>
</p>
</div>
<div>
<small><?php e(t('IP hash')); ?></small>
<p><code><?php e($ipHash !== '' ? substr($ipHash, 0, 16) . '...' : '-'); ?></code></p>
<p>
<span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e($ipHash); ?>">
<?php e($ipHashDisplay); ?>
</span>
</p>
</div>
<div>
<small><?php e(t('User agent hash')); ?></small>
<p><code><?php e($userAgentHash !== '' ? substr($userAgentHash, 0, 16) . '...' : '-'); ?></code></p>
<p>
<span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e($userAgentHash); ?>">
<?php e($userAgentHashDisplay); ?>
</span>
</p>
</div>
</div>
</aside>