Fixed sensor mismatch issue with IPMI and redfish
Description:
The sensor count in WebUI is mismatched when compared to
IPMI and REDFISH responses. When Web UI is iterating the
sensor response property, the iteration is stopped when
the key value is undefined. As a result, the sensor details
in the web UI are incorrect. So added the code changes to
check the property value in every iteration, whether the
value is present or not.
Tested:
Step 1: Login to WEB UI
Step 2: Navigate to Hardware Status and Sensors
Step 3: Check the sensor details with IPMI and redfish response
Step 4: All the sensors and those details in the IPMI and redfish
response are listing in Web UI
Change-Id: Icf5098b3dd2413851e755d9ede17a8501cbb7411
Signed-off-by: Kirankumar Ballapalli <kirankumarb@ami.com>
diff --git a/src/store/modules/HardwareStatus/SensorsStore.js b/src/store/modules/HardwareStatus/SensorsStore.js
index cae7795..5a237bd 100644
--- a/src/store/modules/HardwareStatus/SensorsStore.js
+++ b/src/store/modules/HardwareStatus/SensorsStore.js
@@ -46,23 +46,24 @@
return error;
});
});
- return await api.all(promises).then(
- api.spread((...responses) => {
- const sensorData = responses.map(({ data }) => {
- return {
- name: data.Name,
- status: data.Status.Health,
- currentValue: data.Reading,
- lowerCaution: data.Thresholds?.LowerCaution?.Reading,
- upperCaution: data.Thresholds?.UpperCaution?.Reading,
- lowerCritical: data.Thresholds?.LowerCritical?.Reading,
- upperCritical: data.Thresholds?.UpperCritical?.Reading,
- units: data.ReadingUnits,
- };
- });
- commit('setSensors', sensorData);
- })
- );
+ return await api.all(promises).then((responses) => {
+ const sensorData = [];
+ responses.forEach((response) => {
+ if (response.data) {
+ sensorData.push({
+ name: response.data.Name,
+ status: response.data.Status?.Health,
+ currentValue: response.data.Reading,
+ lowerCaution: response.data.Thresholds?.LowerCaution?.Reading,
+ upperCaution: response.data.Thresholds?.UpperCaution?.Reading,
+ lowerCritical: response.data.Thresholds?.LowerCritical?.Reading,
+ upperCritical: response.data.Thresholds?.UpperCritical?.Reading,
+ units: response.data.ReadingUnits,
+ });
+ }
+ });
+ commit('setSensors', sensorData);
+ });
},
async getThermalSensors({ commit }, id) {
return await api