Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 1 | <template> |
Yoshie Muranaka | 3111b6f | 2020-04-21 19:48:38 -0700 | [diff] [blame] | 2 | <b-container fluid="xl"> |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 3 | <page-title /> |
| 4 | <b-row> |
| 5 | <b-col md="8" lg="8" xl="6"> |
| 6 | <page-section> |
Dixsie Wolmers | 50cf2f7 | 2020-08-17 17:38:46 -0500 | [diff] [blame] | 7 | <b-row> |
| 8 | <b-col> |
| 9 | <dl> |
| 10 | <dt> |
| 11 | {{ $t('pageRebootBmc.lastReboot') }} |
| 12 | </dt> |
| 13 | <dd v-if="lastBmcRebootTime"> |
Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 14 | {{ $filters.formatDate(lastBmcRebootTime) }} |
| 15 | {{ $filters.formatTime(lastBmcRebootTime) }} |
Dixsie Wolmers | 50cf2f7 | 2020-08-17 17:38:46 -0500 | [diff] [blame] | 16 | </dd> |
| 17 | <dd v-else>--</dd> |
| 18 | </dl> |
| 19 | </b-col> |
| 20 | </b-row> |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 21 | {{ $t('pageRebootBmc.rebootInformation') }} |
Yoshie Muranaka | db7aae2 | 2020-07-14 16:03:35 -0700 | [diff] [blame] | 22 | <b-button |
| 23 | variant="primary" |
| 24 | class="d-block mt-5" |
| 25 | data-test-id="rebootBmc-button-reboot" |
| 26 | @click="onClick" |
| 27 | > |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 28 | {{ $t('pageRebootBmc.rebootBmc') }} |
| 29 | </b-button> |
| 30 | </page-section> |
| 31 | </b-col> |
| 32 | </b-row> |
| 33 | </b-container> |
| 34 | </template> |
| 35 | |
| 36 | <script> |
SurenNeware | 6185909 | 2020-10-01 09:37:32 +0530 | [diff] [blame] | 37 | import PageTitle from '@/components/Global/PageTitle'; |
| 38 | import PageSection from '@/components/Global/PageSection'; |
| 39 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; |
Dixsie Wolmers | 50cf2f7 | 2020-08-17 17:38:46 -0500 | [diff] [blame] | 40 | import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; |
Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 41 | import { useI18n } from 'vue-i18n'; |
| 42 | import i18n from '@/i18n'; |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 43 | |
| 44 | export default { |
| 45 | name: 'RebootBmc', |
| 46 | components: { PageTitle, PageSection }, |
Dixsie Wolmers | 50cf2f7 | 2020-08-17 17:38:46 -0500 | [diff] [blame] | 47 | mixins: [BVToastMixin, LoadingBarMixin], |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 48 | beforeRouteLeave(to, from, next) { |
| 49 | this.hideLoader(); |
| 50 | next(); |
| 51 | }, |
Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 52 | data() { |
| 53 | return { |
| 54 | $t: useI18n().t, |
| 55 | }; |
| 56 | }, |
Dixsie Wolmers | 50cf2f7 | 2020-08-17 17:38:46 -0500 | [diff] [blame] | 57 | computed: { |
| 58 | lastBmcRebootTime() { |
| 59 | return this.$store.getters['controls/lastBmcRebootTime']; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 60 | }, |
Dixsie Wolmers | 50cf2f7 | 2020-08-17 17:38:46 -0500 | [diff] [blame] | 61 | }, |
| 62 | created() { |
| 63 | this.startLoader(); |
| 64 | this.$store |
| 65 | .dispatch('controls/getLastBmcRebootTime') |
| 66 | .finally(() => this.endLoader()); |
| 67 | }, |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 68 | methods: { |
| 69 | onClick() { |
| 70 | this.$bvModal |
Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 71 | .msgBoxConfirm(i18n.global.t('pageRebootBmc.modal.confirmMessage'), { |
| 72 | title: i18n.global.t('pageRebootBmc.modal.confirmTitle'), |
| 73 | okTitle: i18n.global.t('global.action.confirm'), |
| 74 | cancelTitle: i18n.global.t('global.action.cancel'), |
Paul Fertser | d1ef18e | 2024-04-06 08:04:14 +0000 | [diff] [blame] | 75 | autoFocusButton: 'ok', |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 76 | }) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 77 | .then((confirmed) => { |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 78 | if (confirmed) this.rebootBmc(); |
| 79 | }); |
| 80 | }, |
| 81 | rebootBmc() { |
| 82 | this.$store |
| 83 | .dispatch('controls/rebootBmc') |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 84 | .then((message) => this.successToast(message)) |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 85 | .catch(({ message }) => this.errorToast(message)); |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 86 | }, |
| 87 | }, |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 88 | }; |
| 89 | </script> |
| 90 | |
Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 91 | <style lang="scss" scoped> |
| 92 | @import '@/assets/styles/bmc/helpers/_index.scss'; |
| 93 | @import '@/assets/styles/bootstrap/_helpers.scss'; |
| 94 | </style> |