|
1 | 1 | <template> |
2 | | - <AuditLogBrowser ref="AuditLog" :users="users" :logEntries="logEntries" :associations="associations" logType="project" @load-entries="loadEntries"> |
| 2 | + <AuditLogBrowser ref="AuditLog" :users="users" :logEntries="logEntries" :associations="associations" logType="project" :loading="loading" @load-entries="loadEntries"> |
3 | 3 | <template #title> |
4 | 4 | <SectionTopMenu hero="Audit Log" info="Recorded events that have taken place in within this instance." /> |
5 | 5 | </template> |
@@ -49,6 +49,7 @@ export default { |
49 | 49 | data () { |
50 | 50 | return { |
51 | 51 | logEntries: [], |
| 52 | + loading: true, |
52 | 53 | associations: {}, // devices |
53 | 54 | users: [], |
54 | 55 | auditFilters: { |
@@ -92,18 +93,24 @@ export default { |
92 | 93 | * @param cursor - cursor to use for pagination |
93 | 94 | */ |
94 | 95 | async loadEntries (params = new URLSearchParams(), cursor = undefined) { |
95 | | - if (this.instance.id) { |
96 | | - const auditLog = (await InstanceApi.getInstanceAuditLog(this.instance.id, params, cursor, 200)) |
97 | | - this.logEntries = auditLog.log |
98 | | - // dont show associations if we are looking at "this" scope (project)" |
99 | | - let showAssociations = false |
100 | | - if (this.auditFilters.selectedEventScope === 'device') { |
101 | | - showAssociations = true |
| 96 | + try { |
| 97 | + if (this.instance.id) { |
| 98 | + const auditLog = (await InstanceApi.getInstanceAuditLog(this.instance.id, params, cursor, 200)) |
| 99 | + this.logEntries = auditLog.log |
| 100 | + // dont show associations if we are looking at "this" scope (project)" |
| 101 | + let showAssociations = false |
| 102 | + if (this.auditFilters.selectedEventScope === 'device') { |
| 103 | + showAssociations = true |
| 104 | + } |
| 105 | + if (this.auditFilters.selectedEventScope === 'project' && this.auditFilters.includeChildren) { |
| 106 | + showAssociations = true |
| 107 | + } |
| 108 | + this.associations = showAssociations ? auditLog.associations : null |
102 | 109 | } |
103 | | - if (this.auditFilters.selectedEventScope === 'project' && this.auditFilters.includeChildren) { |
104 | | - showAssociations = true |
105 | | - } |
106 | | - this.associations = showAssociations ? auditLog.associations : null |
| 110 | + } catch (error) { |
| 111 | + console.error('Failed to load audit logs:', error) |
| 112 | + } finally { |
| 113 | + this.loading = false |
107 | 114 | } |
108 | 115 | }, |
109 | 116 | triggerLoad ({ users = false, events = true } = {}) { |
|
0 commit comments