|
1 | 1 | <template> |
2 | | - <AuditLogBrowser ref="AuditLog" :users="users" :logEntries="logEntries" :associations="associations" :logType="logScope" @load-entries="loadEntries"> |
| 2 | + <AuditLogBrowser ref="AuditLog" :users="users" :logEntries="logEntries" :associations="associations" :logType="logScope" :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 application." /> |
5 | 5 | </template> |
@@ -61,6 +61,7 @@ export default { |
61 | 61 | data () { |
62 | 62 | return { |
63 | 63 | logEntries: [], |
| 64 | + loading: true, |
64 | 65 | associations: {}, // applications, instances, devices |
65 | 66 | users: [], |
66 | 67 | auditFilters: { |
@@ -122,16 +123,22 @@ export default { |
122 | 123 | } |
123 | 124 | params.set('includeChildren', includeChildren) |
124 | 125 | params.set('scope', paramScope) |
125 | | - if (this.applicationId) { |
126 | | - let log |
127 | | - if (paramScope === 'application') { |
128 | | - log = (await ApplicationApi.getApplicationAuditLog(this.applicationId, params, cursor, 200)) |
129 | | - } else { |
130 | | - const instanceId = this.auditFilters.selectedEventScope |
131 | | - log = (await InstanceApi.getInstanceAuditLog(instanceId, params, cursor, 200)) |
| 126 | + try { |
| 127 | + if (this.applicationId) { |
| 128 | + let log |
| 129 | + if (paramScope === 'application') { |
| 130 | + log = (await ApplicationApi.getApplicationAuditLog(this.applicationId, params, cursor, 200)) |
| 131 | + } else { |
| 132 | + const instanceId = this.auditFilters.selectedEventScope |
| 133 | + log = (await InstanceApi.getInstanceAuditLog(instanceId, params, cursor, 200)) |
| 134 | + } |
| 135 | + this.logEntries = log.log |
| 136 | + this.associations = includeChildren ? log.associations : null |
132 | 137 | } |
133 | | - this.logEntries = log.log |
134 | | - this.associations = includeChildren ? log.associations : null |
| 138 | + } catch (error) { |
| 139 | + console.error('Failed to load audit logs:', error) |
| 140 | + } finally { |
| 141 | + this.loading = false |
135 | 142 | } |
136 | 143 | } |
137 | 144 | }, |
|
0 commit comments