| 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"> | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 6 | <page-section :section-title="$t('pagePolicies.networkServices')"> | 
| MichalX Szopinski | e020d58 | 2021-08-16 15:46:58 +0200 | [diff] [blame] | 7 | <b-row v-if="!modifySSHPolicyDisabled" class="setting-section"> | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 8 | <b-col class="d-flex align-items-center justify-content-between"> | 
|  | 9 | <dl class="mr-3 w-75"> | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 10 | <dt>{{ $t('pagePolicies.ssh') }}</dt> | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 11 | <dd> | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 12 | {{ $t('pagePolicies.sshDescription') }} | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 13 | </dd> | 
|  | 14 | </dl> | 
|  | 15 | <b-form-checkbox | 
|  | 16 | id="sshSwitch" | 
|  | 17 | v-model="sshProtocolState" | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 18 | data-test-id="policies-toggle-bmcShell" | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 19 | switch | 
|  | 20 | @change="changeSshProtocolState" | 
|  | 21 | > | 
|  | 22 | <span class="sr-only"> | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 23 | {{ $t('pagePolicies.ssh') }} | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 24 | </span> | 
|  | 25 | <span v-if="sshProtocolState"> | 
|  | 26 | {{ $t('global.status.enabled') }} | 
|  | 27 | </span> | 
|  | 28 | <span v-else>{{ $t('global.status.disabled') }}</span> | 
|  | 29 | </b-form-checkbox> | 
|  | 30 | </b-col> | 
|  | 31 | </b-row> | 
|  | 32 | <b-row class="setting-section"> | 
|  | 33 | <b-col class="d-flex align-items-center justify-content-between"> | 
|  | 34 | <dl class="mt-3 mr-3 w-75"> | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 35 | <dt>{{ $t('pagePolicies.ipmi') }}</dt> | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 36 | <dd> | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 37 | {{ $t('pagePolicies.ipmiDescription') }} | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 38 | </dd> | 
|  | 39 | </dl> | 
|  | 40 | <b-form-checkbox | 
|  | 41 | id="ipmiSwitch" | 
|  | 42 | v-model="ipmiProtocolState" | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 43 | data-test-id="polices-toggle-networkIpmi" | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 44 | switch | 
|  | 45 | @change="changeIpmiProtocolState" | 
|  | 46 | > | 
|  | 47 | <span class="sr-only"> | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 48 | {{ $t('pagePolicies.ipmi') }} | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 49 | </span> | 
|  | 50 | <span v-if="ipmiProtocolState"> | 
|  | 51 | {{ $t('global.status.enabled') }} | 
|  | 52 | </span> | 
|  | 53 | <span v-else>{{ $t('global.status.disabled') }}</span> | 
|  | 54 | </b-form-checkbox> | 
|  | 55 | </b-col> | 
|  | 56 | </b-row> | 
|  | 57 | </page-section> | 
|  | 58 | </b-col> | 
|  | 59 | </b-row> | 
|  | 60 | </b-container> | 
|  | 61 | </template> | 
|  | 62 |  | 
|  | 63 | <script> | 
|  | 64 | import PageSection from '@/components/Global/PageSection'; | 
|  | 65 | import PageTitle from '@/components/Global/PageTitle'; | 
|  | 66 |  | 
|  | 67 | import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; | 
|  | 68 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; | 
|  | 69 |  | 
|  | 70 | export default { | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 71 | name: 'Policies', | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 72 | components: { PageTitle, PageSection }, | 
|  | 73 | mixins: [LoadingBarMixin, BVToastMixin], | 
|  | 74 | beforeRouteLeave(to, from, next) { | 
|  | 75 | this.hideLoader(); | 
|  | 76 | next(); | 
|  | 77 | }, | 
| MichalX Szopinski | e020d58 | 2021-08-16 15:46:58 +0200 | [diff] [blame] | 78 | data() { | 
|  | 79 | return { | 
|  | 80 | modifySSHPolicyDisabled: | 
|  | 81 | process.env.VUE_APP_MODIFY_SSH_POLICY_DISABLED === 'true', | 
|  | 82 | }; | 
|  | 83 | }, | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 84 | computed: { | 
|  | 85 | sshProtocolState: { | 
|  | 86 | get() { | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 87 | return this.$store.getters['policies/sshProtocolEnabled']; | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 88 | }, | 
|  | 89 | set(newValue) { | 
|  | 90 | return newValue; | 
|  | 91 | }, | 
|  | 92 | }, | 
|  | 93 | ipmiProtocolState: { | 
|  | 94 | get() { | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 95 | return this.$store.getters['policies/ipmiProtocolEnabled']; | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 96 | }, | 
|  | 97 | set(newValue) { | 
|  | 98 | return newValue; | 
|  | 99 | }, | 
|  | 100 | }, | 
|  | 101 | }, | 
|  | 102 | created() { | 
|  | 103 | this.startLoader(); | 
|  | 104 | this.$store | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 105 | .dispatch('policies/getNetworkProtocolStatus') | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 106 | .finally(() => this.endLoader()); | 
|  | 107 | }, | 
|  | 108 | methods: { | 
|  | 109 | changeIpmiProtocolState(state) { | 
|  | 110 | this.$store | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 111 | .dispatch('policies/saveIpmiProtocolState', state) | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 112 | .then((message) => this.successToast(message)) | 
|  | 113 | .catch(({ message }) => this.errorToast(message)); | 
|  | 114 | }, | 
|  | 115 | changeSshProtocolState(state) { | 
|  | 116 | this.$store | 
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 117 | .dispatch('policies/saveSshProtocolState', state) | 
| Dixsie Wolmers | 8f030ba | 2020-12-07 13:12:53 -0600 | [diff] [blame] | 118 | .then((message) => this.successToast(message)) | 
|  | 119 | .catch(({ message }) => this.errorToast(message)); | 
|  | 120 | }, | 
|  | 121 | }, | 
|  | 122 | }; | 
|  | 123 | </script> | 
|  | 124 |  | 
|  | 125 | <style lang="scss" scoped> | 
|  | 126 | .setting-section { | 
|  | 127 | border-bottom: 1px solid gray('300'); | 
|  | 128 | } | 
|  | 129 | </style> |