From 09e8b5d478f212c094b7bea66c570fe0e673756e Mon Sep 17 00:00:00 2001 From: Yoshie Muranaka Date: Mon, 8 Jun 2020 07:36:59 -0700 Subject: Add Chassis table to hardware status page Add each chassis at /redfish/v1/Chassis endpoint to a table with an expansion row to view property details. Signed-off-by: Yoshie Muranaka Change-Id: I8d4c64fecac3857e0d4ece9fad81d9035e236c92 --- src/store/index.js | 4 ++- src/store/modules/Health/ChassisStore.js | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/store/modules/Health/ChassisStore.js (limited to 'src/store') diff --git a/src/store/index.js b/src/store/index.js index c4c0948f..0f921759 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -18,6 +18,7 @@ import SystemStore from './modules/Health/SystemStore'; import PowerSupplyStore from './modules/Health/PowerSupplyStore'; import MemoryStore from './modules/Health/MemoryStore'; import FanStore from './modules/Health/FanStore'; +import ChassisStore from './modules/Health/ChassisStore'; import WebSocketPlugin from './plugins/WebSocketPlugin'; @@ -44,7 +45,8 @@ export default new Vuex.Store({ serverLed: ServerLedStore, system: SystemStore, memory: MemoryStore, - fan: FanStore + fan: FanStore, + chassis: ChassisStore }, plugins: [WebSocketPlugin] }); diff --git a/src/store/modules/Health/ChassisStore.js b/src/store/modules/Health/ChassisStore.js new file mode 100644 index 00000000..e9e58e72 --- /dev/null +++ b/src/store/modules/Health/ChassisStore.js @@ -0,0 +1,55 @@ +import api from '@/store/api'; + +const ChassisStore = { + namespaced: true, + state: { + chassis: [] + }, + getters: { + chassis: state => state.chassis + }, + mutations: { + setChassisInfo: (state, data) => { + state.chassis = data.map(chassis => { + const { + Id, + Status = {}, + PartNumber, + SerialNumber, + ChassisType, + Manufacturer, + PowerState + } = chassis; + + return { + id: Id, + health: Status.Health, + partNumber: PartNumber, + serialNumber: SerialNumber, + chassisType: ChassisType, + manufacturer: Manufacturer, + powerState: PowerState, + statusState: Status.State, + healthRollup: Status.HealthRollup + }; + }); + } + }, + actions: { + async getChassisInfo({ commit }) { + return await api + .get('/redfish/v1/Chassis') + .then(({ data: { Members = [] } }) => + Members.map(member => api.get(member['@odata.id'])) + ) + .then(promises => api.all(promises)) + .then(response => { + const data = response.map(({ data }) => data); + commit('setChassisInfo', data); + }) + .catch(error => console.log(error)); + } + } +}; + +export default ChassisStore; -- cgit v1.2.3