Loading indicator, filter modified events, stronger typing

This commit is contained in:
shamoon 2024-04-08 22:08:38 -07:00
parent e15b3ae9de
commit 2adf32c2d6
3 changed files with 68 additions and 47 deletions

View File

@ -1,4 +1,16 @@
<ul class="list-group list-group-"> @if (loading) {
<div class="d-flex">
<div class="spinner-border spinner-border-sm fw-normal" role="status"></div>
</div>
} @else {
<ul class="list-group">
@if (entries.length === 0) {
<li class="list-group-item">
<div class="d-flex justify-content-center">
<span class="fst-italic" i18n>No entries found.</span>
</div>
</li>
} @else {
@for (entry of entries; track entry.id) { @for (entry of entries; track entry.id) {
<li class="list-group-item"> <li class="list-group-item">
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
@ -35,7 +47,7 @@
</td> </td>
</tr> </tr>
} }
@else if (change.key !== 'modified') { @else {
<tr> <tr>
<td>{{ change.key | titlecase }}:</td> <td>{{ change.key | titlecase }}:</td>
<td>{{ change.value[1] }}</td> <td>{{ change.value[1] }}</td>
@ -47,4 +59,6 @@
</div> </div>
</li> </li>
} }
</ul> }
</ul>
}

View File

@ -28,6 +28,11 @@ export class AuditLogComponent implements OnInit {
.getAuditLog(this._documentId) .getAuditLog(this._documentId)
.subscribe((auditLogEntries) => { .subscribe((auditLogEntries) => {
this.entries = auditLogEntries this.entries = auditLogEntries
.map((entry) => {
delete entry.changes['modified']
return entry
})
.filter((entry) => Object.keys(entry.changes).length > 0)
this.loading = false this.loading = false
}) })
} }

View File

@ -10,7 +10,9 @@ export interface AuditLogEntry {
id: number id: number
timestamp: string timestamp: string
action: AuditLogAction action: AuditLogAction
changes: any changes: {
[key: string]: string[]
}
remote_addr: string remote_addr: string
actor?: User actor?: User
} }