summaryrefslogtreecommitdiff
path: root/src/store/modules/Health/SensorsStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/Health/SensorsStore.js')
-rw-r--r--src/store/modules/Health/SensorsStore.js40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/store/modules/Health/SensorsStore.js b/src/store/modules/Health/SensorsStore.js
index 5f2bf52e..1c0de0db 100644
--- a/src/store/modules/Health/SensorsStore.js
+++ b/src/store/modules/Health/SensorsStore.js
@@ -4,15 +4,15 @@ import { uniqBy } from 'lodash';
const SensorsStore = {
namespaced: true,
state: {
- sensors: []
+ sensors: [],
},
getters: {
- sensors: state => state.sensors
+ sensors: (state) => state.sensors,
},
mutations: {
setSensors: (state, sensors) => {
state.sensors = uniqBy([...state.sensors, ...sensors], 'name');
- }
+ },
},
actions: {
async getAllSensors({ dispatch }) {
@@ -30,18 +30,18 @@ const SensorsStore = {
return await api
.get('/redfish/v1/Chassis')
.then(({ data: { Members } }) =>
- Members.map(member => member['@odata.id'])
+ Members.map((member) => member['@odata.id'])
)
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async getSensors({ commit }, id) {
const sensors = await api
.get(`${id}/Sensors`)
- .then(response => response.data.Members)
- .catch(error => console.log(error));
+ .then((response) => response.data.Members)
+ .catch((error) => console.log(error));
if (!sensors) return;
- const promises = sensors.map(sensor => {
- return api.get(sensor['@odata.id']).catch(error => {
+ const promises = sensors.map((sensor) => {
+ return api.get(sensor['@odata.id']).catch((error) => {
console.log(error);
return error;
});
@@ -57,7 +57,7 @@ const SensorsStore = {
upperCaution: data.Thresholds?.UpperCaution?.Reading,
lowerCritical: data.Thresholds?.LowerCritical?.Reading,
upperCritical: data.Thresholds?.UpperCritical?.Reading,
- units: data.ReadingUnits
+ units: data.ReadingUnits,
};
});
commit('setSensors', sensorData);
@@ -69,16 +69,16 @@ const SensorsStore = {
.get(`${id}/Thermal`)
.then(({ data: { Fans = [], Temperatures = [] } }) => {
const sensorData = [];
- Fans.forEach(sensor => {
+ Fans.forEach((sensor) => {
sensorData.push({
// TODO: add upper/lower threshold
name: sensor.Name,
status: sensor.Status.Health,
currentValue: sensor.Reading,
- units: sensor.ReadingUnits
+ units: sensor.ReadingUnits,
});
});
- Temperatures.forEach(sensor => {
+ Temperatures.forEach((sensor) => {
sensorData.push({
name: sensor.Name,
status: sensor.Status.Health,
@@ -87,18 +87,18 @@ const SensorsStore = {
upperCaution: sensor.UpperThresholdNonCritical,
lowerCritical: sensor.LowerThresholdCritical,
upperCritical: sensor.UpperThresholdCritical,
- units: '℃'
+ units: '℃',
});
});
commit('setSensors', sensorData);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async getPowerSensors({ commit }, id) {
return await api
.get(`${id}/Power`)
.then(({ data: { Voltages = [] } }) => {
- const sensorData = Voltages.map(sensor => {
+ const sensorData = Voltages.map((sensor) => {
return {
name: sensor.Name,
status: sensor.Status.Health,
@@ -107,14 +107,14 @@ const SensorsStore = {
upperCaution: sensor.UpperThresholdNonCritical,
lowerCritical: sensor.LowerThresholdCritical,
upperCritical: sensor.UpperThresholdCritical,
- units: 'Volts'
+ units: 'Volts',
};
});
commit('setSensors', sensorData);
})
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default SensorsStore;