diff options
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/index.js | 4 | ||||
-rw-r--r-- | src/store/modules/Health/BmcStore.js | 47 |
2 files changed, 50 insertions, 1 deletions
diff --git a/src/store/index.js b/src/store/index.js index 0f921759..6ad05390 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -19,6 +19,7 @@ import PowerSupplyStore from './modules/Health/PowerSupplyStore'; import MemoryStore from './modules/Health/MemoryStore'; import FanStore from './modules/Health/FanStore'; import ChassisStore from './modules/Health/ChassisStore'; +import BmcStore from './modules/Health/BmcStore'; import WebSocketPlugin from './plugins/WebSocketPlugin'; @@ -46,7 +47,8 @@ export default new Vuex.Store({ system: SystemStore, memory: MemoryStore, fan: FanStore, - chassis: ChassisStore + chassis: ChassisStore, + bmc: BmcStore }, plugins: [WebSocketPlugin] }); diff --git a/src/store/modules/Health/BmcStore.js b/src/store/modules/Health/BmcStore.js new file mode 100644 index 00000000..784bd449 --- /dev/null +++ b/src/store/modules/Health/BmcStore.js @@ -0,0 +1,47 @@ +import api from '@/store/api'; + +const ChassisStore = { + namespaced: true, + state: { + bmc: null + }, + getters: { + bmc: state => state.bmc + }, + mutations: { + setBmcInfo: (state, data) => { + const bmc = {}; + 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.model = data.Model; + 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.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)); + } + } +}; + +export default ChassisStore; |