Skip to content

Commit

Permalink
Audit Logs Page Implementation (#174)
Browse files Browse the repository at this point in the history
* Added Implementation of AuditLogs GUI

* Added error handling for download all

* removed the AuditLogEntry condition

* Added success toast

* Added dropdown from id and message string

* rverted commits

* Addresed review comments
  • Loading branch information
Renuka9527 authored Feb 20, 2024
1 parent 08a7899 commit 38d9b57
Show file tree
Hide file tree
Showing 10 changed files with 440 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/AppNavigation/AppNavigationMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ const AppNavigationMixin = {
label: this.$t('appNavigation.eventLogs'),
route: '/logs/event-logs',
},
{
id: 'audit-logs',
label: this.$t('appNavigation.auditLogs'),
route: '/logs/audit-logs',
},
{
id: 'post-code-logs',
label: this.$t('appNavigation.postCodeLogs'),
Expand Down
6 changes: 6 additions & 0 deletions src/env/components/AppNavigation/ibm.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ const AppNavigationMixin = {
route: '/logs/event-logs',
restrictTo: [],
},
{
id: 'audit-logs',
label: this.$t('appNavigation.auditLogs'),
route: '/logs/audit-logs',
restrictTo: [],
},
{
id: 'dumps',
label: this.$t('appNavigation.dumps'),
Expand Down
9 changes: 9 additions & 0 deletions src/env/router/ibm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AppLayout from '@/layouts/AppLayout.vue';
import AuditLogs from '@/views/Logs/AuditLogs';
import ChangePassword from '@/views/ChangePassword';
import ConcurrentMaintenance from '@/views/HardwareStatus/ConcurrentMaintenance';
import Sessions from '@/views/SecurityAndAccess/Sessions';
Expand Down Expand Up @@ -166,6 +167,14 @@ const routes = [
title: i18n.t('appPageTitle.eventLogs'),
},
},
{
path: '/logs/audit-logs',
name: 'audit-logs',
component: AuditLogs,
meta: {
title: i18n.t('appPageTitle.auditLogs'),
},
},
{
path: '/logs/post-code-logs',
name: 'post-code-logs',
Expand Down
20 changes: 20 additions & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"titleShowNavigation": "Show navigation"
},
"appNavigation": {
"auditLogs": "@:appPageTitle.auditLogs",
"capacityOnDemand": "@:appPageTitle.capacityOnDemand",
"certificates": "@:appPageTitle.certificates",
"concurrentMaintenance": "@:appPageTitle.concurrentMaintenance",
Expand Down Expand Up @@ -166,6 +167,7 @@
"virtualMedia": "@:appPageTitle.virtualMedia"
},
"appPageTitle": {
"auditLogs": "Audit logs",
"capacityOnDemand": "Capacity on demand",
"certificates": "Certificates",
"changePassword": "Change password",
Expand Down Expand Up @@ -207,6 +209,24 @@
"userManagement": "User management",
"virtualMedia": "Virtual media"
},
"pageAuditLogs": {
"table": {
"id": "ID",
"op": "Operation",
"acct": "Account",
"addr": "Address",
"res": "Response",
"messageArgs": "MessageArgs",
"message": "Message",
"searchLogs": "Search logs",
"eventTimeStamp": "Date"
},
"toast": {
"infoStartDownload": "Download might take several minutes to complete.",
"errorStartDownload": "Error downloading Logs",
"successStartDownload": "Logs downloaded successfully"
}
},
"pageCapacityOnDemand": {
"absent": "Absent",
"deferring": "Deferring",
Expand Down
9 changes: 9 additions & 0 deletions src/router/routes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AppLayout from '@/layouts/AppLayout.vue';
import AuditLogs from '@/views/Logs/AuditLogs';
import ChangePassword from '@/views/ChangePassword';
import ConsoleLayout from '@/layouts/ConsoleLayout.vue';
import ConcurrentMaintenance from '@/views/HardwareStatus/ConcurrentMaintenance';
Expand Down Expand Up @@ -126,6 +127,14 @@ const routes = [
title: i18n.t('appPageTitle.eventLogs'),
},
},
{
path: '/logs/audit-logs',
name: 'audit-logs',
component: AuditLogs,
meta: {
title: i18n.t('appPageTitle.auditLogs'),
},
},
{
path: '/logs/post-code-logs',
name: 'post-code-logs',
Expand Down
2 changes: 2 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import ProcessorStore from './modules/HardwareStatus/ProcessorStore';
import AssemblyStore from './modules/HardwareStatus/AssemblyStore';
import PcieTopologyStore from './modules/HardwareStatus/PcieTopologyStore';
import PostCodeLogsStore from './modules/Logs/PostCodeLogsStore';
import AuditLogsStore from './modules/Logs/AuditLogsStore';
import PoliciesStore from './modules/SecurityAndAccess/PoliciesStore';
import FactoryResetStore from './modules/Operations/FactoryResetStore';
import HardwareDeconfigurationStore from './modules/Settings/HardwareDeconfigurationStore';
Expand Down Expand Up @@ -77,6 +78,7 @@ export default new Vuex.Store({
assemblies: AssemblyStore,
pcieSlots: PcieSlotsStore,
postCodeLogs: PostCodeLogsStore,
auditLogs: AuditLogsStore,
virtualMedia: VirtualMediaStore,
policies: PoliciesStore,
factoryReset: FactoryResetStore,
Expand Down
49 changes: 49 additions & 0 deletions src/store/modules/Logs/AuditLogsStore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import api from '@/store/api';

const AuditLogsStore = {
namespaced: true,
state: {
allAuditLogs: [],
},
getters: {
allAuditLogs: (state) => state.allAuditLogs,
},
mutations: {
setAllAuditLogs: (state, allAuditLogs) =>
(state.allAuditLogs = allAuditLogs),
},
actions: {
async getAuditLogData({ commit }) {
return await api
.get('/redfish/v1/Systems/system/LogServices/AuditLog/Entries')
.then(({ data: { Members = [] } = {} }) => {
const auditLogs = Members.map((log) => {
const { EventTimestamp, Id, Message, MessageArgs, Oem } = log;
const [, operation, account, , , address, , result] = MessageArgs;
return {
auditId: Id,
operation: operation,
message: Message,
account: account || '--',
date: new Date(EventTimestamp),
addr: address ? address.split('::ffff:').pop() : '--',
res: result || '--',
uri: log['@odata.id'],
additionalDataUri: Oem.IBM.AdditionalDataFullAuditLogURI,
};
});
commit('setAllAuditLogs', auditLogs);
})
.catch((error) => {
console.log(error);
});
},
async downloadLogData(_, uri) {
return await api.get(uri).then((response) => {
return response;
});
},
},
};

export default AuditLogsStore;
Loading

0 comments on commit 38d9b57

Please sign in to comment.