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"> |
| 14 | {{ lastBmcRebootTime | formatDate }} |
| 15 | {{ lastBmcRebootTime | formatTime }} |
| 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> |
| 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'; |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 41 | |
| 42 | export default { |
| 43 | name: 'RebootBmc', |
| 44 | components: { PageTitle, PageSection }, |
Dixsie Wolmers | 50cf2f7 | 2020-08-17 17:38:46 -0500 | [diff] [blame] | 45 | 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 Muranaka | 42c6560 | 2020-09-09 09:55:59 -0700 | [diff] [blame] | 57 | beforeRouteLeave(to, from, next) { |
| 58 | this.hideLoader(); |
| 59 | next(); |
| 60 | }, |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 61 | methods: { |
| 62 | onClick() { |
| 63 | this.$bvModal |
| 64 | .msgBoxConfirm(this.$t('pageRebootBmc.modal.confirmMessage'), { |
| 65 | title: this.$t('pageRebootBmc.modal.confirmTitle'), |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 66 | okTitle: this.$t('global.action.confirm') |
Yoshie Muranaka | c11d389 | 2020-02-19 08:07:40 -0800 | [diff] [blame] | 67 | }) |
| 68 | .then(confirmed => { |
| 69 | if (confirmed) this.rebootBmc(); |
| 70 | }); |
| 71 | }, |
| 72 | rebootBmc() { |
| 73 | this.$store |
| 74 | .dispatch('controls/rebootBmc') |
| 75 | .then(message => this.successToast(message)) |
| 76 | .catch(({ message }) => this.errorToast(message)); |
| 77 | } |
| 78 | } |
| 79 | }; |
| 80 | </script> |
| 81 | |
| 82 | <style lang="scss" scoped></style> |