diff options
author | Dixsie Wolmers <dixsie@ibm.com> | 2020-08-18 01:38:46 +0300 |
---|---|---|
committer | Derick Montague <derick.montague@ibm.com> | 2020-08-21 22:39:04 +0300 |
commit | 50cf2f78ea0b4fe4c08514d1dc71112312a2790b (patch) | |
tree | 49d510debf2e873b01cc17c9cae463ca4f32d4ec /src/store | |
parent | bb3160669584e165bb0be40bc3daef2e78307624 (diff) | |
download | webui-vue-50cf2f78ea0b4fe4c08514d1dc71112312a2790b.tar.xz |
Add last reset time to reboot bmc page
- Timestamp is displayed to inform user of last
power operation
Signed-off-by: Dixsie Wolmers <dixsie@ibm.com>
Change-Id: Ia4d95bced701b04f1099d020ee062f06d16ae8dc
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/Control/ControlStore.js | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/store/modules/Control/ControlStore.js b/src/store/modules/Control/ControlStore.js index 6908769d..f27f5a69 100644 --- a/src/store/modules/Control/ControlStore.js +++ b/src/store/modules/Control/ControlStore.js @@ -32,17 +32,21 @@ const ControlStore = { namespaced: true, state: { isOperationInProgress: false, - lastPowerOperationTime: null + lastPowerOperationTime: null, + lastBmcRebootTime: null }, getters: { isOperationInProgress: state => state.isOperationInProgress, - lastPowerOperationTime: state => state.lastPowerOperationTime + lastPowerOperationTime: state => state.lastPowerOperationTime, + lastBmcRebootTime: state => state.lastBmcRebootTime }, mutations: { setOperationInProgress: (state, inProgress) => (state.isOperationInProgress = inProgress), setLastPowerOperationTime: (state, lastPowerOperationTime) => - (state.lastPowerOperationTime = lastPowerOperationTime) + (state.lastPowerOperationTime = lastPowerOperationTime), + setLastBmcRebootTime: (state, lastBmcRebootTime) => + (state.lastBmcRebootTime = lastBmcRebootTime) }, actions: { async getLastPowerOperationTime({ commit }) { @@ -55,10 +59,21 @@ const ControlStore = { }) .catch(error => console.log(error)); }, - async rebootBmc() { + getLastBmcRebootTime({ commit }) { + return api + .get('/redfish/v1/Managers/bmc') + .then(response => { + const lastBmcReset = response.data.LastResetTime; + const lastBmcRebootTime = new Date(lastBmcReset); + commit('setLastBmcRebootTime', lastBmcRebootTime); + }) + .catch(error => console.log(error)); + }, + async rebootBmc({ dispatch }) { const data = { ResetType: 'GracefulRestart' }; return await api .post('/redfish/v1/Managers/bmc/Actions/Manager.Reset', data) + .then(() => dispatch('getLastBmcRebootTime')) .then(() => i18n.t('pageRebootBmc.toast.successRebootStart')) .catch(error => { console.log(error); |