summaryrefslogtreecommitdiff
path: root/src/store/modules/Health/PostCodeLogsStore.js
diff options
context:
space:
mode:
authorSandeepa Singh <sandeepa.singh@ibm.com>2021-05-24 11:21:09 +0300
committerDerick Montague <derick.montague@ibm.com>2021-07-21 15:56:02 +0300
commit06d53863a83c003e7248f5cfc8362765882d19bb (patch)
tree2603dc1b60ac4b59c7ec6a16e43c5ec3b50e2a38 /src/store/modules/Health/PostCodeLogsStore.js
parentf65cc7b29a90b71a5e6c888ea180150e232be79e (diff)
downloadwebui-vue-06d53863a83c003e7248f5cfc8362765882d19bb.tar.xz
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
Diffstat (limited to 'src/store/modules/Health/PostCodeLogsStore.js')
-rw-r--r--src/store/modules/Health/PostCodeLogsStore.js39
1 files changed, 39 insertions, 0 deletions
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;