blob: 7bd987709751002ad8a70ebaf560e703493943c0 [file] [log] [blame]
Yoshie Muranakac11d3892020-02-19 08:07:40 -08001<template>
Yoshie Muranaka3111b6f2020-04-21 19:48:38 -07002 <b-container fluid="xl">
Yoshie Muranakac11d3892020-02-19 08:07:40 -08003 <page-title />
4 <b-row>
5 <b-col md="8" lg="8" xl="6">
6 <page-section>
Dixsie Wolmers50cf2f72020-08-17 17:38:46 -05007 <b-row>
8 <b-col>
9 <dl>
10 <dt>
11 {{ $t('pageRebootBmc.lastReboot') }}
12 </dt>
13 <dd v-if="lastBmcRebootTime">
14 {{ lastBmcRebootTime | formatDate }}
15 {{ lastBmcRebootTime | formatTime }}
16 </dd>
17 <dd v-else>--</dd>
18 </dl>
19 </b-col>
20 </b-row>
Yoshie Muranakac11d3892020-02-19 08:07:40 -080021 {{ $t('pageRebootBmc.rebootInformation') }}
Yoshie Muranakadb7aae22020-07-14 16:03:35 -070022 <b-button
23 variant="primary"
24 class="d-block mt-5"
25 data-test-id="rebootBmc-button-reboot"
26 @click="onClick"
27 >
Yoshie Muranakac11d3892020-02-19 08:07:40 -080028 {{ $t('pageRebootBmc.rebootBmc') }}
29 </b-button>
30 </page-section>
31 </b-col>
32 </b-row>
33 </b-container>
34</template>
35
36<script>
37import PageTitle from '../../../components/Global/PageTitle';
38import PageSection from '../../../components/Global/PageSection';
39import BVToastMixin from '../../../components/Mixins/BVToastMixin';
Dixsie Wolmers50cf2f72020-08-17 17:38:46 -050040import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
Yoshie Muranakac11d3892020-02-19 08:07:40 -080041
42export default {
43 name: 'RebootBmc',
44 components: { PageTitle, PageSection },
Dixsie Wolmers50cf2f72020-08-17 17:38:46 -050045 mixins: [BVToastMixin, LoadingBarMixin],
46 computed: {
47 lastBmcRebootTime() {
48 return this.$store.getters['controls/lastBmcRebootTime'];
49 }
50 },
51 created() {
52 this.startLoader();
53 this.$store
54 .dispatch('controls/getLastBmcRebootTime')
55 .finally(() => this.endLoader());
56 },
Yoshie Muranakac11d3892020-02-19 08:07:40 -080057 methods: {
58 onClick() {
59 this.$bvModal
60 .msgBoxConfirm(this.$t('pageRebootBmc.modal.confirmMessage'), {
61 title: this.$t('pageRebootBmc.modal.confirmTitle'),
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -080062 okTitle: this.$t('global.action.confirm')
Yoshie Muranakac11d3892020-02-19 08:07:40 -080063 })
64 .then(confirmed => {
65 if (confirmed) this.rebootBmc();
66 });
67 },
68 rebootBmc() {
69 this.$store
70 .dispatch('controls/rebootBmc')
71 .then(message => this.successToast(message))
72 .catch(({ message }) => this.errorToast(message));
73 }
74 }
75};
76</script>
77
78<style lang="scss" scoped></style>