blob: b9a4323aa5b4b3b91bcad12d77ec6c17609038d1 [file] [log] [blame]
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -06001<template>
2 <b-container fluid="xl">
3 <page-title />
4 <b-row>
SurenNewarebd0c01f2021-01-20 21:13:09 +05305 <b-col md="8">
Nikhil Ashokaaee27142022-01-27 19:10:31 +05306 <b-row v-if="!modifySSHPolicyDisabled" class="setting-section">
7 <b-col class="d-flex align-items-center justify-content-between">
jason westoverd36ac8a2025-11-03 20:58:59 -06008 <dl class="me-3 w-75">
Nikhil Ashokaaee27142022-01-27 19:10:31 +05309 <dt>{{ $t('pagePolicies.ssh') }}</dt>
10 <dd>
11 {{ $t('pagePolicies.sshDescription') }}
12 </dd>
13 </dl>
14 <b-form-checkbox
15 id="sshSwitch"
16 v-model="sshProtocolState"
17 data-test-id="policies-toggle-bmcShell"
18 switch
19 @change="changeSshProtocolState"
20 >
jason westoverd36ac8a2025-11-03 20:58:59 -060021 <span class="visually-hidden-focusable">
Nikhil Ashokaaee27142022-01-27 19:10:31 +053022 {{ $t('pagePolicies.ssh') }}
23 </span>
24 <span v-if="sshProtocolState">
25 {{ $t('global.status.enabled') }}
26 </span>
27 <span v-else>{{ $t('global.status.disabled') }}</span>
28 </b-form-checkbox>
29 </b-col>
30 </b-row>
31 <b-row class="setting-section">
32 <b-col class="d-flex align-items-center justify-content-between">
jason westoverd36ac8a2025-11-03 20:58:59 -060033 <dl class="mt-3 me-3 w-75">
Nikhil Ashokaaee27142022-01-27 19:10:31 +053034 <dt>{{ $t('pagePolicies.ipmi') }}</dt>
35 <dd>
36 {{ $t('pagePolicies.ipmiDescription') }}
37 </dd>
38 </dl>
39 <b-form-checkbox
40 id="ipmiSwitch"
41 v-model="ipmiProtocolState"
42 data-test-id="polices-toggle-networkIpmi"
43 switch
44 @change="changeIpmiProtocolState"
45 >
jason westoverd36ac8a2025-11-03 20:58:59 -060046 <span class="visually-hidden-focusable">
Nikhil Ashokaaee27142022-01-27 19:10:31 +053047 {{ $t('pagePolicies.ipmi') }}
48 </span>
49 <span v-if="ipmiProtocolState">
50 {{ $t('global.status.enabled') }}
51 </span>
52 <span v-else>{{ $t('global.status.disabled') }}</span>
53 </b-form-checkbox>
54 </b-col>
55 </b-row>
56 <b-row class="setting-section">
57 <b-col class="d-flex align-items-center justify-content-between">
jason westoverd36ac8a2025-11-03 20:58:59 -060058 <dl class="mt-3 me-3 w-75">
Nikhil Ashokaaee27142022-01-27 19:10:31 +053059 <dt>{{ $t('pagePolicies.vtpm') }}</dt>
60 <dd>
61 {{ $t('pagePolicies.vtpmDescription') }}
62 </dd>
63 </dl>
64 <b-form-checkbox
65 id="vtpmSwitch"
66 v-model="vtpmState"
67 data-test-id="policies-toggle-vtpm"
68 switch
69 @change="changeVtpmState"
70 >
jason westoverd36ac8a2025-11-03 20:58:59 -060071 <span class="visually-hidden-focusable">
Nikhil Ashokaaee27142022-01-27 19:10:31 +053072 {{ $t('pagePolicies.vtpm') }}
73 </span>
74 <span v-if="vtpmState">
75 {{ $t('global.status.enabled') }}
76 </span>
77 <span v-else>{{ $t('global.status.disabled') }}</span>
78 </b-form-checkbox>
79 </b-col>
80 </b-row>
81 <b-row class="setting-section">
82 <b-col class="d-flex align-items-center justify-content-between">
jason westoverd36ac8a2025-11-03 20:58:59 -060083 <dl class="mt-3 me-3 w-75">
Nikhil Ashokaaee27142022-01-27 19:10:31 +053084 <dt>{{ $t('pagePolicies.rtad') }}</dt>
85 <dd>
86 {{ $t('pagePolicies.rtadDescription') }}
87 </dd>
88 </dl>
89 <b-form-checkbox
90 id="rtadSwitch"
91 v-model="rtadState"
92 data-test-id="policies-toggle-rtad"
93 switch
94 @change="changeRtadState"
95 >
jason westoverd36ac8a2025-11-03 20:58:59 -060096 <span class="visually-hidden-focusable">
Nikhil Ashokaaee27142022-01-27 19:10:31 +053097 {{ $t('pagePolicies.rtad') }}
98 </span>
99 <span v-if="rtadState">
100 {{ $t('global.status.enabled') }}
101 </span>
102 <span v-else>{{ $t('global.status.disabled') }}</span>
103 </b-form-checkbox>
104 </b-col>
105 </b-row>
kirankumarb072dabfc12023-03-29 11:19:31 +0530106 <b-row class="setting-section">
107 <b-col class="d-flex align-items-center justify-content-between">
jason westoverd36ac8a2025-11-03 20:58:59 -0600108 <dl class="mt-3 me-3 w-75">
kirankumarb072dabfc12023-03-29 11:19:31 +0530109 <dt>{{ $t('pagePolicies.webSessionTimeOut') }}</dt>
110 <dd>
111 {{ $t('pagePolicies.webSessionTimeOutDescription') }}
112 </dd>
113 </dl>
114 </b-col>
115 <b-col lg="3" class="session-timeout">
116 <b-form-select
117 id="session-timeout-options"
118 v-model="sessionTimeoutState"
119 :options="sessionTimeOutOptions"
jason westoverd36ac8a2025-11-03 20:58:59 -0600120 @update:model-value="saveSessionTimeoutValue"
kirankumarb072dabfc12023-03-29 11:19:31 +0530121 >
122 <template #first>
123 <b-form-select-option :value="null" disabled>
124 {{ $t('global.form.selectAnOption') }}
125 </b-form-select-option>
126 </template>
127 </b-form-select>
128 </b-col>
129 </b-row>
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600130 </b-col>
131 </b-row>
132 </b-container>
133</template>
134
135<script>
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600136import PageTitle from '@/components/Global/PageTitle';
137
138import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
139import BVToastMixin from '@/components/Mixins/BVToastMixin';
Surya Vde23ea22024-07-11 15:19:46 +0530140import { useI18n } from 'vue-i18n';
141import i18n from '@/i18n';
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600142
143export default {
Sandeepa Singhb4406162021-07-26 15:05:39 +0530144 name: 'Policies',
Nikhil Ashokaaee27142022-01-27 19:10:31 +0530145 components: { PageTitle },
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600146 mixins: [LoadingBarMixin, BVToastMixin],
147 beforeRouteLeave(to, from, next) {
148 this.hideLoader();
149 next();
150 },
MichalX Szopinskie020d582021-08-16 15:46:58 +0200151 data() {
152 return {
Surya Vde23ea22024-07-11 15:19:46 +0530153 $t: useI18n().t,
MichalX Szopinskie020d582021-08-16 15:46:58 +0200154 modifySSHPolicyDisabled:
155 process.env.VUE_APP_MODIFY_SSH_POLICY_DISABLED === 'true',
kirankumarb072dabfc12023-03-29 11:19:31 +0530156 sessionTimeOutOptions: [
jason westoverd36ac8a2025-11-03 20:58:59 -0600157 {
158 value: 1800,
159 text: i18n.global.t('pagePolicies.options.30minutes'),
160 },
161 {
162 value: 3600,
163 text: i18n.global.t('pagePolicies.options.1hour'),
164 },
165 {
166 value: 7200,
167 text: i18n.global.t('pagePolicies.options.2hours'),
168 },
169 {
170 value: 14400,
171 text: i18n.global.t('pagePolicies.options.4hours'),
172 },
173 {
174 value: 28800,
175 text: i18n.global.t('pagePolicies.options.8hours'),
176 },
177 {
178 value: 86400,
179 text: i18n.global.t('pagePolicies.options.1day'),
180 },
kirankumarb072dabfc12023-03-29 11:19:31 +0530181 ],
MichalX Szopinskie020d582021-08-16 15:46:58 +0200182 };
183 },
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600184 computed: {
185 sshProtocolState: {
186 get() {
Sandeepa Singhb4406162021-07-26 15:05:39 +0530187 return this.$store.getters['policies/sshProtocolEnabled'];
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600188 },
189 set(newValue) {
190 return newValue;
191 },
192 },
193 ipmiProtocolState: {
194 get() {
Sandeepa Singhb4406162021-07-26 15:05:39 +0530195 return this.$store.getters['policies/ipmiProtocolEnabled'];
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600196 },
197 set(newValue) {
198 return newValue;
199 },
200 },
Nikhil Ashokaaee27142022-01-27 19:10:31 +0530201 rtadState: {
202 get() {
203 if (this.$store.getters['policies/rtadEnabled'] === 'Enabled') {
204 return true;
205 } else {
206 return false;
207 }
208 },
209 set(newValue) {
210 return newValue;
211 },
212 },
213 vtpmState: {
214 get() {
215 if (this.$store.getters['policies/vtpmEnabled'] === 'Enabled') {
216 return true;
217 } else {
218 return false;
219 }
220 },
221 set(newValue) {
222 return newValue;
223 },
224 },
kirankumarb072dabfc12023-03-29 11:19:31 +0530225 sessionTimeoutState: {
226 get() {
227 return this.$store.getters['policies/getSessionTimeoutValue'];
228 },
229 set(newValue) {
230 return newValue;
231 },
232 },
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600233 },
234 created() {
235 this.startLoader();
Nikhil Ashokaaee27142022-01-27 19:10:31 +0530236 Promise.all([
237 this.$store.dispatch('policies/getBiosStatus'),
238 this.$store.dispatch('policies/getNetworkProtocolStatus'),
kirankumarb072dabfc12023-03-29 11:19:31 +0530239 this.$store.dispatch('policies/getSessionTimeout'),
Nikhil Ashokaaee27142022-01-27 19:10:31 +0530240 ]).finally(() => this.endLoader());
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600241 },
242 methods: {
243 changeIpmiProtocolState(state) {
244 this.$store
Sandeepa Singhb4406162021-07-26 15:05:39 +0530245 .dispatch('policies/saveIpmiProtocolState', state)
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600246 .then((message) => this.successToast(message))
247 .catch(({ message }) => this.errorToast(message));
248 },
249 changeSshProtocolState(state) {
250 this.$store
Sandeepa Singhb4406162021-07-26 15:05:39 +0530251 .dispatch('policies/saveSshProtocolState', state)
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600252 .then((message) => this.successToast(message))
253 .catch(({ message }) => this.errorToast(message));
254 },
Nikhil Ashokaaee27142022-01-27 19:10:31 +0530255 changeRtadState(state) {
256 this.$store
257 .dispatch('policies/saveRtadState', state ? 'Enabled' : 'Disabled')
258 .then((message) => this.successToast(message))
259 .catch(({ message }) => this.errorToast(message));
260 },
261 changeVtpmState(state) {
262 this.$store
263 .dispatch('policies/saveVtpmState', state ? 'Enabled' : 'Disabled')
264 .then((message) => this.successToast(message))
265 .catch(({ message }) => this.errorToast(message));
266 },
jason westoverd36ac8a2025-11-03 20:58:59 -0600267 saveSessionTimeoutValue(value) {
kirankumarb072dabfc12023-03-29 11:19:31 +0530268 this.$store
jason westoverd36ac8a2025-11-03 20:58:59 -0600269 .dispatch('policies/saveSessionTimeoutValue', value)
kirankumarb072dabfc12023-03-29 11:19:31 +0530270 .then((message) => this.successToast(message))
271 .catch(({ message }) => this.errorToast(message));
272 },
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600273 },
274};
275</script>
276
277<style lang="scss" scoped>
278.setting-section {
jason westoverd36ac8a2025-11-03 20:58:59 -0600279 border-bottom: 1px solid $gray-300;
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600280}
kirankumarb072dabfc12023-03-29 11:19:31 +0530281.session-timeout {
282 align-self: center;
283}
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600284</style>