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 | |
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')
-rw-r--r-- | src/locales/en-US.json | 1 | ||||
-rw-r--r-- | src/store/modules/Control/ControlStore.js | 23 | ||||
-rw-r--r-- | 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 @@ <b-row> <b-col md="8" lg="8" xl="6"> <page-section> + <b-row> + <b-col> + <dl> + <dt> + {{ $t('pageRebootBmc.lastReboot') }} + </dt> + <dd v-if="lastBmcRebootTime"> + {{ lastBmcRebootTime | formatDate }} + {{ lastBmcRebootTime | formatTime }} + </dd> + <dd v-else>--</dd> + </dl> + </b-col> + </b-row> {{ $t('pageRebootBmc.rebootInformation') }} <b-button variant="primary" @@ -23,11 +37,23 @@ import PageTitle from '../../../components/Global/PageTitle'; import PageSection from '../../../components/Global/PageSection'; import BVToastMixin from '../../../components/Mixins/BVToastMixin'; +import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; export default { name: 'RebootBmc', components: { PageTitle, PageSection }, - mixins: [BVToastMixin], + mixins: [BVToastMixin, LoadingBarMixin], + computed: { + lastBmcRebootTime() { + return this.$store.getters['controls/lastBmcRebootTime']; + } + }, + created() { + this.startLoader(); + this.$store + .dispatch('controls/getLastBmcRebootTime') + .finally(() => this.endLoader()); + }, methods: { onClick() { this.$bvModal |