xref: /openbmc/webui-vue/src/store/modules/HardwareStatus/FanStore.js (revision f7000cd6)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import api from '@/store/api';
2
3const FanStore = {
4  namespaced: true,
5  state: {
6    fans: [],
7  },
8  getters: {
9    fans: (state) => state.fans,
10  },
11  mutations: {
12    setFanInfo: (state, data) => {
13      state.fans = data.map((fan) => {
14        const {
15          IndicatorLED,
16          Location,
17          MemberId,
18          Name,
19          Reading,
20          ReadingUnits,
21          Status = {},
22          PartNumber,
23          SerialNumber,
24        } = fan;
25        return {
26          id: MemberId,
27          health: Status.Health,
28          partNumber: PartNumber,
29          serialNumber: SerialNumber,
30          healthRollup: Status.HealthRollup,
31          identifyLed: IndicatorLED,
32          locationNumber: Location,
33          name: Name,
34          speed: Reading + ' ' + ReadingUnits,
35          statusState: Status.State,
36        };
37      });
38    },
39  },
40  actions: {
41    async getFanInfo({ commit }) {
42      return await api
43        .get('/redfish/v1/Chassis/chassis/Thermal')
44        .then(({ data: { Fans = [] } }) => commit('setFanInfo', Fans))
45        .catch((error) => console.log(error));
46    },
47  },
48};
49
50export default FanStore;
51

served by {OpenGrok

Last Index Update: Sat May 10 03:01:07 CDT 2025