summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/locales/en-US.json1
-rw-r--r--src/store/modules/Control/ControlStore.js23
-rw-r--r--src/views/Control/RebootBmc/RebootBmc.vue28
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