blob: d0a6a5e59ccb7e4a2fd62d9de08cb76150dd0279 [file] [log] [blame]
Sandeepa Singh05887b52022-01-10 19:19:36 +05301<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">
jason westoverd36ac8a2025-11-03 20:58:59 -06007 <div class="fw-bold">
Sandeepa Singh05887b52022-01-10 19:19:36 +05308 {{ $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>
jason westoverd36ac8a2025-11-03 20:58:59 -060029 <b-form-text id="key-clear-not-requested" class="ms-4 mb-3">
Sandeepa Singh05887b52022-01-10 19:19:36 +053030 {{ $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>
jason westoverd36ac8a2025-11-03 20:58:59 -060035 <b-form-text id="clear-all" class="ms-4 mb-3">
Sandeepa Singh05887b52022-01-10 19:19:36 +053036 {{ $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>
jason westoverd36ac8a2025-11-03 20:58:59 -060041 <b-form-text id="clear-hypervisor-key" class="ms-4 mb-3">
Sandeepa Singh05887b52022-01-10 19:19:36 +053042 {{ $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>
68import PageTitle from '@/components/Global/PageTitle';
69import BVToastMixin from '@/components/Mixins/BVToastMixin';
70import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
71import Alert from '@/components/Global/Alert';
Surya Vde23ea22024-07-11 15:19:46 +053072import { useI18n } from 'vue-i18n';
73import i18n from '@/i18n';
jason westoverd36ac8a2025-11-03 20:58:59 -060074import { useModal } from 'bootstrap-vue-next';
Sandeepa Singh05887b52022-01-10 19:19:36 +053075
76export default {
77 name: 'KeyClear',
78 components: { PageTitle, Alert },
79 mixins: [LoadingBarMixin, BVToastMixin],
jason westoverd36ac8a2025-11-03 20:58:59 -060080 setup() {
81 const bvModal = useModal();
82 return { bvModal };
83 },
Sandeepa Singh05887b52022-01-10 19:19:36 +053084 data() {
85 return {
Surya Vde23ea22024-07-11 15:19:46 +053086 $t: useI18n().t,
Sandeepa Singh05887b52022-01-10 19:19:36 +053087 keyOption: 'NONE',
88 username: this.$store.getters['global/username'],
89 };
90 },
91 created() {
92 this.hideLoader();
93 },
94 methods: {
95 onKeyClearSubmit(valueSelected) {
jason westoverd36ac8a2025-11-03 20:58:59 -060096 this.$confirm(i18n.global.t('pageKeyClear.modal.clearAllMessage'), {
97 title: i18n.global.t('pageKeyClear.modal.clearAllTitle'),
98 okTitle: i18n.global.t('pageKeyClear.modal.clear'),
99 okVariant: 'danger',
100 cancelTitle: i18n.global.t('global.action.cancel'),
101 autoFocusButton: 'cancel',
102 }).then((clearConfirmed) => {
103 if (clearConfirmed) {
104 this.$store
105 .dispatch('keyClear/clearEncryptionKeys', valueSelected)
106 .then((message) => this.successToast(message))
107 .catch(({ message }) => this.errorToast(message));
108 }
109 });
Sandeepa Singh05887b52022-01-10 19:19:36 +0530110 },
111 },
112};
113</script>