From 5918b48a0530a43a4dd9ee1a3f134846c948011e Mon Sep 17 00:00:00 2001 From: Yoshie Muranaka Date: Mon, 8 Jun 2020 08:18:23 -0700 Subject: Add power supplies table to hardware status page Adds items at /redfish/v1/Chassis/chassis/Power endpoint in Power supplies table. Table is sortable and has a row expansion to view details. - Table sort mixin to reuse sort method for status values Signed-off-by: Yoshie Muranaka Change-Id: Ib2953ad06be3fa25e9dbbbed34e37d09154431f5 --- src/store/index.js | 2 ++ src/store/modules/Health/PowerSupplyStore.js | 52 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/store/modules/Health/PowerSupplyStore.js (limited to 'src/store') diff --git a/src/store/index.js b/src/store/index.js index 44b8ded6..8479a27b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -15,6 +15,7 @@ import EventLogStore from './modules/Health/EventLogStore'; import SensorsStore from './modules/Health/SensorsStore'; import ServerLedStore from './modules/Control/ServerLedStore'; import SystemStore from './modules/Health/SystemStore'; +import PowerSupplyStore from './modules/Health/PowerSupplyStore'; import WebSocketPlugin from './plugins/WebSocketPlugin'; @@ -33,6 +34,7 @@ export default new Vuex.Store({ hostBootSettings: BootSettingsStore, controls: ControlStore, powerControl: PowerControlStore, + powerSupply: PowerSupplyStore, networkSettings: NetworkSettingStore, eventLog: EventLogStore, sensors: SensorsStore, diff --git a/src/store/modules/Health/PowerSupplyStore.js b/src/store/modules/Health/PowerSupplyStore.js new file mode 100644 index 00000000..4e3d5fef --- /dev/null +++ b/src/store/modules/Health/PowerSupplyStore.js @@ -0,0 +1,52 @@ +import api from '@/store/api'; + +const PowerSupplyStore = { + namespaced: true, + state: { + powerSupplies: [] + }, + getters: { + powerSupplies: state => state.powerSupplies + }, + mutations: { + setPowerSupply: (state, data) => { + state.powerSupplies = data.map(powerSupply => { + const { + EfficiencyPercent, + FirmwareVersion, + IndicatorLED, + MemberId, + Model, + PartNumber, + PowerInputWatts, + SerialNumber, + Status + } = powerSupply; + return { + id: MemberId, + health: Status.Health, + partNumber: PartNumber, + serialNumber: SerialNumber, + efficiencyPercent: EfficiencyPercent, + firmwareVersion: FirmwareVersion, + indicatorLed: IndicatorLED, + model: Model, + powerInputWatts: PowerInputWatts, + statusState: Status.State + }; + }); + } + }, + actions: { + async getPowerSupply({ commit }) { + return await api + .get('/redfish/v1/Chassis/chassis/Power') + .then(({ data: { PowerSupplies } }) => + commit('setPowerSupply', PowerSupplies) + ) + .catch(error => console.log(error)); + } + } +}; + +export default PowerSupplyStore; -- cgit v1.2.3