summaryrefslogtreecommitdiff
path: root/src/store/modules/HardwareStatus/FanStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/HardwareStatus/FanStore.js')
-rw-r--r--src/store/modules/HardwareStatus/FanStore.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js
new file mode 100644
index 00000000..fca1f326
--- /dev/null
+++ b/src/store/modules/HardwareStatus/FanStore.js
@@ -0,0 +1,50 @@
+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 {
+ 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,
+ 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;