diff options
Diffstat (limited to 'src/store/modules/GlobalStore.js')
-rw-r--r-- | src/store/modules/GlobalStore.js | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js index 80d9c1a3..18d5043d 100644 --- a/src/store/modules/GlobalStore.js +++ b/src/store/modules/GlobalStore.js @@ -25,23 +25,19 @@ const GlobalStore = { namespaced: true, state: { hostName: '--', + bmcTime: null, hostStatus: 'unreachable' }, getters: { - hostName(state) { - return state.hostName; - }, - hostStatus(state) { - return state.hostStatus; - } + hostName: state => state.hostName, + hostStatus: state => state.hostStatus, + bmcTime: state => state.bmcTime }, mutations: { - setHostName(state, hostName) { - state.hostName = hostName; - }, - setHostStatus(state, hostState) { - state.hostStatus = hostStateMapper(hostState); - } + setHostName: (state, hostName) => (state.hostName = hostName), + setBmcTime: (state, bmcTime) => (state.bmcTime = bmcTime), + setHostStatus: (state, hostState) => + (state.hostState = hostStateMapper(hostState)) }, actions: { getHostName({ commit }) { @@ -53,6 +49,16 @@ const GlobalStore = { }) .catch(error => console.log(error)); }, + getBmcTime({ commit }) { + api + .get('/xyz/openbmc_project/time/bmc') + .then(response => { + // bmcTime is stored in microseconds, convert to millseconds + const bmcTime = response.data.data.Elapsed / 1000; + commit('setBmcTime', bmcTime); + }) + .catch(error => console.log(error)); + }, getHostStatus({ commit }) { api .get('/xyz/openbmc_project/state/host0/attr/CurrentHostState') |