diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-07-19 20:58:19 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-07-19 20:58:19 +0300 |
commit | 5ff6d2f4a485f3ac09f41127a4f12b07e0eb936a (patch) | |
tree | dbf655ac2e7d2d958511ee5d6d085bc5b829aec2 /src/store/modules/_sila | |
parent | d9da196da5a44ced13d48c9f702fae6c8d6b6e5b (diff) | |
parent | 61657800f556ebbb1e6041d5d85a99368b73ff3b (diff) | |
download | webui-vue-5ff6d2f4a485f3ac09f41127a4f12b07e0eb936a.tar.xz |
Merge branch 'sila-ui' into dynamic-info-ui
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; |