summaryrefslogtreecommitdiff
path: root/src/store/modules/GlobalStore.js
diff options
context:
space:
mode:
authorDixsie Wolmers <dixsie@ibm.com>2020-01-23 04:47:56 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2020-01-29 01:18:05 +0300
commitf65ee346bedb1811e88b12542abce0d18bb5fc32 (patch)
tree04b0a5cc2096a48b9c2b15dc571a1db680802c89 /src/store/modules/GlobalStore.js
parentdc04feb5596a85619e98d2d594b065e92c8b8fa4 (diff)
downloadwebui-vue-f65ee346bedb1811e88b12542abce0d18bb5fc32.tar.xz
Add store modules needed to support overview view
- Update overview page to get data from store Signed-off-by: Dixsie Wolmers <dixsie@ibm.com> Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: Id2fcad660efc0da5c7b878e872355bf5773c7ed7
Diffstat (limited to 'src/store/modules/GlobalStore.js')
-rw-r--r--src/store/modules/GlobalStore.js30
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')