1<template> 2 <b-container fluid="xl"> 3 <page-title :description="$t('pageFactoryReset.description')" /> 4 5 <!-- Reset Form --> 6 <b-form id="factory-reset" @submit.prevent="onResetSubmit"> 7 <b-row> 8 <b-col md="8"> 9 <b-form-group :label="$t('pageFactoryReset.form.resetOptionsLabel')"> 10 <b-form-radio-group 11 id="factory-reset-options" 12 v-model="resetOption" 13 stacked 14 > 15 <b-form-radio 16 class="mb-1" 17 value="resetBios" 18 aria-describedby="reset-bios" 19 data-test-id="factoryReset-radio-resetBios" 20 > 21 {{ $t('pageFactoryReset.form.resetBiosOptionLabel') }} 22 </b-form-radio> 23 <b-form-text id="reset-bios" class="ml-4 mb-3"> 24 {{ $t('pageFactoryReset.form.resetBiosOptionHelperText') }} 25 </b-form-text> 26 27 <b-form-radio 28 class="mb-1" 29 value="resetToDefaults" 30 aria-describedby="reset-to-defaults" 31 data-test-id="factoryReset-radio-resetToDefaults" 32 > 33 {{ $t('pageFactoryReset.form.resetToDefaultsOptionLabel') }} 34 </b-form-radio> 35 <b-form-text id="reset-to-defaults" class="ml-4 mb-3"> 36 {{ 37 $t('pageFactoryReset.form.resetToDefaultsOptionHelperText') 38 }} 39 </b-form-text> 40 </b-form-radio-group> 41 </b-form-group> 42 <b-button 43 type="submit" 44 variant="primary" 45 data-test-id="factoryReset-button-submit" 46 > 47 {{ $t('global.action.reset') }} 48 </b-button> 49 </b-col> 50 </b-row> 51 </b-form> 52 53 <!-- Modals --> 54 <modal-reset :reset-type="resetOption" @ok-confirm="onOkConfirm" /> 55 </b-container> 56</template> 57 58<script> 59import PageTitle from '@/components/Global/PageTitle'; 60import BVToastMixin from '@/components/Mixins/BVToastMixin'; 61import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; 62import ModalReset from './FactoryResetModal'; 63import { useI18n } from 'vue-i18n'; 64 65export default { 66 name: 'FactoryReset', 67 components: { PageTitle, ModalReset }, 68 mixins: [LoadingBarMixin, BVToastMixin], 69 data() { 70 return { 71 $t: useI18n().t, 72 resetOption: 'resetBios', 73 }; 74 }, 75 created() { 76 this.hideLoader(); 77 }, 78 methods: { 79 onResetSubmit() { 80 this.$bvModal.show('modal-reset'); 81 }, 82 onOkConfirm() { 83 if (this.resetOption == 'resetBios') { 84 this.onResetBiosConfirm(); 85 } else { 86 this.onResetToDefaultsConfirm(); 87 } 88 }, 89 onResetBiosConfirm() { 90 this.$store 91 .dispatch('factoryReset/resetBios') 92 .then((title) => { 93 this.successToast('', { 94 title, 95 }); 96 }) 97 .catch(({ message }) => { 98 this.errorToast('', { 99 title: message, 100 }); 101 }); 102 }, 103 onResetToDefaultsConfirm() { 104 this.$store 105 .dispatch('factoryReset/resetToDefaults') 106 .then((title) => { 107 this.successToast('', { 108 title, 109 }); 110 }) 111 .catch(({ message }) => { 112 this.errorToast('', { 113 title: message, 114 }); 115 }); 116 }, 117 }, 118}; 119</script> 120