Fix last power operation time bug
- To display updated time in the UI, `getLastPowerOperationTime`
must be dispatched after each async power operation
Signed-off-by: Dixsie Wolmers <dixsie@ibm.com>
Change-Id: Ie3fc38b55e75532fa703a45d5d598d4f80514f1a
diff --git a/src/store/modules/Control/ControlStore.js b/src/store/modules/Control/ControlStore.js
index f27f5a6..82dbdcc 100644
--- a/src/store/modules/Control/ControlStore.js
+++ b/src/store/modules/Control/ControlStore.js
@@ -85,36 +85,40 @@
dispatch('hostPowerChange', data);
await checkForHostStatus.bind(this, 'on')();
commit('setOperationInProgress', false);
+ dispatch('getLastPowerOperationTime');
},
async hostSoftReboot({ dispatch, commit }) {
const data = { ResetType: 'GracefulRestart' };
dispatch('hostPowerChange', data);
await checkForHostStatus.bind(this, 'on')();
commit('setOperationInProgress', false);
+ dispatch('getLastPowerOperationTime');
},
async hostHardReboot({ dispatch, commit }) {
const data = { ResetType: 'ForceRestart' };
dispatch('hostPowerChange', data);
await checkForHostStatus.bind(this, 'on')();
commit('setOperationInProgress', false);
+ dispatch('getLastPowerOperationTime');
},
async hostSoftPowerOff({ dispatch, commit }) {
const data = { ResetType: 'GracefulShutdown' };
dispatch('hostPowerChange', data);
await checkForHostStatus.bind(this, 'off')();
commit('setOperationInProgress', false);
+ dispatch('getLastPowerOperationTime');
},
async hostHardPowerOff({ dispatch, commit }) {
const data = { ResetType: 'ForceOff' };
dispatch('hostPowerChange', data);
await checkForHostStatus.bind(this, 'off')();
commit('setOperationInProgress', false);
+ dispatch('getLastPowerOperationTime');
},
- hostPowerChange({ commit, dispatch }, data) {
+ hostPowerChange({ commit }, data) {
commit('setOperationInProgress', true);
api
.post('/redfish/v1/Systems/system/Actions/ComputerSystem.Reset', data)
- .then(() => dispatch('getLastPowerOperationTime'))
.catch(error => {
console.log(error);
commit('setOperationInProgress', false);