From 06d53863a83c003e7248f5cfc8362765882d19bb Mon Sep 17 00:00:00 2001 From: Sandeepa Singh Date: Mon, 24 May 2021 13:51:09 +0530 Subject: Add POST code logs page This page will be included in the Health section of the primary navigation. The user will be able to export and download POST code logs. Signed-off-by: Sandeepa Singh Change-Id: I26cf1e01bfdfcf298f24f2c7dd9633ab7d31f1b5 --- src/store/modules/Health/PostCodeLogsStore.js | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/store/modules/Health/PostCodeLogsStore.js (limited to 'src/store/modules') diff --git a/src/store/modules/Health/PostCodeLogsStore.js b/src/store/modules/Health/PostCodeLogsStore.js new file mode 100644 index 00000000..ac470ece --- /dev/null +++ b/src/store/modules/Health/PostCodeLogsStore.js @@ -0,0 +1,39 @@ +import api from '@/store/api'; + +const PostCodeLogsStore = { + namespaced: true, + state: { + allPostCodes: [], + }, + getters: { + allPostCodes: (state) => state.allPostCodes, + }, + mutations: { + setAllPostCodes: (state, allPostCodes) => + (state.allPostCodes = allPostCodes), + }, + actions: { + async getPostCodesLogData({ commit }) { + return await api + .get('/redfish/v1/Systems/system/LogServices/PostCodes/Entries') + .then(({ data: { Members = [] } = {} }) => { + const postCodeLogs = Members.map((log) => { + const { Created, MessageArgs, AdditionalDataURI } = log; + return { + date: new Date(Created), + bootCount: MessageArgs[0], + timeStampOffset: MessageArgs[1], + postCode: MessageArgs[2], + uri: AdditionalDataURI, + }; + }); + commit('setAllPostCodes', postCodeLogs); + }) + .catch((error) => { + console.log('POST Codes Log Data:', error); + }); + }, + }, +}; + +export default PostCodeLogsStore; -- cgit v1.2.3