summaryrefslogtreecommitdiff
path: root/src/store/modules/Health
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/Health')
-rw-r--r--src/store/modules/Health/BmcStore.js12
-rw-r--r--src/store/modules/Health/ChassisStore.js24
-rw-r--r--src/store/modules/Health/EventLogStore.js29
-rw-r--r--src/store/modules/Health/FanStore.js16
-rw-r--r--src/store/modules/Health/MemoryStore.js18
-rw-r--r--src/store/modules/Health/PowerSupplyStore.js18
-rw-r--r--src/store/modules/Health/ProcessorStore.js24
-rw-r--r--src/store/modules/Health/SensorsStore.js40
-rw-r--r--src/store/modules/Health/SystemStore.js12
9 files changed, 97 insertions, 96 deletions
diff --git a/src/store/modules/Health/BmcStore.js b/src/store/modules/Health/BmcStore.js
index 784bd449..73df10b8 100644
--- a/src/store/modules/Health/BmcStore.js
+++ b/src/store/modules/Health/BmcStore.js
@@ -3,10 +3,10 @@ import api from '@/store/api';
const ChassisStore = {
namespaced: true,
state: {
- bmc: null
+ bmc: null,
},
getters: {
- bmc: state => state.bmc
+ bmc: (state) => state.bmc,
},
mutations: {
setBmcInfo: (state, data) => {
@@ -32,16 +32,16 @@ const ChassisStore = {
bmc.statusState = data.Status.State;
bmc.uuid = data.UUID;
state.bmc = bmc;
- }
+ },
},
actions: {
async getBmcInfo({ commit }) {
return await api
.get('/redfish/v1/Managers/bmc')
.then(({ data }) => commit('setBmcInfo', data))
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default ChassisStore;
diff --git a/src/store/modules/Health/ChassisStore.js b/src/store/modules/Health/ChassisStore.js
index e9e58e72..251279e6 100644
--- a/src/store/modules/Health/ChassisStore.js
+++ b/src/store/modules/Health/ChassisStore.js
@@ -3,14 +3,14 @@ import api from '@/store/api';
const ChassisStore = {
namespaced: true,
state: {
- chassis: []
+ chassis: [],
},
getters: {
- chassis: state => state.chassis
+ chassis: (state) => state.chassis,
},
mutations: {
setChassisInfo: (state, data) => {
- state.chassis = data.map(chassis => {
+ state.chassis = data.map((chassis) => {
const {
Id,
Status = {},
@@ -18,7 +18,7 @@ const ChassisStore = {
SerialNumber,
ChassisType,
Manufacturer,
- PowerState
+ PowerState,
} = chassis;
return {
@@ -30,26 +30,26 @@ const ChassisStore = {
manufacturer: Manufacturer,
powerState: PowerState,
statusState: Status.State,
- healthRollup: Status.HealthRollup
+ healthRollup: Status.HealthRollup,
};
});
- }
+ },
},
actions: {
async getChassisInfo({ commit }) {
return await api
.get('/redfish/v1/Chassis')
.then(({ data: { Members = [] } }) =>
- Members.map(member => api.get(member['@odata.id']))
+ Members.map((member) => api.get(member['@odata.id']))
)
- .then(promises => api.all(promises))
- .then(response => {
+ .then((promises) => api.all(promises))
+ .then((response) => {
const data = response.map(({ data }) => data);
commit('setChassisInfo', data);
})
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default ChassisStore;
diff --git a/src/store/modules/Health/EventLogStore.js b/src/store/modules/Health/EventLogStore.js
index 79bee02a..bf1de2f4 100644
--- a/src/store/modules/Health/EventLogStore.js
+++ b/src/store/modules/Health/EventLogStore.js
@@ -17,31 +17,32 @@ const getHealthStatus = (events, loadedEvents) => {
// TODO: High priority events should also check if Log
// is resolved when the property is available in Redfish
-const getHighPriorityEvents = events =>
+const getHighPriorityEvents = (events) =>
events.filter(({ severity }) => severity === 'Critical');
const EventLogStore = {
namespaced: true,
state: {
allEvents: [],
- loadedEvents: false
+ loadedEvents: false,
},
getters: {
- allEvents: state => state.allEvents,
- highPriorityEvents: state => getHighPriorityEvents(state.allEvents),
- healthStatus: state => getHealthStatus(state.allEvents, state.loadedEvents)
+ allEvents: (state) => state.allEvents,
+ highPriorityEvents: (state) => getHighPriorityEvents(state.allEvents),
+ healthStatus: (state) =>
+ getHealthStatus(state.allEvents, state.loadedEvents),
},
mutations: {
setAllEvents: (state, allEvents) => (
(state.allEvents = allEvents), (state.loadedEvents = true)
- )
+ ),
},
actions: {
async getEventLogData({ commit }) {
return await api
.get('/redfish/v1/Systems/system/LogServices/EventLog/Entries')
.then(({ data: { Members = [] } = {} }) => {
- const eventLogs = Members.map(log => {
+ const eventLogs = Members.map((log) => {
const { Id, Severity, Created, EntryType, Message } = log;
return {
id: Id,
@@ -49,25 +50,25 @@ const EventLogStore = {
date: new Date(Created),
type: EntryType,
description: Message,
- uri: log['@odata.id']
+ uri: log['@odata.id'],
};
});
commit('setAllEvents', eventLogs);
})
- .catch(error => {
+ .catch((error) => {
console.log('Event Log Data:', error);
});
},
async deleteEventLogs({ dispatch }, uris = []) {
- const promises = uris.map(uri =>
- api.delete(uri).catch(error => {
+ const promises = uris.map((uri) =>
+ api.delete(uri).catch((error) => {
console.log(error);
return error;
})
);
return await api
.all(promises)
- .then(response => {
+ .then((response) => {
dispatch('getEventLogData');
return response;
})
@@ -95,8 +96,8 @@ const EventLogStore = {
return toastMessages;
})
);
- }
- }
+ },
+ },
};
export default EventLogStore;
diff --git a/src/store/modules/Health/FanStore.js b/src/store/modules/Health/FanStore.js
index 2de388bf..b4a4189a 100644
--- a/src/store/modules/Health/FanStore.js
+++ b/src/store/modules/Health/FanStore.js
@@ -3,33 +3,33 @@ import api from '@/store/api';
const FanStore = {
namespaced: true,
state: {
- fans: []
+ fans: [],
},
getters: {
- fans: state => state.fans
+ fans: (state) => state.fans,
},
mutations: {
setFanInfo: (state, data) => {
- state.fans = data.map(fan => {
+ state.fans = data.map((fan) => {
const { MemberId, Status = {}, PartNumber, SerialNumber } = fan;
return {
id: MemberId,
health: Status.Health,
partNumber: PartNumber,
serialNumber: SerialNumber,
- statusState: Status.State
+ 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));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default FanStore;
diff --git a/src/store/modules/Health/MemoryStore.js b/src/store/modules/Health/MemoryStore.js
index 63e08e6a..cd2478de 100644
--- a/src/store/modules/Health/MemoryStore.js
+++ b/src/store/modules/Health/MemoryStore.js
@@ -3,10 +3,10 @@ import api from '@/store/api';
const MemoryStore = {
namespaced: true,
state: {
- dimms: []
+ dimms: [],
},
getters: {
- dimms: state => state.dimms
+ dimms: (state) => state.dimms,
},
mutations: {
setMemoryInfo: (state, data) => {
@@ -17,23 +17,23 @@ const MemoryStore = {
health: Status.Health,
partNumber: PartNumber,
serialNumber: SerialNumber,
- statusState: Status.State
+ statusState: Status.State,
};
});
- }
+ },
},
actions: {
async getDimms({ commit }) {
return await api
.get('/redfish/v1/Systems/system/Memory')
.then(({ data: { Members } }) => {
- const promises = Members.map(item => api.get(item['@odata.id']));
+ const promises = Members.map((item) => api.get(item['@odata.id']));
return api.all(promises);
})
- .then(response => commit('setMemoryInfo', response))
- .catch(error => console.log(error));
- }
- }
+ .then((response) => commit('setMemoryInfo', response))
+ .catch((error) => console.log(error));
+ },
+ },
};
export default MemoryStore;
diff --git a/src/store/modules/Health/PowerSupplyStore.js b/src/store/modules/Health/PowerSupplyStore.js
index 4e3d5fef..565715fa 100644
--- a/src/store/modules/Health/PowerSupplyStore.js
+++ b/src/store/modules/Health/PowerSupplyStore.js
@@ -3,14 +3,14 @@ import api from '@/store/api';
const PowerSupplyStore = {
namespaced: true,
state: {
- powerSupplies: []
+ powerSupplies: [],
},
getters: {
- powerSupplies: state => state.powerSupplies
+ powerSupplies: (state) => state.powerSupplies,
},
mutations: {
setPowerSupply: (state, data) => {
- state.powerSupplies = data.map(powerSupply => {
+ state.powerSupplies = data.map((powerSupply) => {
const {
EfficiencyPercent,
FirmwareVersion,
@@ -20,7 +20,7 @@ const PowerSupplyStore = {
PartNumber,
PowerInputWatts,
SerialNumber,
- Status
+ Status,
} = powerSupply;
return {
id: MemberId,
@@ -32,10 +32,10 @@ const PowerSupplyStore = {
indicatorLed: IndicatorLED,
model: Model,
powerInputWatts: PowerInputWatts,
- statusState: Status.State
+ statusState: Status.State,
};
});
- }
+ },
},
actions: {
async getPowerSupply({ commit }) {
@@ -44,9 +44,9 @@ const PowerSupplyStore = {
.then(({ data: { PowerSupplies } }) =>
commit('setPowerSupply', PowerSupplies)
)
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default PowerSupplyStore;
diff --git a/src/store/modules/Health/ProcessorStore.js b/src/store/modules/Health/ProcessorStore.js
index a1411eb2..4a67c6b0 100644
--- a/src/store/modules/Health/ProcessorStore.js
+++ b/src/store/modules/Health/ProcessorStore.js
@@ -3,14 +3,14 @@ import api from '@/store/api';
const ProcessorStore = {
namespaced: true,
state: {
- processors: []
+ processors: [],
},
getters: {
- processors: state => state.processors
+ processors: (state) => state.processors,
},
mutations: {
setProcessorsInfo: (state, data) => {
- state.processors = data.map(processor => {
+ state.processors = data.map((processor) => {
const {
Id,
Status = {},
@@ -22,7 +22,7 @@ const ProcessorStore = {
Name,
ProcessorArchitecture,
ProcessorType,
- TotalCores
+ TotalCores,
} = processor;
return {
id: Id,
@@ -36,26 +36,26 @@ const ProcessorStore = {
name: Name,
processorArchitecture: ProcessorArchitecture,
processorType: ProcessorType,
- totalCores: TotalCores
+ totalCores: TotalCores,
};
});
- }
+ },
},
actions: {
async getProcessorsInfo({ commit }) {
return await api
.get('/redfish/v1/Systems/system/Processors')
.then(({ data: { Members = [] } }) =>
- Members.map(member => api.get(member['@odata.id']))
+ Members.map((member) => api.get(member['@odata.id']))
)
- .then(promises => api.all(promises))
- .then(response => {
+ .then((promises) => api.all(promises))
+ .then((response) => {
const data = response.map(({ data }) => data);
commit('setProcessorsInfo', data);
})
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default ProcessorStore;
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;
diff --git a/src/store/modules/Health/SystemStore.js b/src/store/modules/Health/SystemStore.js
index 828b78bd..30ae66be 100644
--- a/src/store/modules/Health/SystemStore.js
+++ b/src/store/modules/Health/SystemStore.js
@@ -3,10 +3,10 @@ import api from '@/store/api';
const SystemStore = {
namespaced: true,
state: {
- systems: []
+ systems: [],
},
getters: {
- systems: state => state.systems
+ systems: (state) => state.systems,
},
mutations: {
setSystemInfo: (state, data) => {
@@ -26,16 +26,16 @@ const SystemStore = {
system.statusState = data.Status.State;
system.systemType = data.SystemType;
state.systems = [system];
- }
+ },
},
actions: {
async getSystem({ commit }) {
return await api
.get('/redfish/v1/Systems/system')
.then(({ data }) => commit('setSystemInfo', data))
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default SystemStore;