From 7affc529b7fba41193c4d48764707e9961cdd22d Mon Sep 17 00:00:00 2001 From: Sandeepa Singh Date: Tue, 6 Jul 2021 16:29:10 +0530 Subject: IA update: Update health section This is the second update to information architecture changes and has the following changes: - Health section is updated to hardware status section - Hardware status page is updated to inventory and LEDs page - Route for sensors page has been updated Signed-off-by: Sandeepa Singh Change-Id: Ia1ba3a15a243a00f59a2ec646132436eb355a999 --- src/store/modules/HardwareStatus/BmcStore.js | 79 ++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/store/modules/HardwareStatus/BmcStore.js (limited to 'src/store/modules/HardwareStatus/BmcStore.js') diff --git a/src/store/modules/HardwareStatus/BmcStore.js b/src/store/modules/HardwareStatus/BmcStore.js new file mode 100644 index 00000000..f58dc635 --- /dev/null +++ b/src/store/modules/HardwareStatus/BmcStore.js @@ -0,0 +1,79 @@ +import api from '@/store/api'; +import i18n from '@/i18n'; + +const BmcStore = { + namespaced: true, + state: { + bmc: null, + }, + getters: { + bmc: (state) => state.bmc, + }, + mutations: { + setBmcInfo: (state, data) => { + const bmc = {}; + bmc.dateTime = new Date(data.DateTime); + bmc.description = data.Description; + bmc.firmwareVersion = data.FirmwareVersion; + bmc.graphicalConsoleConnectTypes = + data.GraphicalConsole.ConnectTypesSupported; + bmc.graphicalConsoleEnabled = data.GraphicalConsole.ServiceEnabled; + bmc.graphicalConsoleMaxSessions = + data.GraphicalConsole.MaxConcurrentSessions; + bmc.health = data.Status.Health; + bmc.healthRollup = data.Status.HealthRollup; + bmc.id = data.Id; + bmc.lastResetTime = new Date(data.LastResetTime); + bmc.identifyLed = data.LocationIndicatorActive; + bmc.locationNumber = data.LocationNumber; + bmc.manufacturer = data.manufacturer; + bmc.managerType = data.ManagerType; + bmc.model = data.Model; + bmc.name = data.Name; + bmc.partNumber = data.PartNumber; + bmc.powerState = data.PowerState; + bmc.serialConsoleConnectTypes = data.SerialConsole.ConnectTypesSupported; + bmc.serialConsoleEnabled = data.SerialConsole.ServiceEnabled; + bmc.serialConsoleMaxSessions = data.SerialConsole.MaxConcurrentSessions; + bmc.serialNumber = data.SerialNumber; + bmc.serviceEntryPointUuid = data.ServiceEntryPointUUID; + bmc.sparePartNumber = data.SparePartNumber; + bmc.statusState = data.Status.State; + bmc.uuid = data.UUID; + bmc.uri = data['@odata.id']; + 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)); + }, + async updateIdentifyLedValue({ dispatch }, led) { + const uri = led.uri; + const updatedIdentifyLedValue = { + LocationIndicatorActive: led.identifyLed, + }; + return await api + .patch(uri, updatedIdentifyLedValue) + .then(() => dispatch('getBmcInfo')) + .catch((error) => { + dispatch('getBmcInfo'); + console.log('error', error); + if (led.identifyLed) { + throw new Error( + i18n.t('pageInventory.toast.errorEnableIdentifyLed') + ); + } else { + throw new Error( + i18n.t('pageInventory.toast.errorDisableIdentifyLed') + ); + } + }); + }, + }, +}; + +export default BmcStore; -- cgit v1.2.3