diff options
author | Maksim Zakharov <m.zakharov@IBS.RU> | 2022-07-19 18:39:57 +0300 |
---|---|---|
committer | Maksim Zakharov <m.zakharov@IBS.RU> | 2022-07-19 18:44:00 +0300 |
commit | 61657800f556ebbb1e6041d5d85a99368b73ff3b (patch) | |
tree | 618aec32ac4c3b3c0485d195bd87c83633047f06 /src/store/modules/_sila | |
parent | f8fcf3957a749b349a33bae2691bca2883a981c3 (diff) | |
download | webui-vue-61657800f556ebbb1e6041d5d85a99368b73ff3b.tar.xz |
SILABMC-52 Add page Fans Static, Fans Store, tab Fans
Diffstat (limited to 'src/store/modules/_sila')
-rw-r--r-- | src/store/modules/_sila/HardwareStatus/FanStore.js | 53 |
1 files changed, 53 insertions, 0 deletions
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; |