From b89a53c8d4a740c959b12938445917c3df5d3d4b Mon Sep 17 00:00:00 2001 From: Yoshie Muranaka Date: Mon, 15 Jun 2020 13:25:46 -0700 Subject: Add Fans table to hardware status page Add Fan items at /redfish/v1/Chassis/chassis/Thermal endpoint to table with expansion row to view details. Signed-off-by: Yoshie Muranaka Change-Id: I1f69e30748f8dec62647468c4fd2e5b3947716d9 --- src/store/modules/Health/FanStore.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/store/modules/Health/FanStore.js (limited to 'src/store/modules/Health/FanStore.js') diff --git a/src/store/modules/Health/FanStore.js b/src/store/modules/Health/FanStore.js new file mode 100644 index 00000000..2de388bf --- /dev/null +++ b/src/store/modules/Health/FanStore.js @@ -0,0 +1,35 @@ +import api from '@/store/api'; + +const FanStore = { + namespaced: true, + state: { + fans: [] + }, + getters: { + fans: state => state.fans + }, + mutations: { + setFanInfo: (state, data) => { + state.fans = data.map(fan => { + const { MemberId, Status = {}, PartNumber, SerialNumber } = fan; + return { + id: MemberId, + health: Status.Health, + partNumber: PartNumber, + serialNumber: SerialNumber, + statusState: Status.State + }; + }); + } + }, + actions: { + async getFanInfo({ commit }) { + return await api + .get('/redfish/v1/Chassis/chassis/Thermal') + .then(({ data: { Fans = [] } }) => commit('setFanInfo', Fans)) + .catch(error => console.log(error)); + } + } +}; + +export default FanStore; -- cgit v1.2.3