1<template> 2 <b-container fluid="xl"> 3 <page-title /> 4 <b-row> 5 <b-col md="8"> 6 <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> 106 </b-col> 107 </b-row> 108 </b-container> 109</template> 110 111<script> 112import PageTitle from '@/components/Global/PageTitle'; 113 114import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; 115import BVToastMixin from '@/components/Mixins/BVToastMixin'; 116 117export default { 118 name: 'Policies', 119 components: { PageTitle }, 120 mixins: [LoadingBarMixin, BVToastMixin], 121 beforeRouteLeave(to, from, next) { 122 this.hideLoader(); 123 next(); 124 }, 125 data() { 126 return { 127 modifySSHPolicyDisabled: 128 process.env.VUE_APP_MODIFY_SSH_POLICY_DISABLED === 'true', 129 }; 130 }, 131 computed: { 132 sshProtocolState: { 133 get() { 134 return this.$store.getters['policies/sshProtocolEnabled']; 135 }, 136 set(newValue) { 137 return newValue; 138 }, 139 }, 140 ipmiProtocolState: { 141 get() { 142 return this.$store.getters['policies/ipmiProtocolEnabled']; 143 }, 144 set(newValue) { 145 return newValue; 146 }, 147 }, 148 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 }, 172 }, 173 created() { 174 this.startLoader(); 175 Promise.all([ 176 this.$store.dispatch('policies/getBiosStatus'), 177 this.$store.dispatch('policies/getNetworkProtocolStatus'), 178 ]).finally(() => this.endLoader()); 179 }, 180 methods: { 181 changeIpmiProtocolState(state) { 182 this.$store 183 .dispatch('policies/saveIpmiProtocolState', state) 184 .then((message) => this.successToast(message)) 185 .catch(({ message }) => this.errorToast(message)); 186 }, 187 changeSshProtocolState(state) { 188 this.$store 189 .dispatch('policies/saveSshProtocolState', state) 190 .then((message) => this.successToast(message)) 191 .catch(({ message }) => this.errorToast(message)); 192 }, 193 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 }, 205 }, 206}; 207</script> 208 209<style lang="scss" scoped> 210.setting-section { 211 border-bottom: 1px solid gray('300'); 212} 213</style> 214