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 <sandeepa.singh@ibm.com>
Change-Id: I26cf1e01bfdfcf298f24f2c7dd9633ab7d31f1b5
diff --git a/src/store/index.js b/src/store/index.js
index 82efab9..29dfe4f 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -23,6 +23,7 @@
 import ChassisStore from './modules/Health/ChassisStore';
 import BmcStore from './modules/Health/BmcStore';
 import ProcessorStore from './modules/Health/ProcessorStore';
+import PostCodeLogsStore from './modules/Health/PostCodeLogsStore';
 import SecuritySettingsStore from './modules/Configuration/SecuritySettingsStore';
 import FactoryResetStore from './modules/Control/FactoryResetStore';
 
@@ -60,6 +61,7 @@
     chassis: ChassisStore,
     bmc: BmcStore,
     processors: ProcessorStore,
+    postCodeLogs: PostCodeLogsStore,
     virtualMedia: VirtualMediaStore,
     securitySettings: SecuritySettingsStore,
     factoryReset: FactoryResetStore,
diff --git a/src/store/modules/Health/PostCodeLogsStore.js b/src/store/modules/Health/PostCodeLogsStore.js
new file mode 100644
index 0000000..ac470ec
--- /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;