From 61657800f556ebbb1e6041d5d85a99368b73ff3b Mon Sep 17 00:00:00 2001 From: Maksim Zakharov Date: Tue, 19 Jul 2022 18:39:57 +0300 Subject: SILABMC-52 Add page Fans Static, Fans Store, tab Fans --- src/store/modules/_sila/HardwareStatus/FanStore.js | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/store/modules/_sila/HardwareStatus/FanStore.js (limited to 'src/store/modules/_sila') diff --git a/src/store/modules/_sila/HardwareStatus/FanStore.js b/src/store/modules/_sila/HardwareStatus/FanStore.js new file mode 100644 index 00000000..1399710b --- /dev/null +++ b/src/store/modules/_sila/HardwareStatus/FanStore.js @@ -0,0 +1,53 @@ +import api from '@/store/api'; +import { fanType } from '@/utilities/_sila/tableParser'; + +const FanStore = { + namespaced: true, + state: { + fans: [], + }, + getters: { + fans: (state) => state.fans, + }, + mutations: { + setFanInfo: (state, data) => { + state.fans = data.map((fan) => { + const { + IndicatorLED, + Location, + MemberId, + Name, + Reading, + ReadingUnits, + Status = {}, + PartNumber, + SerialNumber, + } = fan; + return { + id: MemberId, + health: Status.Health, + partNumber: PartNumber, + serialNumber: SerialNumber, + healthRollup: Status.HealthRollup, + identifyLed: IndicatorLED, + locationNumber: Location, + name: Name, + speed: Reading + ' ' + ReadingUnits, + speedRPM: Reading, + type: fanType(Name), + 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