Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 1 | <template> |
| 2 | <b-container fluid="xl"> |
| 3 | <page-title /> |
| 4 | <b-row> |
SurenNeware | bd0c01f | 2021-01-20 21:13:09 +0530 | [diff] [blame] | 5 | <b-col md="8"> |
Nikhil Ashoka | aee2714 | 2022-01-27 19:10:31 +0530 | [diff] [blame] | 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> |
kirankumarb07 | 2dabfc1 | 2023-03-29 11:19:31 +0530 | [diff] [blame] | 106 | <b-row class="setting-section"> |
| 107 | <b-col class="d-flex align-items-center justify-content-between"> |
| 108 | <dl class="mt-3 mr-3 w-75"> |
| 109 | <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" |
| 120 | @change="saveSessionTimeoutValue" |
| 121 | > |
| 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 Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 130 | </b-col> |
| 131 | </b-row> |
| 132 | </b-container> |
| 133 | </template> |
| 134 | |
| 135 | <script> |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 136 | import PageTitle from '@/components/Global/PageTitle'; |
| 137 | |
| 138 | import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; |
| 139 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; |
| 140 | |
| 141 | export default { |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 142 | name: 'Policies', |
Nikhil Ashoka | aee2714 | 2022-01-27 19:10:31 +0530 | [diff] [blame] | 143 | components: { PageTitle }, |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 144 | mixins: [LoadingBarMixin, BVToastMixin], |
| 145 | beforeRouteLeave(to, from, next) { |
| 146 | this.hideLoader(); |
| 147 | next(); |
| 148 | }, |
MichalX Szopinski | e020d58 | 2021-08-16 15:46:58 +0200 | [diff] [blame] | 149 | data() { |
| 150 | return { |
| 151 | modifySSHPolicyDisabled: |
| 152 | process.env.VUE_APP_MODIFY_SSH_POLICY_DISABLED === 'true', |
kirankumarb07 | 2dabfc1 | 2023-03-29 11:19:31 +0530 | [diff] [blame] | 153 | sessionTimeOutOptions: [ |
| 154 | { value: 1800, text: this.$t('pagePolicies.options.30minutes') }, |
| 155 | { value: 3600, text: this.$t('pagePolicies.options.1hour') }, |
| 156 | { value: 7200, text: this.$t('pagePolicies.options.2hours') }, |
| 157 | { value: 14400, text: this.$t('pagePolicies.options.4hours') }, |
| 158 | { value: 28800, text: this.$t('pagePolicies.options.8hours') }, |
| 159 | { value: 86400, text: this.$t('pagePolicies.options.1day') }, |
| 160 | ], |
MichalX Szopinski | e020d58 | 2021-08-16 15:46:58 +0200 | [diff] [blame] | 161 | }; |
| 162 | }, |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 163 | computed: { |
| 164 | sshProtocolState: { |
| 165 | get() { |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 166 | return this.$store.getters['policies/sshProtocolEnabled']; |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 167 | }, |
| 168 | set(newValue) { |
| 169 | return newValue; |
| 170 | }, |
| 171 | }, |
| 172 | ipmiProtocolState: { |
| 173 | get() { |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 174 | return this.$store.getters['policies/ipmiProtocolEnabled']; |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 175 | }, |
| 176 | set(newValue) { |
| 177 | return newValue; |
| 178 | }, |
| 179 | }, |
Nikhil Ashoka | aee2714 | 2022-01-27 19:10:31 +0530 | [diff] [blame] | 180 | rtadState: { |
| 181 | get() { |
| 182 | if (this.$store.getters['policies/rtadEnabled'] === 'Enabled') { |
| 183 | return true; |
| 184 | } else { |
| 185 | return false; |
| 186 | } |
| 187 | }, |
| 188 | set(newValue) { |
| 189 | return newValue; |
| 190 | }, |
| 191 | }, |
| 192 | vtpmState: { |
| 193 | get() { |
| 194 | if (this.$store.getters['policies/vtpmEnabled'] === 'Enabled') { |
| 195 | return true; |
| 196 | } else { |
| 197 | return false; |
| 198 | } |
| 199 | }, |
| 200 | set(newValue) { |
| 201 | return newValue; |
| 202 | }, |
| 203 | }, |
kirankumarb07 | 2dabfc1 | 2023-03-29 11:19:31 +0530 | [diff] [blame] | 204 | sessionTimeoutState: { |
| 205 | get() { |
| 206 | return this.$store.getters['policies/getSessionTimeoutValue']; |
| 207 | }, |
| 208 | set(newValue) { |
| 209 | return newValue; |
| 210 | }, |
| 211 | }, |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 212 | }, |
| 213 | created() { |
| 214 | this.startLoader(); |
Nikhil Ashoka | aee2714 | 2022-01-27 19:10:31 +0530 | [diff] [blame] | 215 | Promise.all([ |
| 216 | this.$store.dispatch('policies/getBiosStatus'), |
| 217 | this.$store.dispatch('policies/getNetworkProtocolStatus'), |
kirankumarb07 | 2dabfc1 | 2023-03-29 11:19:31 +0530 | [diff] [blame] | 218 | this.$store.dispatch('policies/getSessionTimeout'), |
Nikhil Ashoka | aee2714 | 2022-01-27 19:10:31 +0530 | [diff] [blame] | 219 | ]).finally(() => this.endLoader()); |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 220 | }, |
| 221 | methods: { |
| 222 | changeIpmiProtocolState(state) { |
| 223 | this.$store |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 224 | .dispatch('policies/saveIpmiProtocolState', state) |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 225 | .then((message) => this.successToast(message)) |
| 226 | .catch(({ message }) => this.errorToast(message)); |
| 227 | }, |
| 228 | changeSshProtocolState(state) { |
| 229 | this.$store |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 230 | .dispatch('policies/saveSshProtocolState', state) |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 231 | .then((message) => this.successToast(message)) |
| 232 | .catch(({ message }) => this.errorToast(message)); |
| 233 | }, |
Nikhil Ashoka | aee2714 | 2022-01-27 19:10:31 +0530 | [diff] [blame] | 234 | changeRtadState(state) { |
| 235 | this.$store |
| 236 | .dispatch('policies/saveRtadState', state ? 'Enabled' : 'Disabled') |
| 237 | .then((message) => this.successToast(message)) |
| 238 | .catch(({ message }) => this.errorToast(message)); |
| 239 | }, |
| 240 | changeVtpmState(state) { |
| 241 | this.$store |
| 242 | .dispatch('policies/saveVtpmState', state ? 'Enabled' : 'Disabled') |
| 243 | .then((message) => this.successToast(message)) |
| 244 | .catch(({ message }) => this.errorToast(message)); |
| 245 | }, |
kirankumarb07 | 2dabfc1 | 2023-03-29 11:19:31 +0530 | [diff] [blame] | 246 | saveSessionTimeoutValue(sessionTimeoutState) { |
| 247 | this.$store |
| 248 | .dispatch('policies/saveSessionTimeoutValue', sessionTimeoutState) |
| 249 | .then((message) => this.successToast(message)) |
| 250 | .catch(({ message }) => this.errorToast(message)); |
| 251 | }, |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 252 | }, |
| 253 | }; |
| 254 | </script> |
| 255 | |
| 256 | <style lang="scss" scoped> |
Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame^] | 257 | @import '@/assets/styles/bmc/helpers/_index.scss'; |
| 258 | @import '@/assets/styles/bootstrap/_helpers.scss'; |
| 259 | |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 260 | .setting-section { |
| 261 | border-bottom: 1px solid gray('300'); |
| 262 | } |
kirankumarb07 | 2dabfc1 | 2023-03-29 11:19:31 +0530 | [diff] [blame] | 263 | .session-timeout { |
| 264 | align-self: center; |
| 265 | } |
Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 266 | </style> |