This commit is contained in:
shamoon
2024-04-13 23:39:52 -07:00
parent b2246f6a8b
commit aeaa0d18e2
5 changed files with 23 additions and 38 deletions

View File

@@ -1,3 +0,0 @@
table {
transition: all 0.3s ease;
}

View File

@@ -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)
})
})

View File

@@ -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)
}
}
}