summaryrefslogtreecommitdiff
path: root/src/store/modules/Health/MemoryStore.js
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2020-06-08 21:03:11 +0300
committerDerick Montague <derick.montague@ibm.com>2020-06-18 00:04:55 +0300
commite24b17d2f599a34895acb9eccff3144af55484c5 (patch)
tree5576908d3fdd2966872f4dd763237e85a682e81a /src/store/modules/Health/MemoryStore.js
parentb1f559f03e3f464c1b8b19a9327158be0ecafe62 (diff)
downloadwebui-vue-e24b17d2f599a34895acb9eccff3144af55484c5.tar.xz
Add DIMM slot table to hardware status page
Add items at /redfish/v1/Systems/system/Memory endpoint to DIMM slot table. The table is sortable and has a row expansion to view details. The code is currently missing most properties needed to match the design. This table will need to be revisited when all properties are available. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I07cacf3403fe84431cb9fe0e4315069fc7baf27d
Diffstat (limited to 'src/store/modules/Health/MemoryStore.js')
-rw-r--r--src/store/modules/Health/MemoryStore.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/store/modules/Health/MemoryStore.js b/src/store/modules/Health/MemoryStore.js
new file mode 100644
index 00000000..63e08e6a
--- /dev/null
+++ b/src/store/modules/Health/MemoryStore.js
@@ -0,0 +1,39 @@
+import api from '@/store/api';
+
+const MemoryStore = {
+ namespaced: true,
+ state: {
+ dimms: []
+ },
+ getters: {
+ dimms: state => state.dimms
+ },
+ mutations: {
+ setMemoryInfo: (state, data) => {
+ state.dimms = data.map(({ data }) => {
+ const { Id, Status = {}, PartNumber, SerialNumber } = data;
+ return {
+ id: Id,
+ health: Status.Health,
+ partNumber: PartNumber,
+ serialNumber: SerialNumber,
+ statusState: Status.State
+ };
+ });
+ }
+ },
+ actions: {
+ async getDimms({ commit }) {
+ return await api
+ .get('/redfish/v1/Systems/system/Memory')
+ .then(({ data: { Members } }) => {
+ const promises = Members.map(item => api.get(item['@odata.id']));
+ return api.all(promises);
+ })
+ .then(response => commit('setMemoryInfo', response))
+ .catch(error => console.log(error));
+ }
+ }
+};
+
+export default MemoryStore;