Sandeepa Singh | 05887b5 | 2022-01-10 19:19:36 +0530 | [diff] [blame] | 1 | <template> |
| 2 | <b-container fluid="xl"> |
| 3 | <page-title :description="$t('pageKeyClear.description')" /> |
| 4 | <b-row> |
| 5 | <b-col md="8" xl="6"> |
| 6 | <alert variant="info" class="mb-4"> |
| 7 | <div class="font-weight-bold"> |
| 8 | {{ $t('pageKeyClear.alert.title') }} |
| 9 | </div> |
| 10 | <div> |
| 11 | {{ $t('pageKeyClear.alert.description') }} |
| 12 | </div> |
| 13 | </alert> |
| 14 | </b-col> |
| 15 | </b-row> |
| 16 | <!-- Reset Form --> |
| 17 | <b-form id="key-clear" @submit.prevent="onKeyClearSubmit(keyOption)"> |
| 18 | <b-row> |
| 19 | <b-col md="8"> |
| 20 | <b-form-group :label="$t('pageKeyClear.form.keyClearOptionsLabel')"> |
| 21 | <b-form-radio-group |
| 22 | id="key-clear-options" |
| 23 | v-model="keyOption" |
| 24 | stacked |
| 25 | > |
| 26 | <b-form-radio class="mb-1" value="NONE"> |
| 27 | {{ $t('pageKeyClear.form.none') }} |
| 28 | </b-form-radio> |
| 29 | <b-form-text id="key-clear-not-requested" class="ml-4 mb-3"> |
| 30 | {{ $t('pageKeyClear.form.keyClearNotRequested') }} |
| 31 | </b-form-text> |
| 32 | <b-form-radio class="mb-1" value="ALL"> |
| 33 | {{ $t('pageKeyClear.form.clearAllLabel') }} |
| 34 | </b-form-radio> |
| 35 | <b-form-text id="clear-all" class="ml-4 mb-3"> |
| 36 | {{ $t('pageKeyClear.form.clearAllHeperText') }} |
| 37 | </b-form-text> |
| 38 | <b-form-radio class="mb-1" value="POWERVM_SYSKEY"> |
| 39 | {{ $t('pageKeyClear.form.clearHypervisorSystemKeyLabel') }} |
| 40 | </b-form-radio> |
| 41 | <b-form-text id="clear-hypervisor-key" class="ml-4 mb-3"> |
| 42 | {{ $t('pageKeyClear.form.clearHypervisorSystemKeyHelperText') }} |
| 43 | </b-form-text> |
| 44 | <template v-if="username == 'service'"> |
| 45 | <b-form-radio class="mb-1" value="MFG_ALL"> |
| 46 | {{ $t('pageKeyClear.form.clearAllSetGenesisIPL') }} |
| 47 | </b-form-radio> |
| 48 | <b-form-radio class="mb-1" value="MFG"> |
| 49 | {{ $t('pageKeyClear.form.setFactoryDefault') }} |
| 50 | </b-form-radio> |
| 51 | </template> |
| 52 | </b-form-radio-group> |
| 53 | </b-form-group> |
| 54 | <b-button |
| 55 | type="submit" |
| 56 | variant="primary" |
| 57 | data-test-id="keyClear-button-submit" |
| 58 | > |
| 59 | {{ $t('pageKeyClear.form.clear') }} |
| 60 | </b-button> |
| 61 | </b-col> |
| 62 | </b-row> |
| 63 | </b-form> |
| 64 | </b-container> |
| 65 | </template> |
| 66 | |
| 67 | <script> |
| 68 | import PageTitle from '@/components/Global/PageTitle'; |
| 69 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; |
| 70 | import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; |
| 71 | import Alert from '@/components/Global/Alert'; |
| 72 | |
| 73 | export default { |
| 74 | name: 'KeyClear', |
| 75 | components: { PageTitle, Alert }, |
| 76 | mixins: [LoadingBarMixin, BVToastMixin], |
| 77 | data() { |
| 78 | return { |
| 79 | keyOption: 'NONE', |
| 80 | username: this.$store.getters['global/username'], |
| 81 | }; |
| 82 | }, |
| 83 | created() { |
| 84 | this.hideLoader(); |
| 85 | }, |
| 86 | methods: { |
| 87 | onKeyClearSubmit(valueSelected) { |
| 88 | this.$bvModal |
| 89 | .msgBoxConfirm(this.$t('pageKeyClear.modal.clearAllMessage'), { |
| 90 | title: this.$t('pageKeyClear.modal.clearAllTitle'), |
| 91 | okTitle: this.$t('pageKeyClear.modal.clear'), |
| 92 | okVariant: 'danger', |
| 93 | cancelTitle: this.$t('global.action.cancel'), |
Paul Fertser | d1ef18e | 2024-04-06 08:04:14 +0000 | [diff] [blame] | 94 | autoFocusButton: 'cancel', |
Sandeepa Singh | 05887b5 | 2022-01-10 19:19:36 +0530 | [diff] [blame] | 95 | }) |
| 96 | .then((clearConfirmed) => { |
| 97 | if (clearConfirmed) { |
| 98 | this.$store |
| 99 | .dispatch('keyClear/clearEncryptionKeys', valueSelected) |
| 100 | .then((message) => this.successToast(message)) |
| 101 | .catch(({ message }) => this.errorToast(message)); |
| 102 | } |
| 103 | }); |
| 104 | }, |
| 105 | }, |
| 106 | }; |
| 107 | </script> |