summaryrefslogtreecommitdiff
path: root/src/store/modules/HardwareStatus/SensorsStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/HardwareStatus/SensorsStore.js')
-rw-r--r--src/store/modules/HardwareStatus/SensorsStore.js45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/store/modules/HardwareStatus/SensorsStore.js b/src/store/modules/HardwareStatus/SensorsStore.js
index 1e57158b..585be484 100644
--- a/src/store/modules/HardwareStatus/SensorsStore.js
+++ b/src/store/modules/HardwareStatus/SensorsStore.js
@@ -7,11 +7,13 @@ const SensorsStore = {
sensors: [],
fanSensors: [],
tempSensors: [],
+ memorySensors: [],
},
getters: {
sensors: (state) => state.sensors,
fanSensors: (state) => state.fanSensors,
tempSensors: (state) => state.tempSensors,
+ memorySensors: (state) => state.memorySensors,
},
mutations: {
setSensors: (state, sensors) => {
@@ -26,6 +28,12 @@ const SensorsStore = {
'name'
);
},
+ setMemorySensors: (state, memorySensors) => {
+ state.memorySensors = uniqBy(
+ [...state.memorySensors, ...memorySensors],
+ 'name'
+ );
+ },
},
actions: {
async getAllSensors({ dispatch }) {
@@ -39,6 +47,15 @@ const SensorsStore = {
}, []);
return await api.all(promises);
},
+ async getMemorySensors({ dispatch }) {
+ const collection = await dispatch('getChassisCollection');
+ if (!collection) return;
+ const promises = collection.reduce((acc, id) => {
+ acc.push(dispatch('getOnlyMemorySensors', id));
+ return acc;
+ }, []);
+ return await api.all(promises);
+ },
async getTempSensors({ dispatch }) {
const collection = await dispatch('getChassisCollection');
if (!collection) return;
@@ -95,6 +112,30 @@ const SensorsStore = {
})
);
},
+ async getOnlyMemorySensors({ commit }, id) {
+ return await api
+ .get(`${id}/Thermal`)
+ .then(({ data: { Temperatures = [] } }) => {
+ const sensorData = [];
+ Temperatures.forEach((sensor) => {
+ sensorData.push({
+ name: sensor.Name,
+ status: sensor.Status.Health,
+ currentValue: sensor.ReadingCelsius,
+ lowerCaution: sensor.LowerThresholdNonCritical,
+ upperCaution: sensor.UpperThresholdNonCritical,
+ lowerCritical: sensor.LowerThresholdCritical,
+ upperCritical: sensor.UpperThresholdCritical,
+ units: '℃',
+ });
+ });
+ const memorySensors = sensorData.filter((sensor) => {
+ return sensor.name.toLowerCase().includes('dimm');
+ });
+ commit('setMemorySensors', memorySensors);
+ })
+ .catch((error) => console.log(error));
+ },
async getOnlyFanSensors({ commit }, id) {
return await api
.get(`${id}/Thermal`)
@@ -105,8 +146,8 @@ const SensorsStore = {
name: sensor.Name,
status: sensor.Status.Health,
currentValue: sensor.Reading,
- lowerCaution: sensor.LowerThresholdNonCritical,
- upperCaution: sensor.UpperThresholdNonCritical,
+ lowerCaution: sensor.MinReadingRange,
+ upperCaution: sensor.MaxReadingRange,
lowerCritical: sensor.LowerThresholdCritical,
upperCritical: sensor.UpperThresholdCritical,
units: sensor.ReadingUnits,