+
+
+
+
+
|
- | {{ auditLogItem.username }} |
- {{ auditLogItem.auditable_type }}.{{ auditLogItem.action }}
- |
-
- {{ auditLogItem.remote_address }}
+ {{ generateLogText(auditLogItem) }}
|
{{
@@ -44,6 +45,9 @@
)
}}
|
+
+ {{ auditLogItem.remote_address }}
+ |
@@ -81,13 +85,48 @@ export default {
records: 'auditlogs/getAuditLogs',
uiFlags: 'auditlogs/getUIFlags',
meta: 'auditlogs/getMeta',
+ agentList: 'agents/getAgents',
}),
},
mounted() {
// Fetch API Call
this.$store.dispatch('auditlogs/fetch', { page: 1 });
+ this.$store.dispatch('agents/get');
},
methods: {
+ getAgentName(email) {
+ if (email === null) {
+ return this.$t('AUDIT_LOGS.ACTION.SYSTEM');
+ }
+ const agentName = this.agentList.find(agent => agent.email === email)
+ ?.name;
+ // If agent does not exist(removed/deleted), return email from audit log
+ return agentName || email;
+ },
+ generateLogText(auditLogItem) {
+ const username = this.getAgentName(auditLogItem.username);
+ const auditableType = auditLogItem.auditable_type.toLowerCase();
+ const action = auditLogItem.action.toLowerCase();
+
+ const logActions = {
+ create: this.$t('AUDIT_LOGS.ACTION.ADD'),
+ destroy: this.$t('AUDIT_LOGS.ACTION.DELETE'),
+ update: this.$t('AUDIT_LOGS.ACTION.EDIT'),
+ sign_in: this.$t('AUDIT_LOGS.ACTION.SIGN_IN'),
+ sign_out: this.$t('AUDIT_LOGS.ACTION.SIGN_OUT'),
+ };
+
+ // detect if the action is custom user action, which involves
+ // only the user, such as signing in, signing out etc.
+ // if it is, then do not show the auditable type
+ const userActions = this.getUserActions(action);
+ return `${username} ${logActions[action] || action} ${
+ userActions ? '' : auditableType
+ }`;
+ },
+ getUserActions(action) {
+ return ['sign_in', 'sign_out'].includes(action);
+ },
onPageChange(page) {
window.history.pushState({}, null, `${this.$route.path}?page=${page}`);
try {
@@ -101,12 +140,24 @@ export default {
},
};
-
From ae7df60a7507666718b65e5cf991970686496115 Mon Sep 17 00:00:00 2001
From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Date: Tue, 30 May 2023 18:54:51 +0530
Subject: [PATCH 6/7] fix: Special characters not being decoded (#7218)
---
app/javascript/widget/components/AgentMessage.vue | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/app/javascript/widget/components/AgentMessage.vue b/app/javascript/widget/components/AgentMessage.vue
index 32dda6b76..ae1c10c37 100755
--- a/app/javascript/widget/components/AgentMessage.vue
+++ b/app/javascript/widget/components/AgentMessage.vue
@@ -42,11 +42,10 @@