summaryrefslogtreecommitdiff
path: root/src/store/modules/Control
diff options
context:
space:
mode:
authorDixsie Wolmers <dixsie@ibm.com>2020-08-05 03:17:33 +0300
committerDerick Montague <derick.montague@ibm.com>2020-08-21 22:39:04 +0300
commitbb3160669584e165bb0be40bc3daef2e78307624 (patch)
treefc4e03afb05a0dd5cb715a22de90482624a3ea35 /src/store/modules/Control
parent3a35943f0bde3b91383bded6ad67215a43e4e693 (diff)
downloadwebui-vue-bb3160669584e165bb0be40bc3daef2e78307624.tar.xz
Add last reset time to server power operations page
- Timestamp is displayed to inform user of last power operation Signed-off-by: Dixsie Wolmers <dixsie@ibm.com> Change-Id: I14c23ff56b3a0cf134c0ad2d831290971d93e293
Diffstat (limited to 'src/store/modules/Control')
-rw-r--r--src/store/modules/Control/ControlStore.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/store/modules/Control/ControlStore.js b/src/store/modules/Control/ControlStore.js
index f88f2aa7..6908769d 100644
--- a/src/store/modules/Control/ControlStore.js
+++ b/src/store/modules/Control/ControlStore.js
@@ -31,16 +31,30 @@ const checkForHostStatus = function(hostStatus) {
const ControlStore = {
namespaced: true,
state: {
- isOperationInProgress: false
+ isOperationInProgress: false,
+ lastPowerOperationTime: null
},
getters: {
- isOperationInProgress: state => state.isOperationInProgress
+ isOperationInProgress: state => state.isOperationInProgress,
+ lastPowerOperationTime: state => state.lastPowerOperationTime
},
mutations: {
setOperationInProgress: (state, inProgress) =>
- (state.isOperationInProgress = inProgress)
+ (state.isOperationInProgress = inProgress),
+ setLastPowerOperationTime: (state, lastPowerOperationTime) =>
+ (state.lastPowerOperationTime = lastPowerOperationTime)
},
actions: {
+ async getLastPowerOperationTime({ commit }) {
+ return await api
+ .get('/redfish/v1/Systems/system')
+ .then(response => {
+ const lastReset = response.data.LastResetTime;
+ const lastPowerOperationTime = new Date(lastReset);
+ commit('setLastPowerOperationTime', lastPowerOperationTime);
+ })
+ .catch(error => console.log(error));
+ },
async rebootBmc() {
const data = { ResetType: 'GracefulRestart' };
return await api
@@ -81,10 +95,11 @@ const ControlStore = {
await checkForHostStatus.bind(this, 'off')();
commit('setOperationInProgress', false);
},
- hostPowerChange({ commit }, data) {
+ hostPowerChange({ commit, dispatch }, 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);