blob: ebcb0025da3c86b82eab7fa3d5be626de2e60e41 [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">
Sandeepa Singhb4406162021-07-26 15:05:39 +05306 <page-section :section-title="$t('pagePolicies.networkServices')">
MichalX Szopinskie020d582021-08-16 15:46:58 +02007 <b-row v-if="!modifySSHPolicyDisabled" class="setting-section">
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -06008 <b-col class="d-flex align-items-center justify-content-between">
9 <dl class="mr-3 w-75">
Sandeepa Singhb4406162021-07-26 15:05:39 +053010 <dt>{{ $t('pagePolicies.ssh') }}</dt>
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060011 <dd>
Sandeepa Singhb4406162021-07-26 15:05:39 +053012 {{ $t('pagePolicies.sshDescription') }}
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060013 </dd>
14 </dl>
15 <b-form-checkbox
16 id="sshSwitch"
17 v-model="sshProtocolState"
Sandeepa Singhb4406162021-07-26 15:05:39 +053018 data-test-id="policies-toggle-bmcShell"
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060019 switch
20 @change="changeSshProtocolState"
21 >
22 <span class="sr-only">
Sandeepa Singhb4406162021-07-26 15:05:39 +053023 {{ $t('pagePolicies.ssh') }}
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060024 </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 Singhb4406162021-07-26 15:05:39 +053035 <dt>{{ $t('pagePolicies.ipmi') }}</dt>
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060036 <dd>
Sandeepa Singhb4406162021-07-26 15:05:39 +053037 {{ $t('pagePolicies.ipmiDescription') }}
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060038 </dd>
39 </dl>
40 <b-form-checkbox
41 id="ipmiSwitch"
42 v-model="ipmiProtocolState"
Sandeepa Singhb4406162021-07-26 15:05:39 +053043 data-test-id="polices-toggle-networkIpmi"
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060044 switch
45 @change="changeIpmiProtocolState"
46 >
47 <span class="sr-only">
Sandeepa Singhb4406162021-07-26 15:05:39 +053048 {{ $t('pagePolicies.ipmi') }}
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060049 </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>
64import PageSection from '@/components/Global/PageSection';
65import PageTitle from '@/components/Global/PageTitle';
66
67import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
68import BVToastMixin from '@/components/Mixins/BVToastMixin';
69
70export default {
Sandeepa Singhb4406162021-07-26 15:05:39 +053071 name: 'Policies',
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060072 components: { PageTitle, PageSection },
73 mixins: [LoadingBarMixin, BVToastMixin],
74 beforeRouteLeave(to, from, next) {
75 this.hideLoader();
76 next();
77 },
MichalX Szopinskie020d582021-08-16 15:46:58 +020078 data() {
79 return {
80 modifySSHPolicyDisabled:
81 process.env.VUE_APP_MODIFY_SSH_POLICY_DISABLED === 'true',
82 };
83 },
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060084 computed: {
85 sshProtocolState: {
86 get() {
Sandeepa Singhb4406162021-07-26 15:05:39 +053087 return this.$store.getters['policies/sshProtocolEnabled'];
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060088 },
89 set(newValue) {
90 return newValue;
91 },
92 },
93 ipmiProtocolState: {
94 get() {
Sandeepa Singhb4406162021-07-26 15:05:39 +053095 return this.$store.getters['policies/ipmiProtocolEnabled'];
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -060096 },
97 set(newValue) {
98 return newValue;
99 },
100 },
101 },
102 created() {
103 this.startLoader();
104 this.$store
Sandeepa Singhb4406162021-07-26 15:05:39 +0530105 .dispatch('policies/getNetworkProtocolStatus')
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600106 .finally(() => this.endLoader());
107 },
108 methods: {
109 changeIpmiProtocolState(state) {
110 this.$store
Sandeepa Singhb4406162021-07-26 15:05:39 +0530111 .dispatch('policies/saveIpmiProtocolState', state)
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600112 .then((message) => this.successToast(message))
113 .catch(({ message }) => this.errorToast(message));
114 },
115 changeSshProtocolState(state) {
116 this.$store
Sandeepa Singhb4406162021-07-26 15:05:39 +0530117 .dispatch('policies/saveSshProtocolState', state)
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -0600118 .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>