Cleanup
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
table {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
@@ -54,24 +54,4 @@ describe('AuditLogComponent', () => {
|
||||
fixture.detectChanges()
|
||||
expect(getAuditLogSpy).toHaveBeenCalledWith(1)
|
||||
})
|
||||
|
||||
it('should toggle entry', () => {
|
||||
const entry = {
|
||||
id: 1,
|
||||
actor: {
|
||||
id: 1,
|
||||
username: 'user1',
|
||||
},
|
||||
action: AuditLogAction.Create,
|
||||
timestamp: '2021-01-01T00:00:00Z',
|
||||
remote_addr: '1.2.3.4',
|
||||
changes: {
|
||||
title: ['old title', 'new title'],
|
||||
},
|
||||
}
|
||||
component.toggleEntry(entry)
|
||||
expect(component.openEntries.has(1)).toBe(true)
|
||||
component.toggleEntry(entry)
|
||||
expect(component.openEntries.has(1)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -19,7 +19,6 @@ export class AuditLogComponent implements OnInit {
|
||||
|
||||
public loading: boolean = true
|
||||
public entries: AuditLogEntry[] = []
|
||||
public openEntries: Set<number> = new Set()
|
||||
|
||||
constructor(private documentService: DocumentService) {}
|
||||
|
||||
@@ -30,21 +29,8 @@ export class AuditLogComponent implements OnInit {
|
||||
.getAuditLog(this._documentId)
|
||||
.subscribe((auditLogEntries) => {
|
||||
this.entries = auditLogEntries
|
||||
.map((entry) => {
|
||||
delete entry.changes['modified']
|
||||
return entry
|
||||
})
|
||||
.filter((entry) => Object.keys(entry.changes).length > 0)
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
toggleEntry(entry: AuditLogEntry) {
|
||||
if (this.openEntries.has(entry.id)) {
|
||||
this.openEntries.delete(entry.id)
|
||||
} else {
|
||||
this.openEntries.add(entry.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user