summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.env.intel1
-rw-r--r--src/store/modules/HardwareStatus/FanStore.js99
2 files changed, 73 insertions, 27 deletions
diff --git a/.env.intel b/.env.intel
index 6a8c1811..c7dea364 100644
--- a/.env.intel
+++ b/.env.intel
@@ -8,6 +8,7 @@ VUE_APP_MODIFY_SSH_POLICY_DISABLED="true"
VUE_APP_VIRTUAL_MEDIA_LIST_ENABLED="true"
VUE_APP_EVENT_LOGS_DELETE_BUTTON_DISABLED="true"
VUE_APP_EVENT_LOGS_TOGGLE_BUTTON_DISABLED="true"
+VUE_APP_FAN_DATA_FROM_THERMAL_SUBSYSTEM="true"
CUSTOM_STYLES="true"
CUSTOM_APP_NAV="true"
CUSTOM_STORE="true"
diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js
index 3f172d2d..832ef634 100644
--- a/src/store/modules/HardwareStatus/FanStore.js
+++ b/src/store/modules/HardwareStatus/FanStore.js
@@ -11,29 +11,49 @@ const FanStore = {
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,
- };
+ const ThermalSubsystem =
+ process.env.VUE_APP_FAN_DATA_FROM_THERMAL_SUBSYSTEM === 'true'
+ ? true
+ : false;
+ if (ThermalSubsystem) {
+ const {
+ Id,
+ Name,
+ PartNumber,
+ SerialNumber,
+ SpeedPercent = {},
+ Status = {},
+ } = fan;
+ return {
+ id: Id,
+ health: Status.Health,
+ name: Name,
+ speed: SpeedPercent.Reading,
+ statusState: Status.State,
+ healthRollup: Status.HealthRollup,
+ partNumber: PartNumber,
+ serialNumber: SerialNumber,
+ };
+ } else {
+ const {
+ MemberId,
+ Name,
+ Reading,
+ Status = {},
+ PartNumber,
+ SerialNumber,
+ } = fan;
+ return {
+ id: MemberId,
+ health: Status.Health,
+ partNumber: PartNumber,
+ serialNumber: SerialNumber,
+ healthRollup: Status.HealthRollup,
+ name: Name,
+ speed: Reading,
+ statusState: Status.State,
+ };
+ }
});
},
},
@@ -59,10 +79,35 @@ const FanStore = {
.catch((error) => console.log(error));
},
async getChassisFans(_, chassis) {
- return await api
- .get(chassis.Thermal['@odata.id'])
- .then(({ data: { Fans } }) => Fans || [])
- .catch((error) => console.log(error));
+ const ThermalSubsystem =
+ process.env.VUE_APP_FAN_DATA_FROM_THERMAL_SUBSYSTEM === 'true'
+ ? true
+ : false;
+ if (ThermalSubsystem) {
+ return await api
+ .get(chassis.ThermalSubsystem['@odata.id'])
+ .then((response) => {
+ return api.get(`${response.data.Fans['@odata.id']}`);
+ })
+ .then(({ data: { Members } }) => {
+ const promises = Members.map((member) =>
+ api.get(member['@odata.id'])
+ );
+ return api.all(promises);
+ })
+ .then((response) => {
+ const data = response.map(({ data }) => data);
+ return data;
+ })
+ .catch((error) => console.log(error));
+ } else {
+ return await api
+ .get(chassis.Thermal['@odata.id'])
+ .then(({ data: { Fans } }) => {
+ return Fans || [];
+ })
+ .catch((error) => console.log(error));
+ }
},
},
};