From 50cf2f78ea0b4fe4c08514d1dc71112312a2790b Mon Sep 17 00:00:00 2001 From: Dixsie Wolmers Date: Mon, 17 Aug 2020 17:38:46 -0500 Subject: Add last reset time to reboot bmc page - Timestamp is displayed to inform user of last power operation Signed-off-by: Dixsie Wolmers Change-Id: Ia4d95bced701b04f1099d020ee062f06d16ae8dc --- src/locales/en-US.json | 1 + src/store/modules/Control/ControlStore.js | 23 +++++++++++++++++++---- src/views/Control/RebootBmc/RebootBmc.vue | 28 +++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/locales/en-US.json b/src/locales/en-US.json index cc993738..97f4578c 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -496,6 +496,7 @@ } }, "pageRebootBmc": { + "lastReboot": "Last BMC reboot", "rebootBmc": "Reboot BMC", "rebootInformation": "When you reboot the BMC, your web browser loses contact with the BMC for several minutes. When the BMC is back online, you may need to log in again.", "modal": { 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); diff --git a/src/views/Control/RebootBmc/RebootBmc.vue b/src/views/Control/RebootBmc/RebootBmc.vue index dbe17621..7bd98770 100644 --- a/src/views/Control/RebootBmc/RebootBmc.vue +++ b/src/views/Control/RebootBmc/RebootBmc.vue @@ -4,6 +4,20 @@ + + +
+
+ {{ $t('pageRebootBmc.lastReboot') }} +
+
+ {{ lastBmcRebootTime | formatDate }} + {{ lastBmcRebootTime | formatTime }} +
+
--
+
+
+
{{ $t('pageRebootBmc.rebootInformation') }} this.endLoader()); + }, methods: { onClick() { this.$bvModal -- cgit v1.2.3