| Yoshie Muranaka | 54c6bfc | 2020-06-12 08:29:42 -0700 | [diff] [blame] | 1 | import api from '@/store/api'; | 
 | 2 |  | 
 | 3 | const ChassisStore = { | 
 | 4 |   namespaced: true, | 
 | 5 |   state: { | 
 | 6 |     bmc: null | 
 | 7 |   }, | 
 | 8 |   getters: { | 
 | 9 |     bmc: state => state.bmc | 
 | 10 |   }, | 
 | 11 |   mutations: { | 
 | 12 |     setBmcInfo: (state, data) => { | 
 | 13 |       const bmc = {}; | 
 | 14 |       bmc.description = data.Description; | 
 | 15 |       bmc.firmwareVersion = data.FirmwareVersion; | 
 | 16 |       bmc.graphicalConsoleConnectTypes = | 
 | 17 |         data.GraphicalConsole.ConnectTypesSupported; | 
 | 18 |       bmc.graphicalConsoleEnabled = data.GraphicalConsole.ServiceEnabled; | 
 | 19 |       bmc.graphicalConsoleMaxSessions = | 
 | 20 |         data.GraphicalConsole.MaxConcurrentSessions; | 
 | 21 |       bmc.health = data.Status.Health; | 
 | 22 |       bmc.healthRollup = data.Status.HealthRollup; | 
 | 23 |       bmc.id = data.Id; | 
 | 24 |       bmc.model = data.Model; | 
 | 25 |       bmc.partNumber = data.PartNumber; | 
 | 26 |       bmc.powerState = data.PowerState; | 
 | 27 |       bmc.serialConsoleConnectTypes = data.SerialConsole.ConnectTypesSupported; | 
 | 28 |       bmc.serialConsoleEnabled = data.SerialConsole.ServiceEnabled; | 
 | 29 |       bmc.serialConsoleMaxSessions = data.SerialConsole.MaxConcurrentSessions; | 
 | 30 |       bmc.serialNumber = data.SerialNumber; | 
 | 31 |       bmc.serviceEntryPointUuid = data.ServiceEntryPointUUID; | 
 | 32 |       bmc.statusState = data.Status.State; | 
 | 33 |       bmc.uuid = data.UUID; | 
 | 34 |       state.bmc = bmc; | 
 | 35 |     } | 
 | 36 |   }, | 
 | 37 |   actions: { | 
 | 38 |     async getBmcInfo({ commit }) { | 
 | 39 |       return await api | 
 | 40 |         .get('/redfish/v1/Managers/bmc') | 
 | 41 |         .then(({ data }) => commit('setBmcInfo', data)) | 
 | 42 |         .catch(error => console.log(error)); | 
 | 43 |     } | 
 | 44 |   } | 
 | 45 | }; | 
 | 46 |  | 
 | 47 | export default ChassisStore; |