blob: 1dc197c7972cf85aa7aae4593320553bc0ba7350 [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">
8 <dl class="mr-3 w-75">
9 <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 >
21 <span class="sr-only">
22 {{ $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">
33 <dl class="mt-3 mr-3 w-75">
34 <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 >
46 <span class="sr-only">
47 {{ $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">
58 <dl class="mt-3 mr-3 w-75">
59 <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 >
71 <span class="sr-only">
72 {{ $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">
83 <dl class="mt-3 mr-3 w-75">
84 <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 >
96 <span class="sr-only">
97 {{ $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>
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600106 </b-col>
107 </b-row>
108 </b-container>
109</template>
110
111<script>
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600112import PageTitle from '@/components/Global/PageTitle';
113
114import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
115import BVToastMixin from '@/components/Mixins/BVToastMixin';
116
117export default {
Sandeepa Singhb4406162021-07-26 15:05:39 +0530118 name: 'Policies',
Nikhil Ashokaaee27142022-01-27 19:10:31 +0530119 components: { PageTitle },
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600120 mixins: [LoadingBarMixin, BVToastMixin],
121 beforeRouteLeave(to, from, next) {
122 this.hideLoader();
123 next();
124 },
MichalX Szopinskie020d582021-08-16 15:46:58 +0200125 data() {
126 return {
127 modifySSHPolicyDisabled:
128 process.env.VUE_APP_MODIFY_SSH_POLICY_DISABLED === 'true',
129 };
130 },
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600131 computed: {
132 sshProtocolState: {
133 get() {
Sandeepa Singhb4406162021-07-26 15:05:39 +0530134 return this.$store.getters['policies/sshProtocolEnabled'];
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600135 },
136 set(newValue) {
137 return newValue;
138 },
139 },
140 ipmiProtocolState: {
141 get() {
Sandeepa Singhb4406162021-07-26 15:05:39 +0530142 return this.$store.getters['policies/ipmiProtocolEnabled'];
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600143 },
144 set(newValue) {
145 return newValue;
146 },
147 },
Nikhil Ashokaaee27142022-01-27 19:10:31 +0530148 rtadState: {
149 get() {
150 if (this.$store.getters['policies/rtadEnabled'] === 'Enabled') {
151 return true;
152 } else {
153 return false;
154 }
155 },
156 set(newValue) {
157 return newValue;
158 },
159 },
160 vtpmState: {
161 get() {
162 if (this.$store.getters['policies/vtpmEnabled'] === 'Enabled') {
163 return true;
164 } else {
165 return false;
166 }
167 },
168 set(newValue) {
169 return newValue;
170 },
171 },
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600172 },
173 created() {
174 this.startLoader();
Nikhil Ashokaaee27142022-01-27 19:10:31 +0530175 Promise.all([
176 this.$store.dispatch('policies/getBiosStatus'),
177 this.$store.dispatch('policies/getNetworkProtocolStatus'),
178 ]).finally(() => this.endLoader());
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600179 },
180 methods: {
181 changeIpmiProtocolState(state) {
182 this.$store
Sandeepa Singhb4406162021-07-26 15:05:39 +0530183 .dispatch('policies/saveIpmiProtocolState', state)
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600184 .then((message) => this.successToast(message))
185 .catch(({ message }) => this.errorToast(message));
186 },
187 changeSshProtocolState(state) {
188 this.$store
Sandeepa Singhb4406162021-07-26 15:05:39 +0530189 .dispatch('policies/saveSshProtocolState', state)
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600190 .then((message) => this.successToast(message))
191 .catch(({ message }) => this.errorToast(message));
192 },
Nikhil Ashokaaee27142022-01-27 19:10:31 +0530193 changeRtadState(state) {
194 this.$store
195 .dispatch('policies/saveRtadState', state ? 'Enabled' : 'Disabled')
196 .then((message) => this.successToast(message))
197 .catch(({ message }) => this.errorToast(message));
198 },
199 changeVtpmState(state) {
200 this.$store
201 .dispatch('policies/saveVtpmState', state ? 'Enabled' : 'Disabled')
202 .then((message) => this.successToast(message))
203 .catch(({ message }) => this.errorToast(message));
204 },
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600205 },
206};
207</script>
208
209<style lang="scss" scoped>
210.setting-section {
211 border-bottom: 1px solid gray('300');
212}
213</style>