blob: e98b7da14a9d48be22eedc4e77f4358d6e1a091f [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">
Surya Vde23ea22024-07-11 15:19:46 +053014 {{ $filters.formatDate(lastBmcRebootTime) }}
15 {{ $filters.formatTime(lastBmcRebootTime) }}
Dixsie Wolmers50cf2f72020-08-17 17:38:46 -050016 </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>
SurenNeware61859092020-10-01 09:37:32 +053037import 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';
Surya Vde23ea22024-07-11 15:19:46 +053041import { useI18n } from 'vue-i18n';
42import i18n from '@/i18n';
jason westoverd36ac8a2025-11-03 20:58:59 -060043import { useModal } from 'bootstrap-vue-next';
Yoshie Muranakac11d3892020-02-19 08:07:40 -080044
45export default {
46 name: 'RebootBmc',
47 components: { PageTitle, PageSection },
Dixsie Wolmers50cf2f72020-08-17 17:38:46 -050048 mixins: [BVToastMixin, LoadingBarMixin],
Derick Montague602e98a2020-10-21 16:20:00 -050049 beforeRouteLeave(to, from, next) {
50 this.hideLoader();
51 next();
52 },
jason westoverd36ac8a2025-11-03 20:58:59 -060053 setup() {
54 const bvModal = useModal();
55 return { bvModal };
56 },
Surya Vde23ea22024-07-11 15:19:46 +053057 data() {
58 return {
59 $t: useI18n().t,
60 };
61 },
Dixsie Wolmers50cf2f72020-08-17 17:38:46 -050062 computed: {
63 lastBmcRebootTime() {
64 return this.$store.getters['controls/lastBmcRebootTime'];
Derick Montague602e98a2020-10-21 16:20:00 -050065 },
Dixsie Wolmers50cf2f72020-08-17 17:38:46 -050066 },
67 created() {
68 this.startLoader();
69 this.$store
70 .dispatch('controls/getLastBmcRebootTime')
71 .finally(() => this.endLoader());
72 },
Yoshie Muranakac11d3892020-02-19 08:07:40 -080073 methods: {
74 onClick() {
jason westoverd36ac8a2025-11-03 20:58:59 -060075 this.$confirm(i18n.global.t('pageRebootBmc.modal.confirmMessage'), {
76 title: i18n.global.t('pageRebootBmc.modal.confirmTitle'),
77 okTitle: i18n.global.t('global.action.confirm'),
78 cancelTitle: i18n.global.t('global.action.cancel'),
79 autoFocusButton: 'ok',
80 }).then((confirmed) => {
81 if (confirmed) this.rebootBmc();
82 });
Yoshie Muranakac11d3892020-02-19 08:07:40 -080083 },
84 rebootBmc() {
85 this.$store
86 .dispatch('controls/rebootBmc')
Derick Montague602e98a2020-10-21 16:20:00 -050087 .then((message) => this.successToast(message))
Yoshie Muranakac11d3892020-02-19 08:07:40 -080088 .catch(({ message }) => this.errorToast(message));
Derick Montague602e98a2020-10-21 16:20:00 -050089 },
90 },
Yoshie Muranakac11d3892020-02-19 08:07:40 -080091};
92</script>
93
suryav972424b377d2025-01-24 15:06:35 +053094<style lang="scss" scoped></style>