generated from bastian/boilerplate
Initial commit
This commit is contained in:
39
apps/frontend/src/app/features/audit/audit.page.ts
Normal file
39
apps/frontend/src/app/features/audit/audit.page.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { ApiClientService, type AuditLogDto } from '@boilerplate/api-client';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
template: `
|
||||
<section class="ui-grid">
|
||||
@for (entry of entries(); track entry.id) {
|
||||
<article class="ui-card">
|
||||
<strong>{{ labels[entry.action] || entry.action }}</strong>
|
||||
<span class="ui-help-text"
|
||||
>{{ entry.createdAt }} · Objekt: {{ entry.targetType }} {{ entry.targetId }}</span
|
||||
>
|
||||
<small class="ui-meta">Request-ID: {{ entry.requestId }}</small>
|
||||
</article>
|
||||
}
|
||||
</section>
|
||||
`,
|
||||
})
|
||||
export class AuditPageComponent {
|
||||
private readonly api = inject(ApiClientService);
|
||||
readonly entries = signal<AuditLogDto[]>([]);
|
||||
readonly labels: Record<string, string> = {
|
||||
USER_ACTIVATED: 'Benutzer aktiviert',
|
||||
USER_DEACTIVATED: 'Benutzer deaktiviert',
|
||||
USER_ROLE_ASSIGNED: 'Rolle zugewiesen',
|
||||
USER_ROLE_REMOVED: 'Rolle entfernt',
|
||||
ROLE_CREATED: 'Rolle erstellt',
|
||||
ROLE_UPDATED: 'Rolle aktualisiert',
|
||||
ROLE_DELETED: 'Rolle geloescht',
|
||||
ROLE_PERMISSIONS_UPDATED: 'Permissions aktualisiert',
|
||||
SESSION_REVOKED: 'Session beendet',
|
||||
ALL_USER_SESSIONS_REVOKED: 'Alle Sessions beendet',
|
||||
};
|
||||
|
||||
constructor() {
|
||||
this.api.audit().subscribe((page) => this.entries.set(page.items));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user