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
diff --git a/src/store/index.js b/src/store/index.js
index 8479a27..b4e030b 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -16,6 +16,7 @@
import ServerLedStore from './modules/Control/ServerLedStore';
import SystemStore from './modules/Health/SystemStore';
import PowerSupplyStore from './modules/Health/PowerSupplyStore';
+import MemoryStore from './modules/Health/MemoryStore';
import WebSocketPlugin from './plugins/WebSocketPlugin';
@@ -40,7 +41,8 @@
sensors: SensorsStore,
sslCertificates: SslCertificatesStore,
serverLed: ServerLedStore,
- system: SystemStore
+ system: SystemStore,
+ memory: MemoryStore
},
plugins: [WebSocketPlugin]
});
diff --git a/src/store/modules/Health/MemoryStore.js b/src/store/modules/Health/MemoryStore.js
new file mode 100644
index 0000000..63e08e6
--- /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;