make addition ui fixes for cramped features
This commit is contained in:
@@ -30,45 +30,47 @@
|
||||
<p v-else-if="!loading && events.length === 0" class="text-sm text-ink-secondary">
|
||||
No audit events for this batch yet.
|
||||
</p>
|
||||
<div v-else class="overflow-x-auto">
|
||||
<table class="w-full min-w-[520px] text-sm">
|
||||
<thead>
|
||||
<tr class="border-b border-line text-left text-ink-secondary">
|
||||
<th class="py-2 px-2 font-medium w-[28%]">Timestamp</th>
|
||||
<th class="py-2 px-2 font-medium">Event</th>
|
||||
<th class="py-2 px-2 font-medium w-[22%]">Actor</th>
|
||||
<th class="py-2 px-2 font-medium w-[22%]">Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="event in events"
|
||||
:key="event.id"
|
||||
class="border-b border-line last:border-0 align-top"
|
||||
<ol v-else class="space-y-0" data-testid="audit-trail-timeline">
|
||||
<li
|
||||
v-for="event in events"
|
||||
:key="event.id"
|
||||
class="flex gap-3"
|
||||
>
|
||||
<div class="w-[5.5rem] shrink-0 pt-0.5 text-right">
|
||||
<time
|
||||
class="block text-[11px] leading-snug text-ink-secondary tabular-nums"
|
||||
:datetime="event.occurredAt"
|
||||
>
|
||||
<td class="py-2 px-2 text-ink-secondary whitespace-nowrap">
|
||||
{{ formatDateTime(event.occurredAt) }}
|
||||
</td>
|
||||
<td class="py-2 px-2">
|
||||
<span class="font-medium text-ink-strong">
|
||||
{{ formatEventType(event.eventType) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-2 px-2 text-ink">
|
||||
{{ event.actorFullName || event.actorUsername || '—' }}
|
||||
</td>
|
||||
<td class="py-2 px-2 text-ink-secondary text-xs">
|
||||
{{ summarizePayload(event.metadataJson) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{ formatDateTime(event.occurredAt) }}
|
||||
</time>
|
||||
</div>
|
||||
|
||||
<div class="observation-card__rail self-stretch" aria-hidden="true">
|
||||
<span class="observation-card__dot" />
|
||||
<span class="mt-1 w-px flex-1 bg-line" />
|
||||
</div>
|
||||
|
||||
<div class="min-w-0 flex-1 pb-4">
|
||||
<p class="text-sm font-bold leading-snug text-ink-strong">
|
||||
{{ formatEventType(event.eventType) }}
|
||||
</p>
|
||||
<p class="mt-0.5 text-xs text-ink">
|
||||
{{ event.actorFullName || event.actorUsername || '—' }}
|
||||
</p>
|
||||
<p
|
||||
v-if="summarizePayload(event.metadataJson) !== '—'"
|
||||
class="mt-1 text-xs text-ink-secondary"
|
||||
>
|
||||
{{ summarizePayload(event.metadataJson) }}
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<button
|
||||
v-if="hasMore"
|
||||
type="button"
|
||||
class="mt-3 text-sm font-medium text-primary-700 hover:text-primary-800 disabled:opacity-50"
|
||||
class="mt-1 text-sm font-medium text-primary-700 hover:text-primary-800 disabled:opacity-50"
|
||||
:disabled="loading"
|
||||
data-testid="audit-trail-load-more"
|
||||
@click="loadMore"
|
||||
@@ -121,13 +123,17 @@ async function loadMore() {
|
||||
|
||||
function formatEventType(type: string): string {
|
||||
return type
|
||||
.toLowerCase()
|
||||
.replace(/_/g, ' ')
|
||||
.replace(/\b\w/g, (c) => c.toUpperCase())
|
||||
}
|
||||
|
||||
function formatDateTime(iso: string): string {
|
||||
try {
|
||||
return new Date(iso).toLocaleString()
|
||||
return new Date(iso).toLocaleString(undefined, {
|
||||
dateStyle: 'short',
|
||||
timeStyle: 'short',
|
||||
})
|
||||
} catch {
|
||||
return iso
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user